flusterduck 0.2.0 → 0.3.0

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 ADDED
@@ -0,0 +1,161 @@
1
+ # flusterduck
2
+
3
+ Lightweight browser SDK for UX friction monitoring. Detects rage clicks, dead clicks, form abandonment, navigation loops, and 20+ other behavioral signals automatically. No configuration required beyond your publishable key.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install flusterduck
9
+ ```
10
+
11
+ Or load via script tag:
12
+
13
+ ```html
14
+ <script async src="https://flusterduck.com/d.js" data-key="fd_pub_..."></script>
15
+ ```
16
+
17
+ ## Basic usage
18
+
19
+ ```ts
20
+ import { init } from 'flusterduck';
21
+
22
+ init({ key: 'fd_pub_...' });
23
+ ```
24
+
25
+ Call `init` once on page load. It's idempotent; calling it again does nothing. The SDK attaches all signal detectors, starts batching events, and observes route changes automatically.
26
+
27
+ ## Manual signals
28
+
29
+ ```ts
30
+ import { signal, track, identify } from 'flusterduck';
31
+
32
+ // Custom friction signal with optional weight (0-100, default 15)
33
+ signal('checkout_error', { element: '#pay-btn', weight: 30 });
34
+
35
+ // Business event for correlation
36
+ track('checkout_started', { plan: 'scale' });
37
+
38
+ // Segment for filtering in the dashboard
39
+ identify({ plan: 'scale', role: 'admin' });
40
+ ```
41
+
42
+ ## Configuration
43
+
44
+ ```ts
45
+ init({
46
+ key: 'fd_pub_...',
47
+
48
+ // Tag events by environment
49
+ environment: 'production',
50
+
51
+ // Only track a fraction of sessions (0-1)
52
+ sampleRate: 0.5,
53
+
54
+ // Cookieless mode: session ID stored in sessionStorage
55
+ cookieless: false,
56
+
57
+ // Respect DoNotTrack and GlobalPrivacyControl (default: true)
58
+ respectDoNotTrack: true,
59
+
60
+ // Map URL patterns to logical page names
61
+ pageRules: [
62
+ { pattern: '/checkout/*', label: '/checkout' },
63
+ { pattern: '/blog/*', label: '/blog' },
64
+ ],
65
+
66
+ // Segment all events from this init call
67
+ segment: { plan: 'scale' },
68
+
69
+ // Control individual detectors
70
+ signals: {
71
+ rageClick: { enabled: true },
72
+ deadClick: { enabled: true },
73
+ formHesitation: { enabled: true, threshold: 3000 },
74
+ loopNav: { enabled: true },
75
+ helpHunt: { enabled: false },
76
+ },
77
+
78
+ // Skip tracking entirely on these pages
79
+ ignorePages: ['/internal', '/admin'],
80
+
81
+ // Skip signal detection on matching elements
82
+ ignoreElements: ['.no-track', '[data-fd-ignore]'],
83
+
84
+ // DOM evidence capture: 'off' | 'metadata' | 'snapshot'
85
+ domMode: 'metadata',
86
+
87
+ // Event batching
88
+ batchInterval: 2000,
89
+ batchMaxSize: 50,
90
+ });
91
+ ```
92
+
93
+ ## Consent and opt-out
94
+
95
+ ```ts
96
+ import { setConsent, optOut } from 'flusterduck';
97
+
98
+ // Pass true after the user accepts your cookie banner
99
+ setConsent(true);
100
+
101
+ // Permanently opt out: clears session and stops all tracking
102
+ optOut();
103
+ ```
104
+
105
+ `init` defers automatically if `respectDoNotTrack` is enabled and the user's browser signals DNT or Global Privacy Control. Call `setConsent(true)` explicitly to override.
106
+
107
+ ## Signal detectors
108
+
109
+ Automatic detectors (all on by default):
110
+
111
+ | Signal | Description |
112
+ |---|---|
113
+ | `rageClick` | 3+ clicks on the same target within 700ms |
114
+ | `deadClick` | Click with no DOM change within 500ms |
115
+ | `speedFrustration` | Server response takes over 3s |
116
+ | `thrashCursor` | High-velocity erratic mouse movement |
117
+ | `loopNav` | Same page visited 3+ times in one session |
118
+ | `scrollBounce` | Scroll to bottom then immediately back |
119
+ | `formHesitation` | Pause over 3s in a form field |
120
+ | `formAbandon` | Form interaction without submission |
121
+ | `formValidationLoop` | 3+ failed submit attempts |
122
+ | `errorEncounter` | Uncaught JS errors or unhandled rejections |
123
+ | `scrollHijack` | Scroll direction reversed by the page |
124
+ | `scrollDepthAbandon` | Scroll past 80% then leave without action |
125
+ | `helpHunt` | Repeated clicks on help/support elements |
126
+ | `closeClick` | Modal/overlay dismissed repeatedly |
127
+ | `filterSpiral` | Rapid filter/sort changes |
128
+ | `copyFrustration` | Copy attempt on non-selectable content |
129
+ | `navigationConfusion` | Back/forward used immediately after navigation |
130
+ | `deadClickTrapZone` | Cluster of dead clicks in one area |
131
+
132
+ Mobile-only (activates automatically on touch devices):
133
+
134
+ | Signal | Description |
135
+ |---|---|
136
+ | `mobileTapMiss` | Tap on non-interactive element |
137
+ | `pinchZoom` | Pinch-to-zoom on non-zoomable content |
138
+ | `swipeFrustration` | Failed swipe gestures |
139
+
140
+ Keyboard:
141
+
142
+ | Signal | Description |
143
+ |---|---|
144
+ | `tabThrash` | Tab key used rapidly without focusing any input |
145
+ | `focusTrap` | Focus trapped in a region |
146
+ | `keyboardNavFrustration` | Arrow key navigation with no visible change |
147
+
148
+ ## Lifecycle
149
+
150
+ ```ts
151
+ import { destroy } from 'flusterduck';
152
+
153
+ // Tears down all detectors and flushes the event queue
154
+ destroy();
155
+ ```
156
+
157
+ Route changes in SPAs are detected automatically via History API patching and `popstate`. You don't need to call anything on navigation.
158
+
159
+ ## Key format
160
+
161
+ The SDK only accepts publishable keys (`fd_pub_`). If a secret key (`fd_sec_`) is passed, it logs an error and aborts. Nothing is tracked.
package/dist/d.global.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{function t(t){return(...e)=>{try{return t(...e)}catch{}}}function e(t){return e=>{try{t(e)}catch{}}}var n="_fd_s",o=/^[0-9a-f]{32}$/;function r(){s(n,"",-1)}function i(){const t=new Uint8Array(16);crypto.getRandomValues(t);let e="";for(const n of t)e+=n.toString(16).padStart(2,"0");return e}function s(t,e,n){const o=new Date;o.setTime(o.getTime()+864e5*n);const r="https:"===location.protocol?";Secure":"";document.cookie=`${t}=${encodeURIComponent(e)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var a=/^[:\d]|--|^(ember|react|ng-|__)/;function c(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!a.test(t.id)&&t.id.length<64)return"#"+u(t.id);const n=[];let o=t,r=0;for(;o&&o!==document.body&&r<5;){let t=o.tagName.toLowerCase();const e=o.getAttribute("name"),i=o.getAttribute("role"),s=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!s||"input"!==t&&"button"!==t||(t+=`[type="${u(s)}"]`);const a=o.parentElement;if(a){const e=a.children;let n=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];i&&i.tagName===o.tagName&&(n++,i===o&&(r=n))}n>1&&(t+=`:nth-of-type(${r})`)}n.unshift(t);const c=n.join(" > ");try{if(1===document.querySelectorAll(c).length)return c}catch(t){}o=a,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}function l(t,e){if(t.hasAttribute("data-fd-ignore"))return!0;if(t.closest("[data-fd-ignore]"))return!0;for(const n of e)try{if(t.matches(n)||t.closest(n))return!0}catch(t){}return!1}function d(t,e){return t&&e.includes(t)?t:null}function f(t){const e=t.tagName.toLowerCase();if("input"!==e&&"button"!==e)return null;const n=t.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function p(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function h(t){if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!/^(button|link|tab|menuitem|checkbox|radio)$/.test(e))}var m=6e4,w="application/json",y=[],g=null,b="",v=7e3,_=50,M=null,k={domMode:"off",compression:"auto"},T=!1,D=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),A=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),x=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,E=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,S=e(()=>{"hidden"===document.visibilityState&&j()}),O=t(()=>j());function $(t){y.length>=100||(y.push(t),y.length>=_?j():g||(g=setTimeout(j,v)))}function j(){(async()=>{if(T)return;if(!y.length||!M)return;T=!0,g&&(clearTimeout(g),g=null);const t=y;y=[];const e={v:1,sid:M.sid,key:M.key,url:M.url,page:M.page,ts:Date.now(),ua:M.ua,vw:M.vw,vh:M.vh,environment:M.environment,dom_mode:k.domMode},n=t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":A.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},s=C(o.el,o.element,o.target);if("signal"===r){i.signal_type=C(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));const t=s?((t,e)=>{if("off"===e)return null;try{const n=document.querySelector(t);return n?((t,e)=>{if("off"===e)return null;if("metadata"===e)return(t=>({mode:"metadata",selector:c(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),attributes:{disabled:!0===t.disabled,required:!0===t.required,ariaDisabled:"true"===t.getAttribute("aria-disabled"),ariaExpanded:d(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:d(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:f(t)}}))(t);const n=(t=>{try{const e=t.getBoundingClientRect(),n=getComputedStyle(t),o=t.parentElement,r=[];if(o)for(let e=0;e<o.children.length&&r.length<6;e++){const n=o.children[e];if(!n||n===t)continue;const i=n.getBoundingClientRect();r.push({selector:c(n),tag:n.tagName.toLowerCase(),box:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)},interactive:h(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:c(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?c(o):"",box:{x:Math.round(e.x),y:Math.round(e.y),w:Math.round(e.width),h:Math.round(e.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:!0===t.disabled},inView:p(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(s,n):null;t&&(i.dom=t)}const a=(t=>{const e=Object.create(null);for(const n of Object.keys(t)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;const o=L(t[n],n);void 0!==o&&(e[n.slice(0,64)]=o)}if(t.meta&&"object"==typeof t.meta&&!Array.isArray(t.meta)){const n=L(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(a).length&&(i.metadata=a),i})(t,M.page,k.domMode));let o=[];try{for(const t of n){const n=[...o,t];if(JSON.stringify({...e,events:n}).length>m)if(o.length>0)await N({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=m&&await N(n),o=[]}else o=n}o.length>0&&await N({...e,events:o})}catch{}finally{T=!1}})()}function U(t){if(M)for(const e of Object.keys(t))D.has(e)&&(M[e]=t[e])}async function N(t){const e=JSON.stringify(t),n=await(async(t,e)=>{const n=(new TextEncoder).encode(t);if(n.byteLength>m)return null;if("off"!==e){const e=await(async t=>{const e=globalThis.CompressionStream;if("function"!=typeof e)return null;try{const n=(t=>{const e=(new TextEncoder).encode(t),n=new Blob([e],{type:w});if("function"==typeof n.stream)return n.stream();const o=globalThis.ReadableStream;return"function"!=typeof o?null:new o({start(t){t.enqueue(e),t.close()}})})(t);if(!n)return null;const o=new e("gzip"),r=n.pipeThrough(o).getReader(),i=[];let s=0;for(;;){const t=await r.read();if(t.done)break;if(s+=t.value.byteLength,s>m)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const a=new Uint8Array(s);let c=0;for(const t of i)a.set(t,c),c+=t.byteLength;return a.buffer}catch{return null}})(t);if(e&&e.byteLength<=m)return{beaconBody:new Blob([e],{type:"application/json; encoding=gzip"}),fetchBody:new Uint8Array(e),headers:{"Content-Type":w,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:w}),fetchBody:t,headers:{"Content-Type":w}}})(e,k.compression);n&&R(n,0)}function R(t,e){if(b){if(navigator.sendBeacon&&navigator.sendBeacon(b,t.beaconBody))return;try{fetch(b,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>R(t,e+1),1e3*(e+1))})}catch{}}}function L(t,e="",n=0){if(!(n>4||x.test(e))){if(null===t||"boolean"==typeof t)return t;if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t){if(E.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>L(t,e,n+1)).filter(t=>void 0!==t);if("object"==typeof t){const e=Object.create(null);for(const o of Object.keys(t).slice(0,40)){if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=L(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function C(...t){for(const e of t)if("string"==typeof e&&e)return e}function z(t){return"off"===t?"off":"auto"}function B(t,e){for(const n of e){const e=F(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id"))(t)}var I=/^[a-zA-Z0-9/:._*\-]+$/;function F(t){if(t.length>200)return null;if(!I.test(t))return null;const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var J=[".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"]'],q=[],P=3,X=2e3,Z=[],H=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(l(e,Z))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||!!t.hasAttribute("ondblclick")})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;q.length&&n-q[0].t>X;)q.shift();if(q.push({t:n,x:o,y:r}),q.length<P)return;const i=q.slice(-P),s=i[0];for(let t=1;t<i.length;t++){const e=i[t],n=e.x-s.x,o=e.y-s.y;if(n*n+o*o>64)return}const a=(i[i.length-1].t-s.t)/1e3,u=a>0?i.length/a:i.length;$({t:"sig",ts:n,d:{s:"rage_click",el:c(e),cnt:i.length,vel:Math.round(10*u)/10}}),q=[]}),V=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Y=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,G=/^(A|BUTTON|LABEL)$/,K=[],Q=null,W=e(t=>{Q={x:t.clientX,y:t.clientY}}),tt=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(l(e,K))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Q)return!1;const e=t.clientX-Q.x,n=t.clientY-Q.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(V.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Y.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!G.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const n=((t,e,n)=>{let o=t;for(let r=0;r<5&&o;r++){const r=o.parentElement;if(!r)break;const i=r.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let s=null,a=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const c=et(e,n,r);c<a&&(a=c,s=r)}if(s&&a<100)return s;o=r}return null})(e,t.clientX,t.clientY),o=n?et(t.clientX,t.clientY,n):-1;$({t:"sig",ts:Date.now(),d:{s:"dead_click",el:c(e),near:n?c(n):"",dist:Math.round(o)}})});function et(t,e,n){const o=n.getBoundingClientRect(),r=t-Math.max(o.left,Math.min(t,o.right)),i=e-Math.max(o.top,Math.min(e,o.bottom));return Math.sqrt(r*r+i*i)}var nt=null,ot=3e3,rt=[],it=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,st=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,at=e(t=>{const e=t.target;if(!e)return;if(l(e,rt))return;const n=e.getAttribute("role");if(!(it.test(e.tagName)||n&&st.test(n)))return;if(nt){if(nt.el===e||nt.el.contains(e)){const t=Date.now()-nt.ts;return t>=ot&&$({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:nt.selector,delay:t}}),void ct()}ct()}const o=c(e);let r=!1;const i=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return r=!0,void ct();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return r=!0,void ct()}}),s=e.parentElement||document.body;i.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const a=setTimeout(()=>{!r&&nt&&(nt={...nt,timeout:null})},ot+500);nt={el:e,selector:o,ts:Date.now(),observer:i,timeout:a}});function ct(){nt&&(nt.observer.disconnect(),nt.timeout&&clearTimeout(nt.timeout),nt=null)}var ut=800,lt=2e3,dt=0,ft=0,pt=0,ht=0,mt=0,wt=0,yt=0,gt=0,bt=[],vt=null,_t=e(t=>{const e=Date.now();e-dt<16||(dt=e,vt&&clearTimeout(vt),vt=setTimeout(()=>Mt(),150),((t,e,n)=>{if(0===ht)return ft=t,pt=e,ht=n,void(gt=n);const o=(n-ht)/1e3;if(0===o)return;const r=t-ft,i=e-pt;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i)/o;bt.length>=100&&(bt=bt.slice(-50)),bt.push(s);const a=Math.sign(r),c=Math.sign(i);if((0!==mt&&0!==a&&a!==mt||0!==wt&&0!==c&&c!==wt)&&yt++,mt=a||mt,wt=c||wt,ft=t,pt=e,ht=n,n-gt>lt){if(yt>=3){const t=bt.reduce((t,e)=>t+e,0)/bt.length;t>=ut&&$({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:yt}})}Mt(),gt=n}})(t.clientX,t.clientY,e))});function Mt(){yt=0,bt=[],mt=0,wt=0,ht=0,ft=0,pt=0,vt=null}var kt=[],Tt=3e4,Dt=1e4,At=.5,xt=[],Et=0,St=0,Ot=!1,$t=0,jt=e(()=>{Ot||(Ot=!0,requestAnimationFrame(()=>{Ot=!1,(()=>{const t=Date.now(),e=window.scrollY;if(($t=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/$t,o=e>Et?"down":"up";if(t-St<100)return void(Et=e);for(;xt.length&&t-xt[0].ts>Dt;)xt.shift();xt.length>=100&&(xt=xt.slice(-50)),xt.push({depth:n,ts:t,direction:o}),Et=e,St=t;let r=0,i=1,s=0,a=!1;for(let t=0;t<xt.length;t++){const e=xt[t].depth;e>r&&(r=e),e>=At&&(a=!0),a&&e<i&&(i=e),a&&i<.25&&e>=At&&(s++,a=!1,i=1)}s>=1&&($({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1}}),xt=[])})()}))}),Ut=["textarea",'[role="textbox"]',"[contenteditable]"],Nt=new Map,Rt=new Set,Lt=null,Ct=0,zt=5e3,Bt=[],It=e(t=>{const e=t.target;if(!e||!Zt(e))return;if(l(e,Bt))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of Ut)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;Nt.set(e,Date.now());const n=e.closest("form");n&&n!==Lt&&(Lt=n,Ct=n.querySelectorAll("input, select, textarea").length)}),Ft=e(t=>{const e=t.target;if(!e||!Zt(e))return;const n=Nt.get(e);if(Nt.delete(e),n){const t=Date.now()-n;t>=zt&&$({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:c(e),pause:t}})}const o=e.getAttribute("name")||e.getAttribute("id")||c(e);(t=>"value"in t&&t.value.length>0)(e)&&Rt.add(o)}),Jt=e(()=>{Rt.clear(),Lt=null}),qt=t(Xt),Pt=null;function Xt(){Rt.size>0&&Lt&&($({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:Rt.size,total:Ct||Rt.size}}),Rt.clear(),Lt=null)}function Zt(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var Ht=null,Vt=null,Yt=/flusterduck\.com|\/v1\/ingest/,Gt=e(t=>{$({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Wt(t.message||"Unknown error",200),ep:"",status:0}})}),Kt=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");$({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Wt(e,200),ep:"",status:0}})});function Qt(t){try{return new URL(t,location.origin).pathname}catch{const e=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(e>=0?e:t.length,n>=0?n:t.length);return t.slice(0,o)||"/"}}function Wt(t,e){let n=t.length>e?t.slice(0,e):t;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,t=>{try{return new URL(t).origin+new URL(t).pathname}catch{return"[URL]"}}),n}var te=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],ee=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ne=null,oe=0,re=0,ie=0,se=0,ae=null,ce=[],ue=e(t=>{const e=t.touches[0];1===t.touches.length&&e&&(ne={x:e.clientX,y:e.clientY,ts:Date.now()})}),le=e(t=>{if(!ne)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-ne.x,o=e.clientY-ne.y,r=Date.now()-ne.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(l(t,ce))return;const o=((t,e,n)=>{const o=(t.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])');let r=null,i=21;for(let t=0;t<o.length;t++){const s=o[t];if(!s)continue;const a=s.getBoundingClientRect(),c=Math.max(a.left,Math.min(e,a.right)),u=Math.max(a.top,Math.min(n,a.bottom)),l=Math.sqrt((e-c)**2+(n-u)**2);l<i&&l>0&&(i=l,r=s)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((e-i)**2+(n-s)**2);if(a>0&&a<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;$({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:c(o),dist:Math.round(a),size:t}})}})(i,e.clientX,e.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&((t,e,n)=>{if(Math.abs(n)>Math.abs(e))return;if(!t)return;if(te.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!te.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";$({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),ne=null}),de=e(()=>{const t=Date.now();if(t-re>3e4&&(oe=0,re=t),++oe>=2){const e=document.activeElement||document.body;ee.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})||$({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:oe}}),oe=0}}),fe=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-se>3e4&&(ie=0,se=t),e!==ae&&(ie++,ae=e),ie>=3&&($({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:ie}}),ie=0)}),pe=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const t=Date.now();t-re>3e4&&(oe=0,re=t),++oe>=2&&($({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:oe}}),oe=0)}}),he=[],me=null,we=0,ye=0,ge=[],be=e(t=>{const e=Date.now(),n=t.target;n&&l(n,[])||("Tab"===t.key?((t,e)=>{for(;he.length&&t-he[0].ts>5e3;)he.shift();he.length>=50&&(he=he.slice(-25));const n=e?c(e):"";if(he.push({ts:t,el:n}),he.length>=10){const e=he.map(t=>t.el).filter(Boolean);$({t:"sig",ts:t,d:{s:"tab_thrash",cnt:he.length,els:e}}),he=[]}if(!e)return;const o=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');o&&(o===me?t-ye<=3e3?++we>=5&&($({t:"sig",ts:t,d:{s:"focus_trap",container:c(o),attempts:we}}),we=0,me=null):(ye=t,we=1):(me=o,ye=t,we=1))})(e,n):"Escape"===t.key?((t,e)=>{if(!e)return;const n=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');n&&n===me&&++we>=5&&($({t:"sig",ts:t,d:{s:"focus_trap",container:c(n),attempts:we}}),we=0,me=null)})(e,t.target):"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||((t,e)=>{if(!e)return;const n=e.closest('[role="listbox"]')||e.closest('[role="menu"]')||e.closest('[role="tree"]')||e.closest("select");if(!n)return;for(;ge.length&&t-ge[0].ts>5e3;)ge.shift();ge.length>=50&&(ge=ge.slice(-25)),ge.push({ts:t,container:n});const o=ge.filter(t=>t.container===n);o.length>=15&&($({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:c(n),keys:o.length}}),ge=[])})(e,t.target))}),ve=0,_e=0,Me=null,ke=0,Te=!1,De=e(()=>{Te||(Te=!0,requestAnimationFrame(()=>{Te=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-_e;if(Math.abs(n)<2)return void(_e=e);const o=n>0?"down":"up";Me&&o!==Me&&(t-ke>3e3&&(ve=0,ke=t),++ve>=4)&&Math.abs(n)>100&&($({t:"sig",ts:t,d:{s:"scroll_hijack",rev:ve}}),ve=0),Me=o,_e=e})()}))}),Ae=0,xe=!1,Ee=e(()=>{xe||(xe=!0,requestAnimationFrame(()=>{xe=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Ae&&(Ae=e)}}))}),Se=t($e),Oe=null;function $e(){Ae>.05&&$({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(100*Ae)/100}})}var je="",Ue=0,Ne=0,Re=0,Le=0,Ce=0,ze=null,Be=!1,Ie=e(t=>{const e=t.target;if(!e)return;const n=c(e),o=Date.now();(n!==je||o-Ne>1500)&&(je=n,Ne=o,Ue=0),(Ue+=1)<4||($({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Ue,window_ms:1500}}),Ue=0,Ne=o)}),Fe=e(()=>{const t=Date.now(),e=Pe(),n=Ce||e,o=Math.abs(e-n)/Math.max(n,1);Ce=e,o<.15||((!Re||t-Re>5e3)&&(Re=t,Le=0),(Le+=1)<3||($({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(1e3*o)/1e3}}),Le=0,Re=t))}),Je=e(()=>{qe()});function qe(){Xe(),ze=setTimeout(()=>{$({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3}})},15e3)}function Pe(){return Math.max(1,window.innerWidth*window.innerHeight)}function Xe(){ze&&(clearTimeout(ze),ze=null)}var Ze=!1,He=null,Ve=null;function Ye(e){if(Ze)return;if(!e.key)return;if(e.key.startsWith("fd_sec_"))return;if(!e.key.startsWith("fd_pub_"))return;if(!1!==e.respectDoNotTrack&&("1"===navigator.doNotTrack||navigator.globalPrivacyControl))return void(Ve=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(Ve=e);Ve=e,Ze=!0;const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return s(n,r,30),r})(e.cookieless??!1),a=(t=>{if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}})(e.endpoint)??"https://api.flusterduck.com/v1/ingest",c=B(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;b=t,M=Object.assign(Object.create(null),e),k={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off"),compression:z(r?.compression)},v=Math.max(5e3,Math.min(n??7e3,1e4)),_=Math.max(5,Math.min(o??50,100)),document.addEventListener("visibilitychange",S),window.addEventListener("pagehide",O)})(a,{sid:r,key:e.key,url:location.origin+location.pathname,page:c,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u,compression:e.compression});const d=document.referrer;let f="";if(d)try{f=new URL(d).origin+new URL(d).pathname}catch{f=""}$({t:"pv",ts:Date.now(),d:{ref:f}});const p=e.ignoreElements??[],h=t=>{const n=e.signals?.[t];return!1!==n?.enabled};if(h("rageClick")&&((t,e)=>{P=t?.threshold??3,X=t?.windowMs??2e3,Z=[...J,...e??[]],document.addEventListener("click",H,{capture:!0,passive:!0})})(e.signals?.rageClick,p),h("deadClick")&&(t=>{K=t??[],document.addEventListener("mousedown",W,{capture:!0,passive:!0}),document.addEventListener("click",tt,{capture:!0,passive:!0})})(p),h("speedFrustration")){const t=e.signals?.speedFrustration;((t,e)=>{ot=t?.delayMs??3e3,rt=e??[],document.addEventListener("click",at,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,p)}var m;if(!1!==e.trackMouse&&h("thrashCursor")&&(m=e.signals?.thrashCursor,ut=m?.velocityThreshold??800,lt=m?.windowMs??2e3,document.addEventListener("mousemove",_t,{passive:!0})),h("loopNav")&&(t=>{Tt=t?.windowMs??3e4})(e.signals?.loopNav),h("scrollBounce")&&(Dt=1e4,At=.5,window.addEventListener("scroll",jt,{passive:!0})),!1!==e.trackForms&&(h("formHesitation")||h("formAbandon"))){const n=e.signals?.formHesitation;((e,n)=>{zt=e?.pauseMs??5e3,Bt=n??[],document.addEventListener("focusin",It,{capture:!0,passive:!0}),document.addEventListener("focusout",Ft,{capture:!0,passive:!0}),document.addEventListener("submit",Jt,{capture:!0,passive:!0}),window.addEventListener("pagehide",qt),Pt=t(()=>{"hidden"===document.visibilityState&&Xt()}),document.addEventListener("visibilitychange",Pt)})(n?{pauseMs:n.threshold}:void 0,p)}h("errorEncounter")&&(window.addEventListener("error",Gt),window.addEventListener("unhandledrejection",Kt),Ht||(Ht=window.fetch,Vt=function(t,e){let n;try{n=Ht.call(this,t,e)}catch(t){throw t}return n.then(e=>{try{if(e.status>=400){const n="string"==typeof t?t:t instanceof URL?t.pathname:t.url;Yt.test(n)||$({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:Qt(n),status:e.status}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;Yt.test(n)||$({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Wt(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?Qt(t):"",status:0}})}catch{}throw e})},window.fetch=Vt)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&(t=>{ce=t??[],document.addEventListener("touchstart",ue,{passive:!0}),document.addEventListener("touchend",le,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",de,{passive:!0}),window.addEventListener("orientationchange",fe,{passive:!0})),window.visualViewport?.addEventListener("resize",pe)})(p),(h("tabThrash")||h("focusTrap")||h("keyboardNavFrustration"))&&document.addEventListener("keydown",be,{capture:!0,passive:!0}),h("scrollHijack")&&window.addEventListener("scroll",De,{passive:!0}),h("scrollDepthAbandon")&&(window.addEventListener("scroll",Ee,{passive:!0}),window.addEventListener("pagehide",Se),Oe=t(()=>{"hidden"===document.visibilityState&&$e()}),document.addEventListener("visibilitychange",Oe)),h("advancedHeuristics")&&(Be||(Be=!0,Ce=Pe(),qe(),document.addEventListener("mouseenter",Ie,!0),document.addEventListener("mouseleave",Ie,!0),document.addEventListener("click",Je,{capture:!0,passive:!0}),document.addEventListener("keydown",Je,{capture:!0,passive:!0}),document.addEventListener("scroll",Je,{passive:!0}),window.addEventListener("resize",Fe,{passive:!0}))),He=function(t){let e=location.href;function n(){const n=location.href;n!==e&&(e=n,t(n,location.pathname))}const o=history.pushState,r=history.replaceState,i=function(...t){o.apply(this,t),n()},s=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((t,n)=>{j(),xt=[],Et=0,St=0,Nt.clear(),Rt.clear(),Lt=null,Ct=0,Ae=0,qe(),U({page:B(n,e.pageRules??[]),url:t}),(t=>{const e=Date.now();try{const t=performance.getEntriesByType("navigation");if(t.length>0&&"back_forward"===t[0].type)return}catch{}for(;kt.length&&e-kt[0].ts>Tt;)kt.shift();if(kt.length>=100&&(kt=kt.slice(-50)),kt.push({path:t,ts:e}),kt.length<4)return;const n=t;let o=!1;const r=[];for(let t=0;t<kt.length-1;t++)if(kt[t].path===n){const e=kt.slice(t,kt.length),n=new Set(e.map(t=>t.path));if(n.size>=2){r.push(...Array.from(n)),o=!0;break}}o&&($({t:"sig",ts:e,d:{s:"loop_nav",pages:r}}),kt=[{path:t,ts:e}])})(n),$({t:"pv",ts:Date.now(),d:{ref:""}})}))}function Ge(t,e){if(!Ze)return;if("string"!=typeof t||!t||t.length>128)return;let n;try{n=JSON.stringify(e?.metadata??{})}catch{return}if(n.length>2048)return;const o=JSON.parse(n);$({t:"sig",ts:Date.now(),d:{s:t.slice(0,128),el:"string"==typeof e?.element?e.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(e?.weight??15,100))}})}function Ke(t,e={}){if(!Ze)return;if("string"!=typeof t||!/^[a-z0-9_.-]{1,120}$/i.test(t))return;let n;try{n=JSON.stringify(e??{})}catch{return}n.length>2048||$({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function Qe(t){if(!Ze)return;if(!t||"object"!=typeof t)return;const e=Object.create(null);let n=0;for(const o of Object.keys(t)){if(n>=20)break;"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&(e[o.slice(0,64)]=String(t[o]).slice(0,256),n++)}U({segment:e})}function We(t){t&&Ve&&!Ze?Ye(Ve):t||(en(),r())}function tn(){en(),r()}function en(){Ze&&(document.removeEventListener("click",H,{capture:!0,passive:!0}),q=[],document.removeEventListener("mousedown",W,{capture:!0}),document.removeEventListener("click",tt,{capture:!0}),Q=null,document.removeEventListener("click",at,{capture:!0}),ct(),document.removeEventListener("mousemove",_t),vt&&clearTimeout(vt),Mt(),kt=[],window.removeEventListener("scroll",jt),xt=[],document.removeEventListener("focusin",It,{capture:!0}),document.removeEventListener("focusout",Ft,{capture:!0}),document.removeEventListener("submit",Jt,{capture:!0}),window.removeEventListener("pagehide",qt),Pt&&(document.removeEventListener("visibilitychange",Pt),Pt=null),Nt.clear(),Rt.clear(),Lt=null,window.removeEventListener("error",Gt),window.removeEventListener("unhandledrejection",Kt),Ht&&Vt&&window.fetch===Vt&&(window.fetch=Ht),Ht=null,Vt=null,document.removeEventListener("touchstart",ue),document.removeEventListener("touchend",le),document.removeEventListener("gesturechange",de),window.removeEventListener("orientationchange",fe),window.visualViewport?.removeEventListener("resize",pe),document.removeEventListener("keydown",be,{capture:!0}),he=[],ge=[],me=null,window.removeEventListener("scroll",De),ve=0,_e=0,Me=null,ke=0,Te=!1,window.removeEventListener("scroll",Ee),window.removeEventListener("pagehide",Se),Oe&&(document.removeEventListener("visibilitychange",Oe),Oe=null),Ae=0,xe=!1,Be&&(Be=!1,document.removeEventListener("mouseenter",Ie,!0),document.removeEventListener("mouseleave",Ie,!0),document.removeEventListener("click",Je,{capture:!0}),document.removeEventListener("keydown",Je,{capture:!0}),document.removeEventListener("scroll",Je),window.removeEventListener("resize",Fe),Xe(),je="",Ue=0,Le=0,Re=0),j(),document.removeEventListener("visibilitychange",S),window.removeEventListener("pagehide",O),g&&(clearTimeout(g),g=null),He&&(He(),He=null),Ze=!1)}function nn(t){if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}}(()=>{try{const t=window;if(t.flusterduck)return;const e=document.currentScript;if(!e)return;const n=e.getAttribute("data-key");if(!n)return;const o={key:n,environment:e.getAttribute("data-env")||void 0,endpoint:nn(e.getAttribute("data-endpoint")),debug:"true"===e.getAttribute("data-debug"),cookieless:"true"===e.getAttribute("data-cookieless"),respectDoNotTrack:"false"!==e.getAttribute("data-dnt")},r=e.getAttribute("data-dom-mode");"metadata"!==r&&"snapshot"!==r||(o.domMode=r),"off"===e.getAttribute("data-compression")&&(o.compression="off");const i=e.getAttribute("data-sample");if(i){const t=parseFloat(i);isNaN(t)||(o.sampleRate=Math.max(0,Math.min(t,1)))}const s=e.getAttribute("data-segment");if(s&&s.length<2048)try{const t=JSON.parse(s);if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.create(null);for(const n of Object.keys(t))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=String(t[n]));o.segment=e}}catch{}Ye(o),t.flusterduck=Object.freeze({init:Ye,signal:Ge,track:Ke,identify:Qe,setConsent:We,optOut:tn,destroy:en})}catch{}})()})();
1
+ "use strict";(()=>{function t(t){return(...e)=>{try{return t(...e)}catch{}}}function e(t){return e=>{try{t(e)}catch{}}}var n="_fd_s",o=/^[0-9a-f]{32}$/;function r(){c(n,"",-1)}function i(){const t=new Uint8Array(16);crypto.getRandomValues(t);let e="";for(const n of t)e+=n.toString(16).padStart(2,"0");return e}function c(t,e,n){const o=new Date;o.setTime(o.getTime()+864e5*n);const r="https:"===location.protocol?";Secure":"";document.cookie=`${t}=${encodeURIComponent(e)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var s=/^[:\d]|--|^(ember|react|ng-|__)/;function a(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!s.test(t.id)&&t.id.length<64)return"#"+u(t.id);const n=[];let o=t,r=0;for(;o&&o!==document.body&&r<5;){let t=o.tagName.toLowerCase();const e=o.getAttribute("name"),i=o.getAttribute("role"),c=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!c||"input"!==t&&"button"!==t||(t+=`[type="${u(c)}"]`);const s=o.parentElement;if(s){const e=s.children;let n=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];i&&i.tagName===o.tagName&&(n++,i===o&&(r=n))}n>1&&(t+=`:nth-of-type(${r})`)}n.unshift(t);const a=n.join(" > ");try{if(1===document.querySelectorAll(a).length)return a}catch(t){}o=s,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}var l=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,d=/^(INPUT|TEXTAREA|SELECT)$/;function f(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!d.test(t.tagName)){const e=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,60);if(e&&!l.test(e))return e}const n=t.getAttribute("placeholder");if(n)return n.trim().slice(0,60);const o=t.getAttribute("title");if(o)return o.trim().slice(0,60);const r=t.getAttribute("alt");return r?r.trim().slice(0,60):""}catch{return""}}function p(t,e){if(t.hasAttribute("data-fd-ignore"))return!0;if(t.closest("[data-fd-ignore]"))return!0;for(const n of e)try{if(t.matches(n)||t.closest(n))return!0}catch(t){}return!1}function h(t,e){return t&&e.includes(t)?t:null}function m(t){const e=t.tagName.toLowerCase();if("input"!==e&&"button"!==e)return null;const n=t.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function w(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function _(t){if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!/^(button|link|tab|menuitem|checkbox|radio)$/.test(e))}var v=6e4,g="application/json",b=[],y=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1;function O(t){E=t}function $(t){S=t}var U=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),N=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),R=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),C=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,L=e(()=>{"hidden"===document.visibilityState&&B()}),j=t(()=>B());function I(t){S||b.length>=100||(b.push(t),b.length>=T?B():y||(y=setTimeout(B,k)))}function B(){(async()=>{if(A)return;if(!b.length||!D)return;A=!0,y&&(clearTimeout(y),y=null);const t=b;b=[];const e={v:1,sid:D.sid,key:D.key,url:D.url,page:D.page,ts:Date.now(),ua:D.ua,vw:D.vw,vh:D.vh,environment:D.environment,...D.segment?{segment:D.segment}:{},dom_mode:x.domMode},n=t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":N.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},c=F(o.el,o.element,o.target);if("signal"===r){i.signal_type=F(o.s,o.signal_type,o.name)?.slice(0,128),c&&(i.element=c.slice(0,2048));const t=c?((t,e)=>{if("off"===e)return null;try{const n=document.querySelector(t);return n?((t,e)=>{if("off"===e)return null;if("metadata"===e)return(t=>({mode:"metadata",selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),attributes:{disabled:!0===t.disabled,required:!0===t.required,ariaDisabled:"true"===t.getAttribute("aria-disabled"),ariaExpanded:h(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:h(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:m(t)}}))(t);const n=(t=>{try{const e=t.getBoundingClientRect(),n=getComputedStyle(t),o=t.parentElement,r=[];if(o)for(let e=0;e<o.children.length&&r.length<6;e++){const n=o.children[e];if(!n||n===t)continue;const i=n.getBoundingClientRect();r.push({selector:a(n),tag:n.tagName.toLowerCase(),box:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)},interactive:_(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?a(o):"",box:{x:Math.round(e.x),y:Math.round(e.y),w:Math.round(e.width),h:Math.round(e.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:!0===t.disabled},inView:w(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(c,n):null;t&&(i.dom=t),i.signal_type&&E&&E(i.signal_type)}const s=(t=>{const e=Object.create(null);for(const n of Object.keys(t)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;const o=X(t[n],n);void 0!==o&&(e[n.slice(0,64)]=o)}if(t.meta&&"object"==typeof t.meta&&!Array.isArray(t.meta)){const n=X(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(s).length&&(i.metadata=s),i})(t,D.page,x.domMode));let o=[];try{for(const t of n){const n=[...o,t];if(JSON.stringify({...e,events:n}).length>v)if(o.length>0)await z({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=v&&await z(n),o=[]}else o=n}o.length>0&&await z({...e,events:o})}catch{}finally{A=!1}})()}function P(t){if(D)for(const e of Object.keys(t))U.has(e)&&(D[e]=t[e])}async function z(t){const e=JSON.stringify(t),n=await(async(t,e)=>{const n=(new TextEncoder).encode(t);if(n.byteLength>v)return null;if("off"!==e){const e=await(async t=>{const e=globalThis.CompressionStream;if("function"!=typeof e)return null;try{const n=(t=>{const e=(new TextEncoder).encode(t),n=new Blob([e],{type:g});if("function"==typeof n.stream)return n.stream();const o=globalThis.ReadableStream;return"function"!=typeof o?null:new o({start(t){t.enqueue(e),t.close()}})})(t);if(!n)return null;const o=new e("gzip"),r=n.pipeThrough(o).getReader(),i=[];let c=0;for(;;){const t=await r.read();if(t.done)break;if(c+=t.value.byteLength,c>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const s=new Uint8Array(c);let a=0;for(const t of i)s.set(t,a),a+=t.byteLength;return s.buffer}catch{return null}})(t);if(e&&e.byteLength<=v)return{beaconBody:new Blob([e],{type:"application/json; encoding=gzip"}),fetchBody:new Uint8Array(e),headers:{"Content-Type":g,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:g}),fetchBody:t,headers:{"Content-Type":g}}})(e,x.compression);n&&q(n,0)}function q(t,e,n=M){if(n){if(navigator.sendBeacon&&navigator.sendBeacon(n,t.beaconBody))return;try{fetch(n,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>q(t,e+1,n),1e3*(e+1))})}catch{}}}function X(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>R.has(t)))(e))){if(null===t||"boolean"==typeof t)return t;if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t){if(C.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>X(t,e,n+1)).filter(t=>void 0!==t);if("object"==typeof t){const e=Object.create(null);for(const o of Object.keys(t).slice(0,40)){if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=X(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function F(...t){for(const e of t)if("string"==typeof e&&e)return e}function J(t){return"off"===t?"off":"auto"}function Z(t,e){for(const n of e){const e=V(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id"))(t)}var H=/^[a-zA-Z0-9/:._*\-]+$/;function V(t){if(t.length>200)return null;if(!H.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var W=[".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"]'],Y=[],G=3,K=2e3,Q=[],tt=[],et=0,nt=new Map,ot=new Map,rt=!1,it=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Q))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||(!!t.hasAttribute("ondblclick")||(!!t.hasAttribute("data-dbl")||"spinbutton"===t.getAttribute("role")))})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;Y.length&&n-Y[0].t>K;)Y.shift();Y.push({t:n,x:o,y:r});const i=tt.length>=3?2:G;if(Y.length<i)return;const c=Y.slice(-i);for(let t=0;t<c.length-1;t++)for(let e=t+1;e<c.length;e++){const n=c[t],o=c[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>64)return}const s=(c[c.length-1].t-c[0].t)/1e3,u=s>0?c.length/s:c.length,l=Math.round(100*Math.min(1,(c.length-i)/i+u/10))/100,d=((t,e,n)=>{const o=Math.min(4,(t.length-e)/5*4),r=Math.min(4,n/10*4);let i=2;if(t.length>=2){let e=0,n=0;for(let o=0;o<t.length-1;o++)for(let r=o+1;r<t.length;r++){const i=t[o],c=t[r],s=c.x-i.x,a=c.y-i.y;e+=Math.sqrt(s*s+a*a),n++}i=Math.max(0,2-e/n/8*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(c,i,u),h=a(e),m=f(e);tt.push({selector:h,ts:n});const w=tt.length,_=(t=>{const e=(t-et)/6e4;return e<=0?0:Math.round(tt.length/e*10)/10})(n),v=nt.get(h)??0,g=v+1,b=ot.get(h)??0,y=b>0&&n-b<1e4;nt.set(h,g),ot.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=c.reduce((t,e)=>t+e.x,0)/c.length,o=c.reduce((t,e)=>t+e.y,0)/c.length,r=t.top+t.height/2;return{click_dx:Math.round(n-(t.left+t.width/2)),click_dy:Math.round(o-r),el_w:Math.round(t.width),el_h:Math.round(t.height)}}catch{return null}})();I({t:"sig",ts:n,d:{s:"rage_click",el:h,...m?{el_label:m}:{},cnt:c.length,vel:Math.round(10*u)/10,intensity:l,quality:d,burst_seq:w,burst_rate_per_min:_,repeated_target:M,hot_repeat:y,...k??{}}}),M&&I({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...m?{el_label:m}:{},total_hits:g,burst_count:g,burst_seq:w}}),Y=Y.slice(-(i-1))}),ct=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,st=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,at=/^(A|BUTTON|LABEL)$/,ut=[],lt=null,dt=new Map,ft=e(t=>{lt={x:t.clientX,y:t.clientY}}),pt=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,ut))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!lt)return!1;const e=t.clientX-lt.x,n=t.clientY-lt.y;return Math.sqrt(e*e+n*n)>5})(t);if(lt=null,n)return;if((t=>{if(ct.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&st.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!at.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const o=((t,e,n)=>{let o=t;for(let r=0;r<5&&o;r++){const r=o.parentElement;if(!r)break;const i=r.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let c=null,s=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=mt(e,n,r);a<s&&(s=a,c=r)}if(c&&s<100)return c;o=r}return null})(e,t.clientX,t.clientY),r=o?ht(t.clientX,t.clientY,o):null,i=a(e),c=(dt.get(i)??0)+1;dt.set(i,c);const s=c>=2,u=(t=>{try{return window.getComputedStyle(t).cursor.slice(0,20)}catch{return""}})(e),l=(t=>{try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e),d=f(e),h=o?f(o):"";I({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...d?{el_label:d}:{},near:o?a(o):"",...h?{near_label:h}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:u,...l?{looks_interactive:!0}:{},...s?{repeated:!0,repeat_cnt:c}:{}}})});function ht(t,e,n){const o=n.getBoundingClientRect(),r=t-Math.max(o.left,Math.min(t,o.right)),i=e-Math.max(o.top,Math.min(e,o.bottom));return{dist:Math.sqrt(r*r+i*i),dx:r,dy:i}}function mt(t,e,n){return ht(t,e,n).dist}var wt=null,_t=3e3,vt=[],gt="click",bt=0,yt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Mt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,kt=e(t=>{const e=t.target;if(!e)return;if(p(e,vt))return;const n=e.getAttribute("role");if(!(yt.test(e.tagName)||n&&Mt.test(n)))return;const o=Date.now();if(o-bt>50&&(gt="click",bt=o),wt){if(wt.el===e||wt.el.contains(e)){const t=o-wt.ts;return t>=_t&&I({t:"sig",ts:o,d:{s:"speed_frustration",el:wt.selector,delay:t,interaction_type:gt,observed_delay_ms:t}}),void xt()}xt()}const r=a(e);let i=!1;const c=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void xt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void xt()}}),s=e.parentElement||document.body;c.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&wt&&(wt.observer.disconnect(),wt={...wt,timeout:null})},_t+500);wt={el:e,selector:r,ts:o,observer:c,timeout:u}}),Tt=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(gt="keydown",bt=Date.now()))}),Dt=e(()=>{gt="touch",bt=Date.now()});function xt(){wt&&(wt.observer.disconnect(),wt.timeout&&clearTimeout(wt.timeout),wt=null)}var At=800,Et=2e3,St=0,Ot=0,$t=0,Ut=0,Nt=0,Rt=0,Ct=0,Lt=0,jt=[],It=0,Bt=null,Pt=e(t=>{const e=Date.now();e-St<16||(St=e,Bt&&clearTimeout(Bt),Bt=setTimeout(()=>zt(),150),((t,e,n)=>{if(0===Ut)return Ot=t,$t=e,Ut=n,void(Lt=n);const o=(n-Ut)/1e3;if(0===o)return;const r=t-Ot,i=e-$t;if(Math.abs(r)<2&&Math.abs(i)<2)return;const c=Math.sqrt(r*r+i*i),s=c/o;jt.length>=100&&(jt=jt.slice(-50)),jt.push(s),It+=c;const a=Math.sign(r),u=Math.sign(i);if(c>=5&&(0!==Nt&&0!==a&&a!==Nt||0!==Rt&&0!==u&&u!==Rt)&&Ct++,Nt=a||Nt,Rt=u||Rt,Ot=t,$t=e,Ut=n,n-Lt>Et){if(Ct>=3){const t=jt.reduce((t,e)=>t+e,0)/jt.length;t>=At&&I({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Ct,distance_px:Math.round(It)}})}zt(),Lt=n}})(t.clientX,t.clientY,e))});function zt(){Ct=0,jt=[],It=0,Nt=0,Rt=0,Ut=0,Ot=0,$t=0,St=0,Bt=null}var qt=[],Xt=[],Ft=3e4,Jt=1e4,Zt=.5,Ht=[],Vt=0,Wt=0,Yt=!1,Gt=0,Kt=e(()=>{Yt||(Yt=!0,requestAnimationFrame(()=>{Yt=!1,(()=>{const t=Date.now(),e=window.scrollY;if((Gt=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/Gt,o=e>Vt?"down":"up";if(t-Wt<100)return void(Vt=e);for(;Ht.length&&t-Ht[0].ts>Jt;)Ht.shift();Ht.length>=100&&(Ht=Ht.slice(-50)),Ht.push({depth:n,ts:t,direction:o}),Vt=e,Wt=t;let r=0,i=1,c=0,s=!1,a=0,u=0,l=0,d=1,f=0;for(let t=1;t<Ht.length;t++)Ht[t].direction!==Ht[t-1].direction&&f++;for(let t=0;t<Ht.length;t++){const e=Ht[t],n=e.depth;if(n>r&&(r=n),n>=Zt&&(s||(a=e.ts,l=n),s=!0),s&&n<i&&(i=n,u=e.ts,d=n),s&&i<.25&&n>=Zt){if(u-a<200){s=!1,i=1,a=e.ts,l=n;continue}c++,s=!1,i=1}}if(c>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-d),o=Math.round(n/e*1e3);I({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:c+1,vel:o,dir_changes:f}}),Ht=[]}})()}))}),Qt=["textarea",'[role="textbox"]',"[contenteditable]"],te=new Map,ee=new Map,ne=new Set,oe=null,re=0,ie=5e3,ce=[],se=e(t=>{const e=t.target;if(!e||!pe(e))return;if(p(e,ce))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of Qt)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();te.set(e,n),ee.set(e,n);const o=e.closest("form");o&&o!==oe&&(oe=o,re=o.querySelectorAll("input, select, textarea").length)}),ae=e(t=>{const e=t.target;if(!e||!pe(e))return;const n=te.get(e),o=ee.get(e);te.delete(e),ee.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=ie){const n=f(e);I({t:"sig",ts:r,d:{s:"form_hesitation",el:a(e),...n?{el_label:n}:{},pause:t}})}}const i=e.getAttribute("name")||e.getAttribute("id")||a(e);(t=>"value"in t&&t.value.length>0)(e)&&ne.add(i)}),ue=e(()=>{ne.clear(),oe=null}),le=t(fe),de=null;function fe(){if(ne.size>0&&oe){const t=re||ne.size,e=Math.round(ne.size/t*100)/100;I({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:ne.size,total:t,field_count:t,completion_rate:e}}),ne.clear(),oe=null}}function pe(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var he=null,me=null,we=/flusterduck\.com|\/v1\/ingest/,_e=e(t=>{const e=t.message||"Unknown error";var n;I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Me(e,200),ep:"",status:0,error_category:(n=e,ge.test(n)?"network":"script"),url:location.pathname}})}),ve=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Me(e,200),ep:"",status:0,error_category:be(t.reason),url:location.pathname}})}),ge=/fetch|network|cors|timeout/i;function be(t){if(t instanceof TypeError&&ge.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return ge.test(e)?"network":"unhandled_promise"}function ye(t){try{return new URL(t,location.origin).pathname}catch{const e=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(e>=0?e:t.length,n>=0?n:t.length);return t.slice(0,o)||"/"}}function Me(t,e){let n=t.length>e?t.slice(0,e):t;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,t=>{try{return new URL(t).origin+new URL(t).pathname}catch{return"[URL]"}}),n}var ke=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Te=['[class*="map"]',"canvas",".gallery","[data-zoom]"],De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,Re=[],Ce=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(De={x:e.clientX,y:e.clientY,ts:Date.now()},xe=0):2===t.touches.length&&(xe=Pe(t.touches),De=null)}),Le=e(t=>{if(xe>0){const e=t.touches.length>=2?Pe(t.touches):(()=>{const e=t.changedTouches[0],n=t.changedTouches[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)})();e>0&&(Ae=Math.round(e/xe*100)/100),xe=0}if(!De)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-De.x,o=e.clientY-De.y,r=Date.now()-De.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(p(t,Re))return;const o=((t,e,n)=>{const o=(t.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])');let r=null,i=21;for(let t=0;t<o.length;t++){const c=o[t];if(!c)continue;const s=c.getBoundingClientRect(),a=Math.max(s.left,Math.min(e,s.right)),u=Math.max(s.top,Math.min(n,s.bottom)),l=Math.sqrt((e-a)**2+(n-u)**2);l<i&&l>0&&(i=l,r=c)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),c=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((e-i)**2+(n-c)**2);if(s>0&&s<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;I({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(s),size:t}})}})(i,e.clientX,e.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&((t,e,n)=>{if(Math.abs(n)>Math.abs(e))return;if(!t)return;if(ke.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!ke.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";I({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),De=null}),je=e(()=>{const t=Date.now();if(t-Se>3e4&&(Ee=0,Se=t),++Ee>=2){const e=document.activeElement||document.body;!Te.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Oe>200&&(Oe=t,I({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:Ae}})),Ee=0,Ae=1}}),Ie=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ue>3e4&&($e=0,Ue=t),e!==Ne&&($e++,Ne=e),$e>=3&&(I({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:$e,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),$e=0)}),Be=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Se>3e4&&(Ee=0,Se=e),++Ee>=2&&e-Oe>200){const n=Math.round(100*t.scale)/100;Oe=e,I({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:n}}),Ee=0,Ae=1}}});function Pe(t){const e=t[0],n=t[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)}var ze=[],qe=null,Xe=0,Fe=0,Je="",Ze=[],He=[],Ve=e(t=>{const e=Date.now(),n=t.target;n&&p(n,He)||("Tab"===t.key?((t,e,n)=>{for(;ze.length&&t-ze[0].ts>5e3;)ze.shift();ze.length>=50&&(ze=ze.slice(-25));const o=e?a(e):"";if(ze.push({ts:t,el:o,shift:n}),ze.length>=10){const e=ze.map(t=>t.el).filter(Boolean),n=(t=>{let e=0;for(let n=1;n<t.length;n++)t[n].shift!==t[n-1].shift&&e++;return e})(ze);I({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ze.length,els:e,direction_changes:n}}),ze=[]}if(!e)return;const r=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(r){const n=a(e);r===qe?t-Fe<=3e3?(Xe++,Je=n,Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=null)):(Fe=t,Xe=1,Je=n):(qe=r,Fe=t,Xe=1,Je=n)}})(e,n,t.shiftKey):"Escape"===t.key?((t,e)=>{if(!e)return;const n=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(n&&n===qe){if(t-Fe>3e3)return Fe=t,Xe=1,void(Je=a(e));Xe++,Je=a(e),Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=null)}})(e,t.target):"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||((t,e)=>{if(!e)return;const n=e.closest('[role="listbox"]')||e.closest('[role="menu"]')||e.closest('[role="tree"]')||e.closest("select");if(!n)return;for(;Ze.length&&t-Ze[0].ts>5e3;)Ze.shift();Ze.length>=50&&(Ze=Ze.slice(-25)),Ze.push({ts:t,container:n});const o=Ze.filter(t=>t.container===n);o.length>=15&&(I({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),Ze=[])})(e,t.target))}),We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0,rn=e(()=>{Qe||(Qe=!0,requestAnimationFrame(()=>{Qe=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-Ye;if(Math.abs(n)<2)return void(Ye=e);const o=n>0?"down":"up";Ge&&o!==Ge&&(t-Ke>3e3&&(We=0,Ke=t),++We>=4)&&Math.abs(n)>100&&(t-en>1e4&&(tn=0,en=t),tn++,I({t:"sig",ts:t,d:{s:"scroll_hijack",rev:We,source:null!==nn&&t-on<=2e3?nn:"wheel",repeated:tn>=2}}),We=0),Ge=o,Ye=e})()}))}),cn=e(()=>{nn="wheel",on=Date.now()}),sn=e(()=>{nn="touch",on=Date.now()});function an(){We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0}var un=0,ln=0,dn=!1,fn=e(()=>{dn||(dn=!0,requestAnimationFrame(()=>{dn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>un&&(un=e,0===ln&&(ln=Date.now()))}}))}),pn=null,hn=null;function mn(){if(un>.05){const t=Date.now(),e=ln>0?Math.max(0,t-ln):0;I({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*un)/100,max_depth:Math.round(100*un),dwell_ms:e}})}}var wn="",_n=0,vn=0,gn=0,bn=0,yn=0,Mn=null,kn=0,Tn=!1,Dn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==wn||o-vn>1500)&&(wn=n,vn=o,_n=0),(_n+=1)<4||(I({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:_n,window_ms:1500}}),_n=0,vn=o)}),xn=e(()=>{const t=Date.now(),e=Sn(),n=yn||e,o=Math.abs(e-n)/Math.max(n,1);yn=e,o<.15||((!gn||t-gn>5e3)&&(gn=t,bn=0),(bn+=1)<3||(I({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:bn,area_delta:Math.round(1e3*o)/1e3}}),bn=0,gn=t))}),An=e(()=>{En()});function En(){On();const t=kn+=1;Mn=setTimeout(()=>{I({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function Sn(){return Math.max(1,window.innerWidth*window.innerHeight)}function On(){Mn&&(clearTimeout(Mn),Mn=null)}var $n=["[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"]'],Un=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,Nn=[],Rn=[],Cn=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rn))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(Ln(e))return!0;if(jn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;Nn.length&&n-Nn[0].t>6e4;)Nn.shift();const o=a(e);if(Nn.push({t:n,el:o}),Nn.length<3)return;const r=new Set(Nn.map(t=>t.el)).size,i=f(e);I({t:"sig",ts:n,d:{s:"help_hunt",cnt:Nn.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),Nn=[]});function Ln(t){for(const e of $n)try{if(t.matches(e))return!0}catch{}return!1}function jn(t){const e=t.id??"",n=t.className??"";return Un.test("string"==typeof n?`${e} ${n}`:e)}var In=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Bn=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Pn=[],zn=new Map,qn=[],Xn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,qn))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(Fn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=f(e);Pn.push({t:n,el:o});const i=(zn.get(o)??0)+1;zn.set(o,i);const c=Pn.length,s=(()=>{try{const n=e.getBoundingClientRect();return 0===n.width&&0===n.height?null:{click_dx:Math.round(t.clientX-(n.left+n.width/2)),click_dy:Math.round(t.clientY-(n.top+n.height/2)),el_w:Math.round(n.width),el_h:Math.round(n.height)}}catch{return null}})();I({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:c,element_cnt:i,repeated:i>1,container:Jn(e),...s??{}}})});function Fn(t){const e=t.getAttribute("data-dismiss")??"",n=t.getAttribute("data-close")??"";if(e||n)return!0;const o=t.getAttribute("aria-label")??t.getAttribute("title")??"";if(o&&Bn.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(In.test(t.id??"")||In.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&Bn.test(i))return!0;if("BUTTON"===t.tagName&&t.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){const e=(t.textContent??"").trim();if("×"===e||"✕"===e||"✗"===e||"X"===e||"x"===e)return!0}return!1}function Jn(t){const e=[['[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(const[n,o]of e)try{if(t.closest(n))return o}catch{}return"unknown"}var Zn=null,Hn=[],Vn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,Hn)||(Zn=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:f(e),t:Date.now()}))}),Wn=e(t=>{"Escape"===t.key&&Gn("escape")}),Yn=e(()=>{Gn("back_nav")});function Gn(t){if(!Zn)return;const e=Date.now()-Zn.t;e>1500||I({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Zn.el,...Zn.label?{el_label:Zn.label}:{},elapsed_ms:e}}),Zn=null}var Kn=/^(checkbox|radio)$/,Qn=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,to=new Map,eo=[],no=e(t=>{const e=t.target;e&&(p(e,eo)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Kn.test(t.type??""):Qn.test(t.getAttribute("role")??"")))(e)&&ro(e))}),oo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,eo))return;const n=e.getAttribute("role")??"";Qn.test(n)&&"INPUT"!==e.tagName&&ro(e)});function ro(t){const e=a(t),n=Date.now();let o=to.get(e);for(o||(o=[],to.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=f(t);I({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),to.delete(e)}var io=[],co=e(t=>{const e=t.target;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t)return;if(e.isContentEditable)return}const n=window.getSelection();if(!n||n.toString().length<2)return;const o=Date.now();for(;io.length&&o-io[0].t>15e3;)io.shift();io.push({t:o}),io.length<3||(I({t:"sig",ts:o,d:{s:"copy_frustration",cnt:io.length,window_ms:15e3}}),io=[])}),so=[],ao=0,uo=null,lo=null;function fo(){ao=Date.now(),so=[]}function po(){const t=window.getSelection();if(!t||t.isCollapsed)return;if(t.toString().length<5)return;const e=t.anchorNode?.parentElement;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)return}const n=Date.now();if(n-ao<2e3)return;for(;so.length&&n-so[0].t>15e3;)so.shift();const o=so[so.length-1];o&&n-o.t<500||(so.push({t:n}),so.length<4||(I({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:so.length,window_ms:15e3}}),so=[]))}var ho=6e4,mo="_fd_sess",wo={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},_o={low:1,medium:2,high:3,critical:4},vo=[],go=null,bo=!1,yo=new Map,Mo={totalSignals:0,pagesWithFrustration:0},ko="",To=null,Do=null,xo=null,Ao=null;function Eo(t){bo&&So(t,Date.now())}function So(t,e){yo.has(t)||yo.set(t,[]);const n=yo.get(t);n.push(e),n.length>20&&n.shift()}function Oo(t){let e="",n=0;for(const[o,r]of t)(r>n||r===n&&o<e)&&(e=o,n=r);return{type:e,count:n}}function $o(t){if(!bo)return;if("frustration_burst"===t)return;const e=Date.now();(t=>{const e=t-ho;let n=0;for(;n<vo.length&&vo[n].ts<e;)n++;n>0&&(vo=vo.slice(n))})(e),0===vo.length&&(go=null),vo.push({type:t,ts:e}),So(t,e);const{distinctTypes:n,totalWeight:o,typeCounts:r}=(()=>{const t=new Map;let e=0;for(const n of vo)t.set(n.type,(t.get(n.type)??0)+1),e+=wo[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),i=((t,e,n)=>Oo(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(n.size,o,r);i&&(null!==go&&_o[i]<=_o[go]||(go=i,((t,e,n,o)=>{const r=Oo(o),i=(()=>{const t=[],e=Date.now()-ho,n=[];for(const[t,o]of yo.entries())for(const r of o)r>=e&&n.push({type:t,ts:r});n.sort((t,e)=>t.ts-e.ts);for(let e=0;e<n.length;e++)if("rage_click"===n[e].type)for(let o=e+1;o<n.length;o++)if("form_validation_loop"===n[o].type&&n[o].ts-n[e].ts<=3e4){t.push("rage_then_form_loop");break}for(let e=0;e<n.length;e++)if("dead_click"===n[e].type)for(let o=e+1;o<n.length;o++){const r=n[o].type;if(("popstate"===r||"hashchange"===r)&&n[o].ts-n[e].ts<=1e4){t.push("dead_then_bail");break}}for(let e=0;e<n.length;e++)if("form_validation_loop"===n[e].type)for(let o=e+1;o<n.length;o++)if(("visibilitychange"===n[o].type||"pagehide"===n[o].type)&&n[o].ts-n[e].ts<=2e4){t.push("form_loop_then_abandon");break}return t})();I({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:ko||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:Mo.totalSignals,session_pages_with_frustration:Mo.pagesWithFrustration}}),Mo.totalSignals+=vo.length,Mo.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(mo,JSON.stringify(Mo))}catch{}})()})(i,n,o,r)))}var Uo=3e4,No=[],Ro="",Co=!1,Lo=e(()=>{Io(location.pathname+location.search+location.hash)}),jo=e(()=>{Io(location.pathname+location.search+location.hash)});function Io(t){const e=Date.now();if(Ro&&Ro!==t){const t=No[No.length-1];t&&t.path===Ro&&null===t.leftAt&&(t.leftAt=e)}for(;No.length&&e-No[0].ts>Uo;)No.shift();t!==Ro&&(No.push({path:t,ts:e,leftAt:null}),Ro=t),No.length<5||Co||(t=>{const e=No.filter(e=>t-e.ts<=Uo),n=e.filter(t=>null!==t.leftAt),o=new Set(e.map(t=>t.path));if(o.size<5)return;if(0===n.length)return;if(n.some(t=>t.leftAt-t.ts>=5e3))return;if(new Set(n.map(t=>t.path)).size<5)return;const r=n.map(t=>t.leftAt-t.ts),i=Math.round(r.reduce((t,e)=>t+e,0)/r.length),c=Math.max(...r),s=e.map(t=>t.path).slice(-8);Co=!0,I({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:Uo,avg_dwell_ms:i,pages:s,max_dwell_ms:c}})})(e)}var Bo=[],Po=!1,zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Zo=e(()=>{Po||(Po=!0,requestAnimationFrame(Wo))}),Ho=e(t=>{if(!Jo)return;const e=Date.now();if(e-Fo>3e3)return void(Jo=!1);if(window.scrollY+t.clientY>Xo+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(qo-Xo),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,c=i?a(i):"",s=i?f(i):"";Jo=!1,qo=window.scrollY,zo="none",Bo=[],I({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:c,...s?{click_el_label:s}:{},scroll_back_pct:r}})});function Vo(){Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1}function Wo(){Po=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Bo[Bo.length-1];if(o&&t-o.ts<50)return;if(Bo.push({y:e,ts:t}),Bo.length>60&&(Bo=Bo.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==zo&&Jo&&(Jo=!1),e>qo&&(qo=e),void(zo="down");Jo&&t-Fo>3e3&&(Jo=!1),"down"===zo&&qo-e>=.3*n&&!Jo&&(Xo=e,Fo=t,Jo=!0),zo="up"}}var Yo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Go=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ko=/^(A|BUTTON|LABEL)$/,Qo=new Map,tr=[],er=null,nr=e(t=>{er={x:t.clientX,y:t.clientY}}),or=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,tr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!er)return!1;const e=t.clientX-er.x,n=t.clientY-er.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Yo.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Go.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!Ko.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const{row:n,col:o}=((t,e)=>{const n=Math.min(3,Math.floor(t/window.innerWidth*4));return{row:Math.min(3,Math.floor(e/window.innerHeight*4)),col:n}})(t.clientX,t.clientY),r=((t,e)=>4*t+e)(n,o),i=Date.now(),c=a(e),s=(Qo.get(r)??[]).filter(t=>i-t.ts<9e4);if(s.push({ts:i,selector:c}),Qo.set(r,s),s.length>=3){const t=new Map;for(const e of s)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",c=0;for(const[n,o]of t)o>c&&(c=o,e=n);const a=new Set,u=[];for(const t of s)if(!a.has(t.selector)&&(a.add(t.selector),u.push(t.selector),u.length>=5))break;const l=(()=>{try{const t=e?document.querySelector(e):null;return t?f(t):""}catch{return""}})();I({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:s.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Qo.set(r,[])}}),rr=12e4,ir=new Map,cr=[],sr=null,ar=e(t=>{const e=t.target;e&&mr(e)}),ur=e(t=>{const e=t.target;if(!e||!fr(e))return;if(p(e,cr))return;const n=a(e);ir.has(n)||dr(e)&&hr(e,n)});function lr(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function dr(t){const e=t.getAttribute("aria-invalid");if("true"===e||""===e)return!0;if("validity"in t&&t.validity&&!t.validity.valid)return!0;try{return t.matches(":invalid")}catch{return!1}}function fr(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function pr(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function hr(t,n){const o=(t=>e(e=>{_r(t)}))(n),r=(t=>e(e=>{_r(t)}))(n);t.addEventListener("input",o,{passive:!0}),t.addEventListener("change",r,{passive:!0});const i={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:o,changeHandler:r,el:t};return ir.set(n,i),i}function mr(t){if(!fr(t))return;if(p(t,cr))return;const e=Date.now();(t=>{for(const[e,n]of ir)t-n.lastTs>rr&&(pr(n),ir.delete(e))})(e);const n=a(t),o=ir.get(n);if(!o)return void hr(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n)))}function wr(t){if(!fr(t))return;const e=Date.now(),n=a(t),o=ir.get(n);return o?e-o.lastTs>rr?(pr(o),void ir.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function _r(t){const e=Date.now(),n=ir.get(t);if(n){if(e-n.lastTs>rr)return pr(n),void ir.delete(t);if(n.lastTs=e,dr(n.el))return n.cycles+=1,void(n.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...f(n.el)?{el_label:f(n.el)}:{},cycles:n.cycles,window_ms:rr,field_type:lr(n.el)}}),pr(n),ir.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function vr(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!fr(t))continue;if(p(t,cr))continue;const n=e.oldValue,o="true"===n||""===n,r=dr(t);r&&!o?mr(t):!r&&o&&wr(t)}}var gr=null,br=null,yr=[],Mr=0,kr=new Map;function Tr(){for(const t of yr)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}function Dr(t){kr.has(t)||(kr.set(t,{firstSeenTs:0,emitted:!1}),gr.observe(t))}function xr(t){for(const e of t)for(let t=0;t<e.addedNodes.length;t++){const n=e.addedNodes[t];if(n instanceof Element)for(const t of yr)try{n.matches(t)&&Dr(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}}function Ar(t){const e=Date.now();for(const n of t){const t=kr.get(n.target);if(t&&!t.emitted&&n.isIntersecting&&n.intersectionRatio>=.5){t.firstSeenTs||(t.firstSeenTs=e),t.emitted=!0;const o=n.boundingClientRect,r=n.rootBounds?.height??window.innerHeight,i=o.top<.5*r?"above_fold":"below_fold",c=a(n.target),s=f(n.target);I({t:"sig",ts:e,d:{s:"element_impression",el:c,...s?{el_label:s}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-Mr),viewport_position:i}})}}}var Er=new Map,Sr=[],Or=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,Sr))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Er.get(r);if(i){if(n-i.lastTs>6e4)return i.lastValue=o,i.cycles=0,i.phase="typing",void(i.lastTs=n);if(i.lastTs=n,"typing"===i.phase&&i.lastValue.length-o.length>=3)i.phase="deleted";else if("deleted"===i.phase&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=2)){const t=f(e);return I({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:$r(e)}}),void Er.delete(r)}i.lastValue=o}else Er.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function $r(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Ur=null,Nr=2e3,Rr=[],Cr=new Map,Lr=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rr))return;if(!(t=>{if(/^(A|BUTTON|SELECT)$/.test(t.tagName))return!0;const e=t.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(e))return!0;try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e))return;const n=a(e);if(Ur?.selector===n)return;Br();const o=Date.now();if(o-(Cr.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=f(e);Cr.set(n,t),Ur=null,I({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Nr);Ur={el:e,selector:n,startTs:r,timer:i}}),jr=e(t=>{if(!Ur)return;const e=t.target;if(e!==Ur.el&&!Ur.el.contains(e))return;const n=t.relatedTarget;n&&Ur.el.contains(n)||Br()}),Ir=e(Br);function Br(){Ur&&(clearTimeout(Ur.timer),Ur=null)}var Pr=0,zr=0,qr=null,Xr=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Pr<3e3||n-zr<6e4||(qr&&clearTimeout(qr),qr=setTimeout(t(()=>{const t=Date.now();zr=t,qr=null,I({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Pr)}})}),500))}),Fr=null,Jr=null,Zr=null,Hr=0;function Vr(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function Wr(){if(Zr){if(Zr.disconnect(),Zr=null,Hr>0){const t=Math.round(1e3*Hr)/1e3;I({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:Vr(Hr,.1,.25)}})}Hr=0}}var Yr=[],Gr=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,Yr))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=f(e);I({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:Kr(e)}})},100)});function Kr(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Qr=!1,ti=null,ei=null;function ni(e){if(Qr)return;if(!e.key)return;if(e.key.startsWith("fd_sec_"))return;if(!e.key.startsWith("fd_pub_"))return;if(!1!==e.respectDoNotTrack&&("1"===navigator.doNotTrack||navigator.globalPrivacyControl))return void(ei=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(ei=e);ei=e,Qr=!0;const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return c(n,r,30),r})(e.cookieless??!1),s=(t=>{if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}})(e.endpoint)??"https://api.flusterduck.com/v1/ingest",a=Z(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;M=t,D=Object.assign(Object.create(null),e),x={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off"),compression:J(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.addEventListener("visibilitychange",L),window.addEventListener("pagehide",j)})(s,{sid:r,key:e.key,url:location.origin+location.pathname,page:a,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u,compression:e.compression});const d=ui(location.pathname,e.ignorePages??[]);d&&$(!0);const f=document.referrer;let p="";if(f)try{p=new URL(f).origin+new URL(f).pathname}catch{p=""}d||I({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[],m=t=>{const n=e.signals?.[t];return!1!==n?.enabled};if(m("rageClick")&&((t,e)=>{rt||(rt=!0,G=t?.threshold??3,K=t?.windowMs??2e3,Q=[...W,...e??[]],et=Date.now(),Y=[],tt=[],nt.clear(),ot.clear(),document.addEventListener("click",it,{capture:!0,passive:!0}))})(e.signals?.rageClick,h),m("deadClick")&&(t=>{ut=t??[],document.addEventListener("mousedown",ft,{capture:!0,passive:!0}),document.addEventListener("click",pt,{capture:!0,passive:!0})})(h),m("speedFrustration")){const t=e.signals?.speedFrustration;((t,e)=>{_t=t?.delayMs??3e3,vt=e??[],document.addEventListener("click",kt,{capture:!0,passive:!0}),document.addEventListener("keydown",Tt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Dt,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,h)}if(!1!==e.trackMouse&&m("thrashCursor")){const t=e.signals?.thrashCursor;w=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,At=w?.velocityThreshold??800,Et=w?.windowMs??2e3,document.addEventListener("mousemove",Pt,{passive:!0})}var w,_;if(m("loopNav")&&(t=>{Ft=t?.windowMs??3e4})(e.signals?.loopNav),m("scrollBounce")&&(Jt=1e4,Zt=.5,window.addEventListener("scroll",Kt,{passive:!0})),!1!==e.trackForms){if(m("formHesitation")||m("formAbandon")){const n=e.signals?.formHesitation;((e,n)=>{ie=e?.pauseMs??5e3,ce=n??[],document.addEventListener("focusin",se,{capture:!0,passive:!0}),document.addEventListener("focusout",ae,{capture:!0,passive:!0}),document.addEventListener("submit",ue,{capture:!0,passive:!0}),window.addEventListener("pagehide",le),de=t(()=>{"hidden"===document.visibilityState&&fe()}),document.addEventListener("visibilitychange",de)})(n?{pauseMs:n.threshold}:void 0,h)}m("formValidationLoop")&&(t=>{cr=t??[],document.addEventListener("invalid",ar,{capture:!0,passive:!0}),document.addEventListener("input",ur,{capture:!0,passive:!0}),document.addEventListener("change",ur,{capture:!0,passive:!0}),(sr=new MutationObserver(vr)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(h)}if(m("errorEncounter")&&(window.addEventListener("error",_e),window.addEventListener("unhandledrejection",ve),he||(he=window.fetch,me=function(t,e){let n;try{n=he.call(this,t,e)}catch(t){throw t}return n.then(e=>{try{if(e.status>=400){const n="string"==typeof t?t:t instanceof URL?t.pathname:t.url;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:ye(n),status:e.status,error_category:"network",url:location.pathname}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Me(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?ye(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=me)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&(t=>{Re=t??[],document.addEventListener("touchstart",Ce,{passive:!0}),document.addEventListener("touchend",Le,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",je,{passive:!0}),window.addEventListener("orientationchange",Ie,{passive:!0})),window.visualViewport?.addEventListener("resize",Be)})(h),(m("tabThrash")||m("focusTrap")||m("keyboardNavFrustration"))&&(t=>{He=t??[],document.addEventListener("keydown",Ve,{capture:!0,passive:!0})})(h),m("scrollHijack")&&(window.addEventListener("wheel",cn,{passive:!0}),window.addEventListener("touchmove",sn,{passive:!0}),window.addEventListener("scroll",rn,{passive:!0})),m("scrollDepthAbandon")&&(window.addEventListener("scroll",fn,{passive:!0}),hn=t(mn),window.addEventListener("pagehide",hn),pn=t(()=>{"hidden"===document.visibilityState&&mn()}),document.addEventListener("visibilitychange",pn)),m("advancedHeuristics")&&(Tn||(Tn=!0,yn=Sn(),En(),document.addEventListener("mouseenter",Dn,!0),document.addEventListener("mouseleave",Dn,!0),document.addEventListener("click",An,{capture:!0,passive:!0}),document.addEventListener("keydown",An,{capture:!0,passive:!0}),document.addEventListener("scroll",An,{passive:!0}),window.addEventListener("resize",xn,{passive:!0}))),m("helpHunt")&&(t=>{Rn=t??[],document.addEventListener("click",Cn,{capture:!0,passive:!0})})(h),m("closeClick")&&(t=>{qn=t??[],document.addEventListener("click",Xn,{capture:!0,passive:!0})})(h),m("closeClickReversal")&&(t=>{Hn=t??[],document.addEventListener("click",Vn,{capture:!0,passive:!0}),document.addEventListener("keydown",Wn,{capture:!0,passive:!0}),window.addEventListener("popstate",Yn)})(h),m("filterSpiral")&&(t=>{eo=t??[],document.addEventListener("change",no,{capture:!0,passive:!0}),document.addEventListener("click",oo,{capture:!0,passive:!0})})(h),m("copyFrustration")&&document.addEventListener("copy",co,{capture:!0,passive:!0}),m("textSelectFrustration")&&(uo=t(po),lo=t(fo),document.addEventListener("selectionchange",uo),document.addEventListener("copy",lo,{capture:!0,passive:!0}),document.addEventListener("cut",lo,{capture:!0,passive:!0})),m("deadClickTrapZone")&&(t=>{tr=t??[],document.addEventListener("mousedown",nr,{capture:!0,passive:!0}),document.addEventListener("click",or,{capture:!0,passive:!0})})(h),(t=>{vo=[],go=null,bo=!0,yo=new Map,ko=t??"",(()=>{try{const t=sessionStorage.getItem(mo);if(t){const e=JSON.parse(t);Mo={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),O($o),To=()=>Eo("popstate"),Do=()=>Eo("hashchange"),xo=()=>{"hidden"===document.visibilityState&&Eo("visibilitychange")},Ao=()=>Eo("pagehide"),window.addEventListener("popstate",To),window.addEventListener("hashchange",Do),document.addEventListener("visibilitychange",xo),window.addEventListener("pagehide",Ao)})(a),m("navigationConfusion")&&(No=[],Co=!1,Ro=location.pathname+location.search+location.hash,window.addEventListener("popstate",Lo),window.addEventListener("hashchange",jo)),m("scrollToClickConfusion")&&(Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1,window.addEventListener("scroll",Zo,{passive:!0}),window.addEventListener("click",Ho,{capture:!0})),m("elementImpression")&&(_=e.elementImpressionSelectors,yr=_?.length?_:["[data-fd-impression]"],Mr=Date.now(),"undefined"!=typeof IntersectionObserver&&(gr=new IntersectionObserver(t(Ar),{threshold:[0,.5,1]}),Tr(),(br=new MutationObserver(t(xr))).observe(document.body,{childList:!0,subtree:!0}))),!1!==e.trackForms&&m("inputCorrection")&&(t=>{Sr=t??[],document.addEventListener("input",Or,{capture:!0,passive:!0})})(h),!1!==e.trackForms&&m("pasteBlocked")&&(t=>{Yr=t??[],document.addEventListener("paste",Gr,{capture:!0,passive:!0})})(h),m("hoverDwell")){const t=e.signals?.hoverDwell;((t,e)=>{Nr=t?.dwellMs??2e3,Rr=e??[],document.addEventListener("mouseover",Lr,{passive:!0}),document.addEventListener("mouseout",jr,{passive:!0}),document.addEventListener("click",Ir,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,h)}m("exitIntent")&&(Pr=Date.now(),zr=0,document.addEventListener("mouseleave",Xr)),m("performanceVitals")&&(()=>{if("undefined"!=typeof PerformanceObserver){try{(Fr=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);I({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Vr(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Fr=null}try{(Jr=new PerformanceObserver(t(t=>{for(const e of t.getEntries()){const t=e;if(!t.interactionId)continue;const n=Math.round(t.duration);n<200||I({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:Vr(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Jr=null}try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Zr=null}}})(),ti=function(t){let e=location.href;function n(){const n=location.href;n!==e&&(e=n,t(n,location.pathname))}const o=history.pushState,r=history.replaceState,i=function(...t){o.apply(this,t),n()},c=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=c,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===c&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((n,o)=>{B(),Ht=[],Vt=0,Wt=0,Yt=!1,te.clear(),ee.clear(),ne.clear(),oe=null,re=0,un=0,ln=0,dn=!1,xt(),En(),kn=0,Nn=[],Pn=[],zn.clear(),Zn=null,to.clear(),io=[],so=[],ao=0,Qo.clear(),(()=>{for(const t of ir.values())pr(t);ir.clear()})(),dt.clear(),an(),Vo(),No=[],Co=!1,Ro=location.pathname+location.search+location.hash,kr.clear(),gr&&Tr(),Er.clear(),Br(),Cr.clear(),Pr=Date.now(),zr=0,qr&&(clearTimeout(qr),qr=null),(()=>{if(Wr(),"undefined"!=typeof PerformanceObserver)try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Zr=null}})(),Io(o),(t=>{ko=t})(o);const r=Z(o,e.pageRules??[]),i=ui(o,e.ignorePages??[]);$(i),P({page:r,url:n}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;qt.length&&e-qt[0].ts>Ft;)qt.shift();for(;Xt.length&&e-Xt[0].ts>Ft;)Xt.shift();if(qt.length>=100&&(qt=qt.slice(-50)),Xt.length>=100&&(Xt=Xt.slice(-50)),qt.push({path:t,ts:e}),r){Xt.push({path:t,ts:e});const n=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))===o}),r=new Set(n.map(t=>{const e=t.path.indexOf("#");return-1===e?"":t.path.slice(e)}));if(r.size>=3&&n.length>r.size){const t=n.slice(-5).map(t=>t.path);return I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(qt.length<4)return;let i=!1;const c=[];for(let e=0;e<qt.length-1;e++)if(qt[e].path===t){const t=qt.slice(e,qt.length),n=new Set(t.map(t=>t.path));if(n.size>=2){c.push(...Array.from(n)),i=!0;break}}i&&(I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:c,path_sequence:qt.slice(-5).map(t=>t.path)}}),qt=[{path:t,ts:e}],Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(o),i||I({t:"pv",ts:Date.now(),d:{ref:""}})}))}function oi(t,e){if(!Qr)return;if("string"!=typeof t||!t||t.length>128)return;let n;try{n=JSON.stringify(e?.metadata??{})}catch{return}if(n.length>2048)return;const o=JSON.parse(n);I({t:"sig",ts:Date.now(),d:{s:t.slice(0,128),el:"string"==typeof e?.element?e.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(e?.weight??15,100))}})}function ri(t,e={}){if(!Qr)return;if("string"!=typeof t||!/^[a-z0-9_.-]{1,120}$/i.test(t))return;let n;try{n=JSON.stringify(e??{})}catch{return}n.length>2048||I({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ii(t){if(!Qr)return;if(!t||"object"!=typeof t)return;const e=Object.create(null);let n=0;for(const o of Object.keys(t)){if(n>=20)break;"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&(e[o.slice(0,64)]=String(t[o]).slice(0,256),n++)}P({segment:e})}function ci(t){t&&ei&&!Qr?ni(ei):t||(ai(),r())}function si(){ai(),r()}function ai(){Qr&&(rt&&(rt=!1,document.removeEventListener("click",it,{capture:!0,passive:!0}),Y=[],tt=[],nt.clear(),ot.clear()),document.removeEventListener("mousedown",ft,{capture:!0}),document.removeEventListener("click",pt,{capture:!0}),lt=null,dt.clear(),document.removeEventListener("click",kt,{capture:!0}),document.removeEventListener("keydown",Tt,{capture:!0}),document.removeEventListener("touchstart",Dt,{capture:!0}),xt(),document.removeEventListener("mousemove",Pt),Bt&&clearTimeout(Bt),zt(),qt=[],Xt=[],window.removeEventListener("scroll",Kt),Ht=[],Yt=!1,document.removeEventListener("focusin",se,{capture:!0}),document.removeEventListener("focusout",ae,{capture:!0}),document.removeEventListener("submit",ue,{capture:!0}),window.removeEventListener("pagehide",le),de&&(document.removeEventListener("visibilitychange",de),de=null),te.clear(),ee.clear(),ne.clear(),oe=null,window.removeEventListener("error",_e),window.removeEventListener("unhandledrejection",ve),he&&me&&window.fetch===me&&(window.fetch=he),he=null,me=null,document.removeEventListener("touchstart",Ce),document.removeEventListener("touchend",Le),document.removeEventListener("gesturechange",je),window.removeEventListener("orientationchange",Ie),window.visualViewport?.removeEventListener("resize",Be),De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,document.removeEventListener("keydown",Ve,{capture:!0}),ze=[],Ze=[],qe=null,Xe=0,Fe=0,Je="",He=[],window.removeEventListener("wheel",cn),window.removeEventListener("touchmove",sn),window.removeEventListener("scroll",rn),an(),window.removeEventListener("scroll",fn),hn&&(window.removeEventListener("pagehide",hn),hn=null),pn&&(document.removeEventListener("visibilitychange",pn),pn=null),un=0,ln=0,dn=!1,Tn&&(Tn=!1,document.removeEventListener("mouseenter",Dn,!0),document.removeEventListener("mouseleave",Dn,!0),document.removeEventListener("click",An,{capture:!0}),document.removeEventListener("keydown",An,{capture:!0}),document.removeEventListener("scroll",An),window.removeEventListener("resize",xn),On(),wn="",_n=0,vn=0,bn=0,gn=0,kn=0),document.removeEventListener("click",Cn,{capture:!0}),Nn=[],document.removeEventListener("click",Xn,{capture:!0}),Pn=[],zn.clear(),document.removeEventListener("click",Vn,{capture:!0}),document.removeEventListener("keydown",Wn,{capture:!0}),window.removeEventListener("popstate",Yn),Zn=null,document.removeEventListener("change",no,{capture:!0}),document.removeEventListener("click",oo,{capture:!0}),to.clear(),document.removeEventListener("copy",co,{capture:!0}),io=[],uo&&(document.removeEventListener("selectionchange",uo),uo=null),lo&&(document.removeEventListener("copy",lo,{capture:!0}),document.removeEventListener("cut",lo,{capture:!0}),lo=null),so=[],ao=0,document.removeEventListener("mousedown",nr,{capture:!0}),document.removeEventListener("click",or,{capture:!0}),er=null,Qo.clear(),(()=>{document.removeEventListener("invalid",ar,{capture:!0}),document.removeEventListener("input",ur,{capture:!0}),document.removeEventListener("change",ur,{capture:!0}),sr&&(sr.disconnect(),sr=null);for(const t of ir.values())pr(t);ir.clear()})(),bo=!1,vo=[],go=null,yo=new Map,O(null),To&&(window.removeEventListener("popstate",To),To=null),Do&&(window.removeEventListener("hashchange",Do),Do=null),xo&&(document.removeEventListener("visibilitychange",xo),xo=null),Ao&&(window.removeEventListener("pagehide",Ao),Ao=null),window.removeEventListener("popstate",Lo),window.removeEventListener("hashchange",jo),No=[],Co=!1,Ro="",window.removeEventListener("scroll",Zo),window.removeEventListener("click",Ho,{capture:!0}),Vo(),gr&&(gr.disconnect(),gr=null),br&&(br.disconnect(),br=null),kr.clear(),document.removeEventListener("input",Or,{capture:!0}),Er.clear(),document.removeEventListener("mouseover",Lr),document.removeEventListener("mouseout",jr),document.removeEventListener("click",Ir,{capture:!0}),Br(),Cr.clear(),document.removeEventListener("mouseleave",Xr),qr&&(clearTimeout(qr),qr=null),Fr&&(Fr.disconnect(),Fr=null),Jr&&(Jr.disconnect(),Jr=null),Wr(),document.removeEventListener("paste",Gr,{capture:!0}),B(),S=!1,document.removeEventListener("visibilitychange",L),window.removeEventListener("pagehide",j),y&&(clearTimeout(y),y=null),ti&&(ti(),ti=null),Qr=!1)}function ui(t,e){for(const n of e)if(n)if(n.endsWith("*")){if(t.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(t.endsWith(n.slice(1)))return!0}else if(t===n)return!0;return!1}function li(t){if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}}(()=>{try{const t=window;if(t.flusterduck)return;const e=document.currentScript;if(!e)return;const n=e.getAttribute("data-key");if(!n)return;const o={key:n,environment:e.getAttribute("data-env")||void 0,endpoint:li(e.getAttribute("data-endpoint")),debug:"true"===e.getAttribute("data-debug"),cookieless:"true"===e.getAttribute("data-cookieless"),respectDoNotTrack:"false"!==e.getAttribute("data-dnt")},r=e.getAttribute("data-dom-mode");"metadata"!==r&&"snapshot"!==r||(o.domMode=r),"off"===e.getAttribute("data-compression")&&(o.compression="off");const i=e.getAttribute("data-sample");if(i){const t=parseFloat(i);isNaN(t)||(o.sampleRate=Math.max(0,Math.min(t,1)))}const c=e.getAttribute("data-segment");if(c&&c.length<2048)try{const t=JSON.parse(c);if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.create(null);for(const n of Object.keys(t))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=String(t[n]));o.segment=e}}catch{}ni(o),t.flusterduck=Object.freeze({init:ni,signal:oi,track:ri,identify:ii,setConsent:ci,optOut:si,destroy:ai})}catch{}})()})();
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Ae=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var Vn=Object.prototype.hasOwnProperty;var Yn=(e,t)=>{for(var n in t)Ae(e,n,{get:t[n],enumerable:!0})},Xn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jn(t))!Vn.call(e,r)&&r!==n&&Ae(e,r,{get:()=>t[r],enumerable:!(o=qn(t,r))||o.enumerable});return e};var $n=e=>Xn(Ae({},"__esModule",{value:!0}),e);var Br={};Yn(Br,{destroy:()=>Te,identify:()=>Un,init:()=>Tt,optOut:()=>zn,setConsent:()=>Hn,signal:()=>Fn,track:()=>Bn});module.exports=$n(Br);function S(e){return((...t)=>{try{return e(...t)}catch{}})}function d(e){return t=>{try{e(t)}catch{}}}var xe="_fd_s";var Wn=/^[0-9a-f]{32}$/;function At(e){if(e)return Mt();let t=Kn(xe);if(t&&Wn.test(t))return t;let n=Mt();return xt(xe,n,30),n}function ke(){xt(xe,"",-1)}function Mt(){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 Kn(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function xt(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var Qn=/^[:\d]|--|^(ember|react|ng-|__)/;function m(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Y(t)}"]`;if(e.id&&!Qn.test(e.id)&&e.id.length<64)return"#"+Y(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),c=o.getAttribute("name"),s=o.getAttribute("role"),a=o.getAttribute("type");c&&c.length<64?i+=`[name="${Y(c)}"]`:s?i+=`[role="${Y(s)}"]`:a&&(i==="input"||i==="button")&&(i+=`[type="${Y(a)}"]`);let u=o.parentElement;if(u){let p=u.children,w=0,V=0;for(let O=0;O<p.length;O++){let Me=p[O];Me&&Me.tagName===o.tagName&&(w++,Me===o&&(V=w))}w>1&&(i+=`:nth-of-type(${V})`)}n.unshift(i);let f=n.join(" > ");try{if(document.querySelectorAll(f).length===1)return f}catch{}o=u,r++}return n.join(" > ")}function Y(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}function b(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 Lt(e,t){if(t==="off")return null;if(t==="metadata")return Gn(e);let n=Jn(e);return n?{mode:"snapshot",...n}:null}function Gn(e){return{mode:"metadata",selector:m(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:kt(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:kt(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Zn(e)}}}function Jn(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let c=0;c<o.children.length&&r.length<6;c++){let s=o.children[c];if(!s||s===e)continue;let a=s.getBoundingClientRect();r.push({selector:m(s),tag:s.tagName.toLowerCase(),box:{x:Math.round(a.x),y:Math.round(a.y),w:Math.round(a.width),h:Math.round(a.height)},interactive:to(s)})}let i=[];try{let c=e.getAnimations();for(let s of c)"animationName"in s&&i.push(s.animationName)}catch{}return{selector:m(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?m(o):"",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:eo(t),animations:i,siblings:r}}catch{return null}}function kt(e,t){return e&&t.includes(e)?e:null}function Zn(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 eo(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function to(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 Rt=7e3,no=5e3,oo=1e4,Dt=50,Ct=100,ro=3,X=6e4,se="application/json",io="application/json; encoding=gzip",N=[],x=null,ae="",Ot=Rt,Nt=Dt,v=null,ce={domMode:"off",compression:"auto"},Le=!1,so=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),ao=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),co=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,uo=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,It=d(fo),Pt=S(()=>R());function Ft(e,t,n,o,r){ae=e,v=Object.assign(Object.create(null),t),ce={domMode:yo(r?.domMode),compression:Eo(r?.compression)},Ot=Math.max(no,Math.min(n??Rt,oo)),Nt=Math.max(5,Math.min(o??Dt,Ct)),document.addEventListener("visibilitychange",It),window.addEventListener("pagehide",Pt)}function l(e){N.length>=Ct||(N.push(e),N.length>=Nt?R():x||(x=setTimeout(R,Ot)))}function R(){lo()}async function lo(){if(Le||!N.length||!v)return;Le=!0,x&&(clearTimeout(x),x=null);let e=N;N=[];let t={v:1,sid:v.sid,key:v.key,url:v.url,page:v.page,ts:Date.now(),ua:v.ua,vw:v.vw,vh:v.vh,environment:v.environment,dom_mode:ce.domMode},n=e.map(r=>go(r,v.page,ce.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>X)if(o.length>0)await _e({...t,events:o}),o=[r];else{let s={...t,events:[r]};JSON.stringify(s).length<=X&&await _e(s),o=[]}else o=i}o.length>0&&await _e({...t,events:o})}catch{}finally{Le=!1}}function Re(e){if(v)for(let t of Object.keys(e))so.has(t)&&(v[t]=e[t])}function Bt(){R(),document.removeEventListener("visibilitychange",It),window.removeEventListener("pagehide",Pt),x&&(clearTimeout(x),x=null)}function fo(){document.visibilityState==="hidden"&&R()}async function _e(e){let t=JSON.stringify(e),n=await mo(t,ce.compression);n&&Ut(n,0)}async function mo(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>X)return null;if(t!=="off"){let r=await po(e);if(r&&r.byteLength<=X)return{beaconBody:new Blob([r],{type:io}),fetchBody:new Uint8Array(r),headers:{"Content-Type":se,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:se}),fetchBody:e,headers:{"Content-Type":se}}}async function po(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=ho(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),c=[],s=0;for(;;){let f=await i.read();if(f.done)break;if(s+=f.value.byteLength,s>X)return null;let p=new Uint8Array(f.value.byteLength);p.set(f.value),c.push(p)}let a=new Uint8Array(s),u=0;for(let f of c)a.set(f,u),u+=f.byteLength;return a.buffer}catch{return null}}function ho(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:se});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function Ut(e,t){if(ae&&!(navigator.sendBeacon&&navigator.sendBeacon(ae,e.beaconBody)))try{fetch(ae,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<ro&&setTimeout(()=>Ut(e,t+1),1e3*(t+1))})}catch{}}function go(e,t,n){let o=e.d??{},r=vo(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},c=_t(o.el,o.element,o.target);if(r==="signal"){i.signal_type=_t(o.s,o.signal_type,o.name)?.slice(0,128),c&&(i.element=c.slice(0,2048));let a=c?bo(c,n):null;a&&(i.dom=a)}let s=wo(o);return Object.keys(s).length&&(i.metadata=s),i}function vo(e){return e==="pv"?"pageview":e==="sig"?"signal":ao.has(e)?e:"custom_signal"}function wo(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 o=ue(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=ue(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function ue(e,t="",n=0){if(!(n>4)&&!co.test(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 uo.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>ue(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=ue(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function bo(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Lt(n,t):null}catch{return null}}function _t(...e){for(let t of e)if(typeof t=="string"&&t)return t}function yo(e){return e==="metadata"||e==="snapshot"?e:"off"}function Eo(e){return e==="off"?"off":"auto"}function Ht(e){let t=location.href;function n(){let s=location.href;s!==t&&(t=s,e(s,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...s){o.apply(this,s),n()},c=function(...s){r.apply(this,s),n()};return history.pushState=i,history.replaceState=c,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===c&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function De(e,t){for(let n of t){let o=To(n.pattern);if(o&&o.test(e))return n.label}return Mo(e)}var So=/^[a-zA-Z0-9/:._*\-]+$/;function To(e){if(e.length>200||!So.test(e))return null;let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Mo(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Ao=[".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"]'],k=[],Ce=3,qt=2e3,zt=8,jt=[],Vt=d(xo);function Oe(e,t){Ce=e?.threshold??3,qt=e?.windowMs??2e3,jt=[...Ao,...t??[]],document.addEventListener("click",Vt,{capture:!0,passive:!0})}function Ne(){document.removeEventListener("click",Vt,{capture:!0,passive:!0}),k=[]}function xo(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||b(t,jt)||ko(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;k.length&&n-k[0].t>qt;)k.shift();if(k.push({t:n,x:o,y:r}),k.length<Ce)return;let i=k.slice(-Ce),c=i[0];for(let p=1;p<i.length;p++){let w=i[p],V=w.x-c.x,O=w.y-c.y;if(V*V+O*O>zt*zt)return}let s=c.t,u=(i[i.length-1].t-s)/1e3,f=u>0?i.length/u:i.length;l({t:"sig",ts:n,d:{s:"rage_click",el:m(t),cnt:i.length,vel:Math.round(f*10)/10}}),k=[]}function ko(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick"))}var Lo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,_o=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ro=/^(A|BUTTON|LABEL)$/,Yt=[],$=null,Do=5,Xt=d(Co),$t=d(Oo);function Co(e){$={x:e.clientX,y:e.clientY}}function Ie(e){Yt=e??[],document.addEventListener("mousedown",Xt,{capture:!0,passive:!0}),document.addEventListener("click",$t,{capture:!0,passive:!0})}function Pe(){document.removeEventListener("mousedown",Xt,{capture:!0}),document.removeEventListener("click",$t,{capture:!0}),$=null}function Oo(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||b(t,Yt)||Po()||Fo(e)||No(t))return;let n=Io(t,e.clientX,e.clientY),o=n?Wt(e.clientX,e.clientY,n):-1;l({t:"sig",ts:Date.now(),d:{s:"dead_click",el:m(t),near:n?m(n):"",dist:Math.round(o)}})}function No(e){if(Lo.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&_o.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&&Ro.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Io(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let c=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),s=null,a=1/0;for(let u=0;u<c.length;u++){let f=c[u];if(!f||f===e)continue;let p=Wt(t,n,f);p<a&&(a=p,s=f)}if(s&&a<100)return s;o=i}return null}function Wt(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),c=e-r,s=t-i;return Math.sqrt(c*c+s*s)}function Po(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Fo(e){if(!$)return!1;let t=e.clientX-$.x,n=e.clientY-$.y;return Math.sqrt(t*t+n*n)>Do}var h=null,Fe=3e3,Kt=[],Bo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Uo=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Qt=d(Ho);function Be(e,t){Fe=e?.delayMs??3e3,Kt=t??[],document.addEventListener("click",Qt,{capture:!0,passive:!0})}function Ue(){document.removeEventListener("click",Qt,{capture:!0}),W()}function Ho(e){let t=e.target;if(!t||b(t,Kt))return;let n=t.getAttribute("role");if(!Bo.test(t.tagName)&&!(n&&Uo.test(n)))return;if(h){if(h.el===t||h.el.contains(t)){let a=Date.now()-h.ts;a>=Fe&&l({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:h.selector,delay:a}}),W();return}W()}let o=m(t),r=!1,i=new MutationObserver(a=>{for(let u of a){if(u.type==="childList"&&(u.addedNodes.length>0||u.removedNodes.length>0)){r=!0,W();return}if(u.type==="attributes"&&u.target instanceof Element&&(u.target===t||t.contains(u.target)||u.target.contains(t))){r=!0,W();return}}}),c=t.parentElement||document.body;i.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let s=setTimeout(()=>{!r&&h&&(h={...h,timeout:null})},Fe+500);h={el:t,selector:o,ts:Date.now(),observer:i,timeout:s}}function W(){h&&(h.observer.disconnect(),h.timeout&&clearTimeout(h.timeout),h=null)}var zo=100,Jt=800,Zt=2e3,qo=3,Gt=0,jo=16,le=0,de=0,K=0,Q=0,G=0,fe=0,He=0,D=[],I=null,en=d(Vo);function ze(e){Jt=e?.velocityThreshold??800,Zt=e?.windowMs??2e3,document.addEventListener("mousemove",en,{passive:!0})}function qe(){document.removeEventListener("mousemove",en),I&&clearTimeout(I),je()}function Vo(e){let t=Date.now();t-Gt<jo||(Gt=t,I&&clearTimeout(I),I=setTimeout(()=>je(),150),Yo(e.clientX,e.clientY,t))}function Yo(e,t,n){if(K===0){le=e,de=t,K=n,He=n;return}let o=(n-K)/1e3;if(o===0)return;let r=e-le,i=t-de;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i)/o;D.length>=zo&&(D=D.slice(-50)),D.push(s);let a=Math.sign(r),u=Math.sign(i);if((Q!==0&&a!==0&&a!==Q||G!==0&&u!==0&&u!==G)&&fe++,Q=a||Q,G=u||G,le=e,de=t,K=n,n-He>Zt){if(fe>=qo){let f=D.reduce((p,w)=>p+w,0)/D.length;f>=Jt&&l({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(f),rev:fe}})}je(),He=n}}function je(){fe=0,D=[],Q=0,G=0,K=0,le=0,de=0,I=null}var Xo=100,g=[],tn=3e4;function Ve(e){tn=e?.windowMs??3e4}function Ye(){g=[]}function Xe(e){let t=Date.now();try{let i=performance.getEntriesByType("navigation");if(i.length>0&&i[0].type==="back_forward")return}catch{}for(;g.length&&t-g[0].ts>tn;)g.shift();if(g.length>=Xo&&(g=g.slice(-50)),g.push({path:e,ts:t}),g.length<4)return;let n=e,o=!1,r=[];for(let i=0;i<g.length-1;i++)if(g[i].path===n){let c=g.slice(i,g.length),s=new Set(c.map(a=>a.path));if(s.size>=2){r.push(...Array.from(s)),o=!0;break}}o&&(l({t:"sig",ts:t,d:{s:"loop_nav",pages:r}}),g=[{path:e,ts:t}])}var $o=100,nn=1e4,Ke=.5,y=[],me=0,Qe=0,$e=!1,We=0,on=d(Wo);function Ge(e){nn=e?.windowMs??1e4,Ke=e?.depthThreshold??.5,window.addEventListener("scroll",on,{passive:!0})}function Je(){window.removeEventListener("scroll",on),y=[]}function Ze(){y=[],me=0,Qe=0}function Wo(){$e||($e=!0,requestAnimationFrame(()=>{$e=!1,Ko()}))}function Ko(){let e=Date.now(),t=window.scrollY;if(We=document.documentElement.scrollHeight-window.innerHeight,We<=0)return;let n=t/We,o=t>me?"down":"up";if(e-Qe<100){me=t;return}for(;y.length&&e-y[0].ts>nn;)y.shift();y.length>=$o&&(y=y.slice(-50)),y.push({depth:n,ts:e,direction:o}),me=t,Qe=e;let r=0,i=1,c=0,s=!1;for(let a=0;a<y.length;a++){let u=y[a].depth;u>r&&(r=u),u>=Ke&&(s=!0),s&&u<i&&(i=u),s&&i<.25&&u>=Ke&&(c++,s=!1,i=1)}c>=1&&(l({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:c+1}}),y=[])}var Qo=["textarea",'[role="textbox"]',"[contenteditable]"],Z=new Map,L=new Set,C=null,et=0,rn=5e3,sn=[],an=d(Go),cn=d(Jo),un=d(Zo),ln=S(dn),J=null;function tt(e,t){rn=e?.pauseMs??5e3,sn=t??[],document.addEventListener("focusin",an,{capture:!0,passive:!0}),document.addEventListener("focusout",cn,{capture:!0,passive:!0}),document.addEventListener("submit",un,{capture:!0,passive:!0}),window.addEventListener("pagehide",ln),J=S(()=>{document.visibilityState==="hidden"&&dn()}),document.addEventListener("visibilitychange",J)}function nt(){document.removeEventListener("focusin",an,{capture:!0}),document.removeEventListener("focusout",cn,{capture:!0}),document.removeEventListener("submit",un,{capture:!0}),window.removeEventListener("pagehide",ln),J&&(document.removeEventListener("visibilitychange",J),J=null),Z.clear(),L.clear(),C=null}function ot(){Z.clear(),L.clear(),C=null,et=0}function Go(e){let t=e.target;if(!t||!fn(t)||b(t,sn)||er(t))return;Z.set(t,Date.now());let n=t.closest("form");n&&n!==C&&(C=n,et=n.querySelectorAll("input, select, textarea").length)}function Jo(e){let t=e.target;if(!t||!fn(t))return;let n=Z.get(t);if(Z.delete(t),n){let r=Date.now()-n;r>=rn&&l({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:m(t),pause:r}})}let o=t.getAttribute("name")||t.getAttribute("id")||m(t);tr(t)&&L.add(o)}function Zo(){L.clear(),C=null}function dn(){L.size>0&&C&&(l({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:L.size,total:et||L.size}}),L.clear(),C=null)}function fn(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function er(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Qo)try{if(e.matches(t))return!0}catch{return!1}return!1}function tr(e){return"value"in e?e.value.length>0:!1}var P=null,ee=null,mn=/flusterduck\.com|\/v1\/ingest/,hn=d(nr),gn=d(or);function rt(){window.addEventListener("error",hn),window.addEventListener("unhandledrejection",gn),rr()}function it(){window.removeEventListener("error",hn),window.removeEventListener("unhandledrejection",gn),ir()}function nr(e){l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:st(e.message||"Unknown error",200),ep:"",status:0}})}function or(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:st(t,200),ep:"",status:0}})}function rr(){P||(P=window.fetch,ee=function(t,n){let o;try{o=P.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;mn.test(i)||l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:pn(i),status:r.status}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;mn.test(i)||l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:st(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?pn(t):"",status:0}})}catch{}throw r})},window.fetch=ee)}function ir(){P&&ee&&window.fetch===ee&&(window.fetch=P),P=null,ee=null}function pn(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function st(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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var vn=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],sr=['[class*="map"]',"canvas",".gallery","[data-zoom]"],F=null,T=0,pe=0,te=0,wn=0,bn=null,yn=[],En=d(ar),Sn=d(cr),Tn=d(dr),Mn=d(mr),An=d(fr);function at(e){yn=e??[],document.addEventListener("touchstart",En,{passive:!0}),document.addEventListener("touchend",Sn,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Tn,{passive:!0}),window.addEventListener("orientationchange",Mn,{passive:!0})),window.visualViewport?.addEventListener("resize",An)}function ct(){document.removeEventListener("touchstart",En),document.removeEventListener("touchend",Sn),document.removeEventListener("gesturechange",Tn),window.removeEventListener("orientationchange",Mn),window.visualViewport?.removeEventListener("resize",An)}function ar(e){let t=e.touches[0];e.touches.length===1&&t&&(F={x:t.clientX,y:t.clientY,ts:Date.now()})}function cr(e){if(!F||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-F.x,o=t.clientY-F.y,r=Date.now()-F.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&ur(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&lr(i,n,o),F=null}function ur(e,t,n){if(b(e,yn))return;let o=pr(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),c=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((t-i)**2+(n-c)**2);if(s>0&&s<=20){let a=`${Math.round(r.width)}x${Math.round(r.height)}`;l({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:m(o),dist:Math.round(s),size:a}})}}function lr(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||vn.some(c=>{try{return e.matches(c)||e.closest(c)}catch{return!1}})||!vn.some(c=>{try{return document.querySelector(c)!==null}catch{return!1}}))return;let i=t>0?"right":"left";l({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function dr(){let e=Date.now();if(e-pe>3e4&&(T=0,pe=e),T++,T>=2){let t=document.activeElement||document.body;sr.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})||l({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:T}}),T=0}}function fr(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();t-pe>3e4&&(T=0,pe=t),T++,T>=2&&(l({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:T}}),T=0)}}function mr(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-wn>3e4&&(te=0,wn=e),t!==bn&&(te++,bn=t),te>=3&&(l({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:te}}),te=0)}function pr(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,c=21;for(let s=0;s<r.length;s++){let a=r[s];if(!a)continue;let u=a.getBoundingClientRect(),f=Math.max(u.left,Math.min(t,u.right)),p=Math.max(u.top,Math.min(n,u.bottom)),w=Math.sqrt((t-f)**2+(n-p)**2);w<c&&w>0&&(c=w,i=a)}return i}var E=[],B=null,A=0,ut=0,M=[],hr=10,gr=5e3,xn=5,vr=3e3,wr=15,br=5e3,kn=d(yr);function lt(){document.addEventListener("keydown",kn,{capture:!0,passive:!0})}function dt(){document.removeEventListener("keydown",kn,{capture:!0}),E=[],M=[],B=null}function yr(e){let t=Date.now(),n=e.target;n&&b(n,[])||(e.key==="Tab"?Er(t,n):e.key==="Escape"?Sr(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Tr(t,e.target))}function Er(e,t){for(;E.length&&e-E[0].ts>gr;)E.shift();E.length>=50&&(E=E.slice(-25));let n=t?m(t):"";if(E.push({ts:e,el:n}),E.length>=hr){let r=E.map(i=>i.el).filter(Boolean);l({t:"sig",ts:e,d:{s:"tab_thrash",cnt:E.length,els:r}}),E=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');o&&(o===B?e-ut<=vr?(A++,A>=xn&&(l({t:"sig",ts:e,d:{s:"focus_trap",container:m(o),attempts:A}}),A=0,B=null)):(ut=e,A=1):(B=o,ut=e,A=1))}function Sr(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');n&&n===B&&(A++,A>=xn&&(l({t:"sig",ts:e,d:{s:"focus_trap",container:m(n),attempts:A}}),A=0,B=null))}function Tr(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(;M.length&&e-M[0].ts>br;)M.shift();M.length>=50&&(M=M.slice(-25)),M.push({ts:e,container:n});let o=M.filter(r=>r.container===n);o.length>=wr&&(l({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:m(n),keys:o.length}}),M=[])}var U=0,he=0,ge=null,ft=0,ve=!1,Mr=4,Ar=3e3,Ln=d(xr);function mt(){window.addEventListener("scroll",Ln,{passive:!0})}function pt(){window.removeEventListener("scroll",Ln),U=0,he=0,ge=null,ft=0,ve=!1}function xr(){ve||(ve=!0,requestAnimationFrame(()=>{ve=!1,kr()}))}function kr(){let e=Date.now(),t=window.scrollY,n=t-he;if(Math.abs(n)<2){he=t;return}let o=n>0?"down":"up";ge&&o!==ge&&(e-ft>Ar&&(U=0,ft=e),U++,U>=Mr&&Math.abs(n)>100&&(l({t:"sig",ts:e,d:{s:"scroll_hijack",rev:U}}),U=0)),ge=o,he=t}var H=0,we=!1,_n=d(Lr),Rn=S(Dn),ne=null;function ht(){window.addEventListener("scroll",_n,{passive:!0}),window.addEventListener("pagehide",Rn),ne=S(()=>{document.visibilityState==="hidden"&&Dn()}),document.addEventListener("visibilitychange",ne)}function gt(){window.removeEventListener("scroll",_n),window.removeEventListener("pagehide",Rn),ne&&(document.removeEventListener("visibilitychange",ne),ne=null),H=0,we=!1}function vt(){H=0}function Lr(){we||(we=!0,requestAnimationFrame(()=>{we=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>H&&(H=t)}}))}function Dn(){H>.05&&l({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(H*100)/100}})}var Cn=1500,On=15e3,_r=5e3,Rr=.15,bt="",z=0,wt=0,oe=0,q=0,yt=0,be=null,ye=!1,Ee=d(Cr),Nn=d(Or),j=d(Dr);function Et(){ye||(ye=!0,yt=In(),re(),document.addEventListener("mouseenter",Ee,!0),document.addEventListener("mouseleave",Ee,!0),document.addEventListener("click",j,{capture:!0,passive:!0}),document.addEventListener("keydown",j,{capture:!0,passive:!0}),document.addEventListener("scroll",j,{passive:!0}),window.addEventListener("resize",Nn,{passive:!0}))}function St(){ye&&(ye=!1,document.removeEventListener("mouseenter",Ee,!0),document.removeEventListener("mouseleave",Ee,!0),document.removeEventListener("click",j,{capture:!0}),document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("scroll",j),window.removeEventListener("resize",Nn),Pn(),bt="",z=0,q=0,oe=0)}function re(){Pn(),be=setTimeout(()=>{l({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:On}})},On)}function Dr(){re()}function Cr(e){let t=e.target;if(!t)return;let n=m(t),o=Date.now();(n!==bt||o-wt>Cn)&&(bt=n,wt=o,z=0),z+=1,!(z<4)&&(l({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:z,window_ms:Cn}}),z=0,wt=o)}function Or(){let e=Date.now(),t=In(),n=yt||t,o=Math.abs(t-n)/Math.max(n,1);yt=t,!(o<Rr)&&((!oe||e-oe>_r)&&(oe=e,q=0),q+=1,!(q<3)&&(l({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:q,area_delta:Math.round(o*1e3)/1e3}}),q=0,oe=e))}function In(){return Math.max(1,window.innerWidth*window.innerHeight)}function Pn(){be&&(clearTimeout(be),be=null)}var Nr="https://api.flusterduck.com/v1/ingest",_=!1,Se=null,ie=null;function Ir(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 Tt(e){if(_||!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&&Pr()){ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){ie=e;return}ie=e,_=!0;let t=At(e.cookieless??!1),n=Ir(e.endpoint)??Nr,o=De(location.pathname,e.pageRules??[]),r=Fr(e.domMode);Ft(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=document.referrer,c="";if(i)try{c=new URL(i).origin+new URL(i).pathname}catch{c=""}l({t:"pv",ts:Date.now(),d:{ref:c}});let s=e.ignoreElements??[],a=u=>e.signals?.[u]?.enabled!==!1;if(a("rageClick")&&Oe(e.signals?.rageClick,s),a("deadClick")&&Ie(s),a("speedFrustration")){let u=e.signals?.speedFrustration;Be(u?{delayMs:u.windowMs}:void 0,s)}if(e.trackMouse!==!1&&a("thrashCursor")&&ze(e.signals?.thrashCursor),a("loopNav")&&Ve(e.signals?.loopNav),a("scrollBounce")&&Ge(),e.trackForms!==!1&&(a("formHesitation")||a("formAbandon"))){let u=e.signals?.formHesitation;tt(u?{pauseMs:u.threshold}:void 0,s)}a("errorEncounter")&&rt(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&at(s),(a("tabThrash")||a("focusTrap")||a("keyboardNavFrustration"))&&lt(),a("scrollHijack")&&mt(),a("scrollDepthAbandon")&&ht(),a("advancedHeuristics")&&Et(),Se=Ht(S((u,f)=>{R(),Ze(),ot(),vt(),re();let p=De(f,e.pageRules??[]);Re({page:p,url:u}),Xe(f),l({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function Fn(e,t){if(!_||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);l({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Bn(e,t={}){if(!_||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||l({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Un(e){if(!_||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}Re({segment:t})}function Hn(e){e&&ie&&!_?Tt(ie):e||(Te(),ke())}function zn(){Te(),ke()}function Te(){_&&(Ne(),Pe(),Ue(),qe(),Ye(),Je(),nt(),it(),ct(),dt(),pt(),gt(),St(),Bt(),Se&&(Se(),Se=null),_=!1)}function Pr(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Fr(e){return e==="metadata"||e==="snapshot"?e:"off"}
1
+ "use strict";var an=Object.defineProperty;var Zs=Object.getOwnPropertyDescriptor;var Qs=Object.getOwnPropertyNames;var Js=Object.prototype.hasOwnProperty;var ea=(e,t)=>{for(var n in t)an(e,n,{get:t[n],enumerable:!0})},ta=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qs(t))!Js.call(e,r)&&r!==n&&an(e,r,{get:()=>t[r],enumerable:!(o=Zs(t,r))||o.enumerable});return e};var na=e=>ta(an({},"__esModule",{value:!0}),e);var td={};ea(td,{destroy:()=>on,identify:()=>Ys,init:()=>Tr,optOut:()=>$s,setConsent:()=>js,signal:()=>zs,track:()=>Xs});module.exports=na(td);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var ln="_fd_s";var oa=/^[0-9a-f]{32}$/;function Mr(e){if(e)return xr();let t=ra(ln);if(t&&oa.test(t))return t;let n=xr();return Ar(ln,n,30),n}function cn(){Ar(ln,"",-1)}function xr(){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 ra(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Ar(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var ia=/^[:\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="${De(t)}"]`;if(e.id&&!ia.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,sa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,aa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!aa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!sa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}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 Rr(e,t){if(t==="off")return null;if(t==="metadata")return la(e);let n=ca(e);return n?{mode:"snapshot",...n}:null}function la(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:Dr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Dr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:ua(e)}}}function ca(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:fa(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:o?p(o):"",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:da(t),animations:i,siblings:r}}catch{return null}}function Dr(e,t){return e&&t.includes(e)?e:null}function ua(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 da(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function fa(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 Or=7e3,pa=500,ma=1e4,Nr=50,Pr=100,ga=3,Ie=6e4,bt="application/json",ha="application/json; encoding=gzip",ae=[],$=null,Hr="",Fr=Or,Br=Nr,_=null,yt={domMode:"off",compression:"auto"},un=!1,fn=null,pn=!1;function mn(e){fn=e}function gn(e){pn=e}var va=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Ea=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),wa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ba(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>wa.has(n))}var ya=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Vr=f(_a),qr=y(()=>J());function Wr(e,t,n,o,r){Hr=e,_=Object.assign(Object.create(null),t),yt={domMode:Da(r?.domMode),compression:Ra(r?.compression)},Fr=Math.max(pa,Math.min(n??Or,ma)),Br=Math.max(1,Math.min(o??Nr,Pr)),document.addEventListener("visibilitychange",Vr),window.addEventListener("pagehide",qr)}function d(e){pn||ae.length>=Pr||(ae.push(e),ae.length>=Br?J():$||($=setTimeout(J,Fr)))}function J(){Sa()}async function Sa(){if(un||!ae.length||!_)return;un=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];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:yt.domMode},n=e.map(r=>ka(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await dn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await dn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await dn({...t,events:o})}catch{}finally{un=!1}}function hn(e){if(_)for(let t of Object.keys(e))va.has(t)&&(_[t]=e[t])}function Ur(){J(),pn=!1,document.removeEventListener("visibilitychange",Vr),window.removeEventListener("pagehide",qr),$&&(clearTimeout($),$=null)}function _a(){document.visibilityState==="hidden"&&J()}async function dn(e){let t=JSON.stringify(e),n=await Ta(t,yt.compression);n&&zr(n,0)}async function Ta(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await La(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ha}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function La(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=Ca(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function Ca(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function zr(e,t,n=Hr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<ga&&setTimeout(()=>zr(e,t+1,n),1e3*(t+1))})}catch{}}function ka(e,t,n){let o=e.d??{},r=xa(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Ir(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Ir(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Aa(s,n):null;u&&(i.dom=u),i.signal_type&&fn&&fn(i.signal_type)}let a=Ma(o);return Object.keys(a).length&&(i.metadata=a),i}function xa(e){return e==="pv"?"pageview":e==="sig"?"signal":Ea.has(e)?e:"custom_signal"}function Ma(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 o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!ba(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 ya.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Aa(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Rr(n,t):null}catch{return null}}function Ir(...e){for(let t of e)if(typeof t=="string"&&t)return t}function Da(e){return e==="metadata"||e==="snapshot"?e:"off"}function Ra(e){return e==="off"?"off":"auto"}function Xr(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.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=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function vn(e,t){for(let n of t){let o=Oa(n.pattern);if(o&&o.test(e))return n.label}return Na(e)}var Ia=/^[a-zA-Z0-9/:._*\-]+$/;function Oa(e){if(e.length>200||!Ia.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Na(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Pa=[".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"]'],P=[],Yr=3,jr=2e3,En=8,$r=[],le=[],Kr=0,_t=new Map,Tt=new Map,Ha=1e4,Lt=!1,Gr=f(Fa);function wn(e,t){Lt||(Lt=!0,Yr=e?.threshold??3,jr=e?.windowMs??2e3,$r=[...Pa,...t??[]],Kr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",Gr,{capture:!0,passive:!0}))}function bn(){Lt&&(Lt=!1,document.removeEventListener("click",Gr,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Fa(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$r)||Wa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>jr;)P.shift();P.push({t:n,x:o,y:r});let i=Ba();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>En*En)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=qa(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=Va(n),Lr=_t.get(b)??0,rn=Lr+1,Cr=Tt.get(b)??0,Ks=Cr>0&&n-Cr<Ha;_t.set(b,rn),Tt.set(b,n);let kr=Lr>=1,Gs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,sn)=>se+sn.x,0)/s.length,vt=s.reduce((se,sn)=>se+sn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:kr,hot_repeat:Ks,...Gs??{}}}),kr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:rn,burst_count:rn,burst_seq:U}}),P=P.slice(-(i-1))}function Ba(){return le.length>=3?2:Yr}function Va(e){let t=(e-Kr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function qa(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/En*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Wa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Ua=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,za=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Xa=/^(A|BUTTON|LABEL)$/,Ya=20,Zr=[],ce=null,ja=5,Ct=new Map,Qr=f($a),Jr=f(Za);function $a(e){ce={x:e.clientX,y:e.clientY}}function yn(e){Zr=e??[],document.addEventListener("mousedown",Qr,{capture:!0,passive:!0}),document.addEventListener("click",Jr,{capture:!0,passive:!0})}function Sn(){document.removeEventListener("mousedown",Qr,{capture:!0}),document.removeEventListener("click",Jr,{capture:!0}),ce=null,Ct.clear()}function _n(){Ct.clear()}function Ka(e){try{return window.getComputedStyle(e).cursor.slice(0,Ya)}catch{return""}}function Ga(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Za(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Zr)||tl())return;let n=nl(e);if(ce=null,n||Qa(t))return;let o=Ja(t,e.clientX,e.clientY),r=o?ei(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ka(t),c=Ga(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Qa(e){if(Ua.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&za.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&&Xa.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Ja(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=el(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function ei(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function el(e,t,n){return ei(e,t,n).dist}function tl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function nl(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>ja}var T=null,Tn=3e3,ti=[],kt="click",xt=0,ol=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,rl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ni=f(al),oi=f(il),ri=f(sl);function Ln(e,t){Tn=e?.delayMs??3e3,ti=t??[],document.addEventListener("click",ni,{capture:!0,passive:!0}),document.addEventListener("keydown",oi,{capture:!0,passive:!0}),document.addEventListener("touchstart",ri,{capture:!0,passive:!0})}function Cn(){document.removeEventListener("click",ni,{capture:!0}),document.removeEventListener("keydown",oi,{capture:!0}),document.removeEventListener("touchstart",ri,{capture:!0}),ue()}function kn(){ue()}function il(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function sl(){kt="touch",xt=Date.now()}function al(e){let t=e.target;if(!t||v(t,ti))return;let n=t.getAttribute("role");if(!ol.test(t.tagName)&&!(n&&rl.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Tn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Tn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var ll=100,cl=5,ii=800,si=2e3,ul=3,Mn=0,dl=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,xn=0,ee=[],An=0,de=null,ai=f(fl);function Dn(e){ii=e?.velocityThreshold??800,si=e?.windowMs??2e3,document.addEventListener("mousemove",ai,{passive:!0})}function Rn(){document.removeEventListener("mousemove",ai),de&&clearTimeout(de),In()}function fl(e){let t=Date.now();t-Mn<dl||(Mn=t,de&&clearTimeout(de),de=setTimeout(()=>In(),150),pl(e.clientX,e.clientY,t))}function pl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,xn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=ll&&(ee=ee.slice(-50)),ee.push(a),An+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=cl&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-xn>si){if(Dt>=ul){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=ii&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(An)}})}In(),xn=n}}function In(){Dt=0,ee=[],An=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,Mn=0,de=null}var li=100,ci=5,ml=3,L=[],x=[],On=3e4;function Nn(e){On=e?.windowMs??3e4}function Pn(){L=[],x=[]}function Hn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>On;)L.shift();for(;x.length&&t-x[0].ts>On;)x.shift();if(L.length>=li&&(L=L.slice(-50)),x.length>=li&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=ml&&a.length>u.size){let l=a.slice(-ci).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});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 u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ci).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var gl=100,ui=1e4,Bn=.5,C=[],Rt=0,Vn=0,He=!1,Fn=0,di=f(hl);function qn(e){ui=e?.windowMs??1e4,Bn=e?.depthThreshold??.5,window.addEventListener("scroll",di,{passive:!0})}function Wn(){window.removeEventListener("scroll",di),C=[],He=!1}function Un(){C=[],Rt=0,Vn=0,He=!1}function hl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,vl()}))}function vl(){let e=Date.now(),t=window.scrollY;if(Fn=document.documentElement.scrollHeight-window.innerHeight,Fn<=0)return;let n=t/Fn,o=t>Rt?"down":"up";if(e-Vn<100){Rt=t;return}for(;C.length&&e-C[0].ts>ui;)C.shift();C.length>=gl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Vn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Bn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Bn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var El=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,zn=0,fi=5e3,pi=[],wl=50,mi=f(bl),gi=f(yl),hi=f(Sl),vi=y(Ei),Fe=null;function Xn(e,t){fi=e?.pauseMs??5e3,pi=t??[],document.addEventListener("focusin",mi,{capture:!0,passive:!0}),document.addEventListener("focusout",gi,{capture:!0,passive:!0}),document.addEventListener("submit",hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",vi),Fe=y(()=>{document.visibilityState==="hidden"&&Ei()}),document.addEventListener("visibilitychange",Fe)}function Yn(){document.removeEventListener("focusin",mi,{capture:!0}),document.removeEventListener("focusout",gi,{capture:!0}),document.removeEventListener("submit",hi,{capture:!0}),window.removeEventListener("pagehide",vi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function jn(){Be.clear(),Ve.clear(),z.clear(),te=null,zn=0}function bl(e){let t=e.target;if(!t||!wi(t)||v(t,pi)||_l(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,zn=o.querySelectorAll("input, select, textarea").length)}function yl(e){let t=e.target;if(!t||!wi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<wl)&&n!==void 0){let a=r-n;if(a>=fi){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Tl(t)&&z.add(s)}function Sl(){z.clear(),te=null}function Ei(){if(z.size>0&&te){let e=zn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function wi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function _l(e){if(e.tagName==="TEXTAREA")return!0;for(let t of El)try{if(e.matches(t))return!0}catch{return!1}return!1}function Tl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,bi=/flusterduck\.com|\/v1\/ingest/,Si=f(kl),_i=f(xl);function Kn(){window.addEventListener("error",Si),window.addEventListener("unhandledrejection",_i),Ml()}function Gn(){window.removeEventListener("error",Si),window.removeEventListener("unhandledrejection",_i),Al()}var $n=/fetch|network|cors|timeout/i;function Ll(e){return $n.test(e)?"network":"script"}function Cl(e){if(e instanceof TypeError&&$n.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return $n.test(t)?"network":"unhandled_promise"}function kl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Zn(t,200),ep:"",status:0,error_category:Ll(t),url:location.pathname}})}function xl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Zn(t,200),ep:"",status:0,error_category:Cl(e.reason),url:location.pathname}})}function Ml(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:yi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Zn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?yi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function Al(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function yi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Zn(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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Ti=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Dl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null,Li=[],Ci=f(Rl),ki=f(Il),xi=f(Pl),Mi=f(Bl),Ai=f(Hl);function eo(e){Li=e??[],document.addEventListener("touchstart",Ci,{passive:!0}),document.addEventListener("touchend",ki,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",xi,{passive:!0}),window.addEventListener("orientationchange",Mi,{passive:!0})),window.visualViewport?.addEventListener("resize",Ai)}function to(){document.removeEventListener("touchstart",Ci),document.removeEventListener("touchend",ki),document.removeEventListener("gesturechange",xi),window.removeEventListener("orientationchange",Mi),window.visualViewport?.removeEventListener("resize",Ai),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null}function Di(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function Rl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Di(e.touches),K=null)}function Il(e){if(me>0){let s=e.touches.length>=2?Di(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Ol(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&Nl(i,n,o),K=null}function Ol(e,t,n){if(v(e,Li))return;let o=Vl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function Nl(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Ti.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Ti.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Pl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!Dl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Hl(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Fl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Bl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Qn>3e4&&(pe=0,Qn=e),t!==Jn&&(pe++,Jn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Fl()}}),pe=0)}function Vl(e,t,n){let r=(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<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],no=[],ql=10,Wl=5e3,Ri=5,Ii=3e3,Ul=15,zl=5e3,Oi=f(Xl);function oo(e){no=e??[],document.addEventListener("keydown",Oi,{capture:!0,passive:!0})}function ro(){document.removeEventListener("keydown",Oi,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",no=[]}function Xl(e){let t=Date.now(),n=e.target;n&&v(n,no)||(e.key==="Tab"?jl(t,n,e.shiftKey):e.key==="Escape"?$l(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Kl(t,e.target))}function Yl(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function jl(e,t,n){for(;M.length&&e-M[0].ts>Wl;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=ql){let i=M.map(a=>a.el).filter(Boolean),s=Yl(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Ii?(A++,F=i,A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function $l(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===ge){if(e-he>Ii){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Kl(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(;H.length&&e-H[0].ts>zl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Ul&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Gl=1e4,Zl=2,Ql=4,Jl=3e3,Xe=null,Ht=0,ec=2e3,Ni=f(oc),Pi=f(tc),Hi=f(nc);function ao(){window.addEventListener("wheel",Pi,{passive:!0}),window.addEventListener("touchmove",Hi,{passive:!0}),window.addEventListener("scroll",Ni,{passive:!0})}function lo(){window.removeEventListener("wheel",Pi),window.removeEventListener("touchmove",Hi),window.removeEventListener("scroll",Ni),Ft()}function Ft(){ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Xe=null,Ht=0}function tc(){Xe="wheel",Ht=Date.now()}function nc(){Xe="touch",Ht=Date.now()}function oc(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,rc()}))}function rc(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-io>Jl&&(ve=0,io=e),ve++,ve>=Ql&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=ec?Xe:"wheel";e-so>Gl&&(Pt=0,so=e),Pt++;let a=Pt>=Zl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Bi=f(ic),je=null,$e=null;function co(){window.addEventListener("scroll",Bi,{passive:!0}),$e=y(Fi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Fi()}),document.addEventListener("visibilitychange",je)}function uo(){window.removeEventListener("scroll",Bi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function fo(){ne=0,Ee=0,Ye=!1}function ic(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Fi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Vi=1500,qi=15e3,sc=5e3,ac=.15,po="",we=0,Bt=0,Ke=0,be=0,mo=0,Vt=null,qt=0,Wt=!1,Ut=f(cc),Wi=f(uc),ye=f(lc);function go(){Wt||(Wt=!0,mo=Ui(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Wi,{passive:!0}))}function ho(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Wi),zi(),po="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){zi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:qi,cycle:e}})},qi)}function vo(){qt=0}function lc(){Ge()}function cc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==po||o-Bt>Vi)&&(po=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Vi}}),we=0,Bt=o)}function uc(){let e=Date.now(),t=Ui(),n=mo||t,o=Math.abs(t-n)/Math.max(n,1);mo=t,!(o<ac)&&((!Ke||e-Ke>sc)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function Ui(){return Math.max(1,window.innerWidth*window.innerHeight)}function zi(){Vt&&(clearTimeout(Vt),Vt=null)}var Xi=6e4,dc=3,fc=["[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"]'],pc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],Yi=[],ji=f(mc);function Eo(e){Yi=e??[],document.addEventListener("click",ji,{capture:!0,passive:!0})}function wo(){document.removeEventListener("click",ji,{capture:!0}),B=[]}function bo(){B=[]}function mc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yi)||!gc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Xi;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<dc)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Xi}}),B=[]}function gc(e){let t=e;for(let n=0;n<3&&t;n++){if(hc(t)||vc(t))return!0;t=t.parentElement}return!1}function hc(e){for(let t of fc)try{if(e.matches(t))return!0}catch{}return!1}function vc(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return pc.test(o)}var $i=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Ki=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,Gi=[],Zi=f(Ec);function yo(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0})}function So(){document.removeEventListener("click",Zi,{capture:!0}),zt=[],Xt.clear()}function _o(){zt=[],Xt.clear()}function Ec(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Gi)||!wc(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:yc(t),...u??{}}})}function wc(e){let t=e;for(let n=0;n<4&&t;n++){if(bc(t))return!0;t=t.parentElement}return!1}function bc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&Ki.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if($i.test(r)||$i.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&Ki.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 u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function yc(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,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var Sc=1500,I=null,Qi=[],Ji=f(_c),es=f(Tc),ts=f(Lc);function To(e){Qi=e??[],document.addEventListener("click",Ji,{capture:!0,passive:!0}),document.addEventListener("keydown",es,{capture:!0,passive:!0}),window.addEventListener("popstate",ts)}function Lo(){document.removeEventListener("click",Ji,{capture:!0}),document.removeEventListener("keydown",es,{capture:!0}),window.removeEventListener("popstate",ts),I=null}function Co(){I=null}function _c(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Qi)){if(Cc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function Tc(e){e.key==="Escape"&&ns("escape")}function Lc(){ns("back_nav")}function ns(e){if(!I)return;let t=Date.now()-I.t;if(t>Sc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function Cc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var os=1e4,kc=3,xc=/^(checkbox|radio)$/,rs=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,ko=[],is=f(Mc),ss=f(Ac);function xo(e){ko=e??[],document.addEventListener("change",is,{capture:!0,passive:!0}),document.addEventListener("click",ss,{capture:!0,passive:!0})}function Mo(){document.removeEventListener("change",is,{capture:!0}),document.removeEventListener("click",ss,{capture:!0}),Ze.clear()}function Ao(){Ze.clear()}function Mc(e){let t=e.target;t&&(v(t,ko)||Dc(t)&&as(t))}function Ac(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ko))return;let n=t.getAttribute("role")??"";rs.test(n)&&t.tagName!=="INPUT"&&as(t)}function as(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>os;)o.shift();if(o.push({t:n}),o.length<kc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:os}}),Ze.delete(t)}function Dc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?xc.test(e.type??""):rs.test(e.getAttribute("role")??"")}var ls=15e3,Rc=3,X=[],cs=f(Ic);function Do(){document.addEventListener("copy",cs,{capture:!0,passive:!0})}function Ro(){document.removeEventListener("copy",cs,{capture:!0}),X=[]}function Io(){X=[]}function Ic(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ls;)X.shift();X.push({t:o}),!(X.length<Rc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ls}}),X=[])}var us=15e3,Oc=4,Nc=5,Pc=500,Hc=2e3,D=[],Yt=0,Qe=null,oe=null;function Oo(){Qe=y(Bc),oe=y(Fc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function No(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Po(){D=[],Yt=0}function Fc(){Yt=Date.now(),D=[]}function Bc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<Nc)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Hc)return;for(;D.length&&o-D[0].t>us;)D.shift();let r=D[D.length-1];r&&o-r.t<Pc||(D.push({t:o}),!(D.length<Oc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:us}}),D=[]))}var Ho=6e4,Vc=20,fs="_fd_sess",qc={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},Wc=10,ds={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Fo="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ps(e,Date.now())}function Uc(){try{let e=sessionStorage.getItem(fs);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function zc(){try{sessionStorage.setItem(fs,JSON.stringify(_e))}catch{}}function Xc(){let e=[],n=Date.now()-Ho,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ps(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>Vc&&n.shift()}function Yc(e){let t=e-Ho,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function jc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=qc[n.type]??Wc;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function ms(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function $c(e,t,n){return ms(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Kc(e,t,n,o){let r=ms(o),i=Xc();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Fo||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:Ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,zc()}function Gc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Yc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ps(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=jc(),i=$c(n.size,o,r);i&&(Se!==null&&ds[i]<=ds[Se]||(Se=i,Kc(i,n,o,r)))}function Bo(e){Fo=e}function Vo(e){V=[],Se=null,$t=!0,Te=new Map,Fo=e??"",Uc(),mn(Gc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function qo(){$t=!1,V=[],Se=null,Te=new Map,mn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Zc=8,Wo=3e4,Uo=5,Qc=5e3,O=[],G="",ot=!1,gs=f(eu),hs=f(tu);function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",gs),window.addEventListener("hashchange",hs)}function Xo(){window.removeEventListener("popstate",gs),window.removeEventListener("hashchange",hs),O=[],ot=!1,G=""}function Yo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Wo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<Uo)&&(ot||Jc(t))}function Jc(e){let t=O.filter(c=>e-c.ts<=Wo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<Uo||n.length===0||n.some(c=>c.leftAt-c.ts>=Qc)||new Set(n.map(c=>c.path)).size<Uo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Zc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Wo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function eu(){let e=location.pathname+location.search+location.hash;rt(e)}function tu(){let e=location.pathname+location.search+location.hash;rt(e)}var nu=.3,vs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,Es=f(ou),ws=f(iu);function jo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",Es,{passive:!0}),window.addEventListener("click",ws,{capture:!0})}function $o(){window.removeEventListener("scroll",Es),window.removeEventListener("click",ws,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function ou(){it||(it=!0,requestAnimationFrame(ru))}function ru(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>vs&&(N=!1),re==="down"){let s=ie-t,a=n*nu;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function iu(e){if(!N)return;let t=Date.now();if(t-at>vs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var su=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,au=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,lu=/^(A|BUTTON|LABEL)$/,cu=3,bs=9e4,uu=5,lt=new Map,ys=[],ct=null,du=5,Ss=f(fu),_s=f(Eu);function fu(e){ct={x:e.clientX,y:e.clientY}}function Ko(e){ys=e??[],document.addEventListener("mousedown",Ss,{capture:!0,passive:!0}),document.addEventListener("click",_s,{capture:!0,passive:!0})}function Go(){document.removeEventListener("mousedown",Ss,{capture:!0}),document.removeEventListener("click",_s,{capture:!0}),ct=null,lt.clear()}function Zo(){lt.clear()}function pu(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 mu(e,t){return e*4+t}function gu(e){if(su.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&au.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&&lu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function hu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function vu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>du}function Eu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ys)||hu()||vu(e)||gu(t))return;let{row:n,col:o}=pu(e.clientX,e.clientY),r=mu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<bs);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=cu){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=uu))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:bs}}),lt.set(r,[])}}var Qo=3,Le=12e4,S=new Map,Zt=[],ut=null,Ts=f(_u),Gt=f(Tu);function er(e){Zt=e??[],document.addEventListener("invalid",Ts,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(Lu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function tr(){document.removeEventListener("invalid",Ts,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function nr(){for(let e of S.values())Z(e);S.clear()}function Jo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function or(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 Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function wu(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function bu(e){return f(t=>{ks(e)})}function yu(e){return f(t=>{ks(e)})}function Ls(e,t){let n=bu(t),o=yu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Cs(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();wu(t);let n=p(e),o=S.get(n);if(!o){Ls(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n)))}function Su(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function ks(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,or(n.el)){n.cycles+=1,n.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Jo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function _u(e){let t=e.target;t&&Cs(t)}function Tu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||or(t)&&Ls(t,n)}function Lu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=or(n);i&&!r?Cs(n):!i&&r&&Su(n)}}var Ce=null,dt=null,ir=[],xs=0,ft=new Map;function sr(e){ir=e?.length?e:["[data-fd-impression]"],xs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(ku),{threshold:[0,.5,1]}),Ms(),dt=new MutationObserver(y(Cu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ar(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function lr(){ft.clear(),Ce&&Ms()}function Ms(){for(let e of ir)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)rr(t[n])}catch{}}function rr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function Cu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of ir)try{o.matches(r)&&rr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)rr(i[s])}catch{}}}function ku(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-xs),viewport_position:s}})}}}var xu=2,Mu=3,Au=6e4,pt=new Map,As=[],Ds=f(Du);function cr(e){As=e??[],document.addEventListener("input",Ds,{capture:!0,passive:!0})}function ur(){document.removeEventListener("input",Ds,{capture:!0}),pt.clear()}function dr(){pt.clear()}function Du(e){let t=e.target;if(!t||!Ru(t)||v(t,As))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Au){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=Mu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=xu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:Iu(t)}}),pt.delete(r);return}i.lastValue=o}function Ru(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 Iu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Rs=2e3,Ou=3e4,q=null,Is=Rs,Os=[],Jt=new Map,Ns=f(Nu),Ps=f(Pu),Hs=f(mt);function fr(e,t){Is=e?.dwellMs??Rs,Os=t??[],document.addEventListener("mouseover",Ns,{passive:!0}),document.addEventListener("mouseout",Ps,{passive:!0}),document.addEventListener("click",Hs,{capture:!0,passive:!0})}function pr(){document.removeEventListener("mouseover",Ns),document.removeEventListener("mouseout",Ps),document.removeEventListener("click",Hs,{capture:!0}),mt(),Jt.clear()}function mr(){mt(),Jt.clear()}function Nu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Os)||!Hu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Ou)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Is);q={el:t,selector:n,startTs:r,timer:i}}function Pu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Hu(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 o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Fu=20,Bu=500,Vu=3e3,qu=6e4,en=0,tn=0,W=null,Fs=y(Wu);function gr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Fs)}function hr(){document.removeEventListener("mouseleave",Fs),W&&(clearTimeout(W),W=null)}function vr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Wu(e){if(e.clientY>Fu)return;let t=Date.now();t-en<Vu||t-tn<qu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),Bu))}var Uu=2500,zu=4e3,Bs=200,Xu=500,Yu=.1,ju=.25,xe=null,Me=null,j=null,ke=0;function Er(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function wr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Er(o,Uu,zu)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Bs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:Er(o,Bs,Xu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Vs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Er(ke,Yu,ju)}})}ke=0}}function br(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Vs()}function yr(){if(Vs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var qs=[],Ws=f($u);function Sr(e){qs=e??[],document.addEventListener("paste",Ws,{capture:!0,passive:!0})}function _r(){document.removeEventListener("paste",Ws,{capture:!0})}function $u(e){let t=e.target;if(!t||!Ku(t)||v(t,qs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Gu(t)}})},100)}function Ku(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 Gu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Zu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Qu(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 Tr(e){if(Q||!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&&Ju()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=Mr(e.cookieless??!1),n=Qu(e.endpoint)??Zu,o=vn(location.pathname,e.pageRules??[]),r=ed(e.domMode);Wr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=Us(location.pathname,e.ignorePages??[]);i&&gn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&wn(e.signals?.rageClick,u),l("deadClick")&&yn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;Ln(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Dn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&Nn(e.signals?.loopNav),l("scrollBounce")&&qn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Xn(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&er(u)}if(l("errorEncounter")&&Kn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&eo(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&oo(u),l("scrollHijack")&&ao(),l("scrollDepthAbandon")&&co(),l("advancedHeuristics")&&go(),l("helpHunt")&&Eo(u),l("closeClick")&&yo(u),l("closeClickReversal")&&To(u),l("filterSpiral")&&xo(u),l("copyFrustration")&&Do(),l("textSelectFrustration")&&Oo(),l("deadClickTrapZone")&&Ko(u),Vo(o),l("navigationConfusion")&&zo(),l("scrollToClickConfusion")&&jo(),l("elementImpression")&&sr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&cr(u),e.trackForms!==!1&&l("pasteBlocked")&&Sr(u),l("hoverDwell")){let c=e.signals?.hoverDwell;fr(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&gr(),l("performanceVitals")&&wr(),nn=Xr(y((c,m)=>{J(),Un(),jn(),fo(),kn(),Ge(),vo(),bo(),_o(),Co(),Ao(),Io(),Po(),Zo(),nr(),_n(),Ft(),Kt(),Yo(),lr(),dr(),mr(),vr(),yr(),rt(m),Bo(m);let E=vn(m,e.pageRules??[]),w=Us(m,e.ignorePages??[]);gn(w),hn({page:E,url:c}),Hn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function zs(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Xs(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Ys(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}hn({segment:t})}function js(e){e&&gt&&!Q?Tr(gt):e||(on(),cn())}function $s(){on(),cn()}function on(){Q&&(bn(),Sn(),Cn(),Rn(),Pn(),Wn(),Yn(),Gn(),to(),ro(),lo(),uo(),ho(),wo(),So(),Lo(),Mo(),Ro(),No(),Go(),tr(),qo(),Xo(),$o(),ar(),ur(),pr(),hr(),br(),_r(),Ur(),nn&&(nn(),nn=null),Q=!1)}function Ju(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ed(e){return e==="metadata"||e==="snapshot"?e:"off"}function Us(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}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function S(e){return((...t)=>{try{return e(...t)}catch{}})}function d(e){return t=>{try{e(t)}catch{}}}var Me="_fd_s";var Pn=/^[0-9a-f]{32}$/;function Tt(e){if(e)return St();let t=Fn(Me);if(t&&Pn.test(t))return t;let n=St();return Mt(Me,n,30),n}function Ae(){Mt(Me,"",-1)}function St(){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 Fn(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Mt(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var Bn=/^[:\d]|--|^(ember|react|ng-|__)/;function m(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Y(t)}"]`;if(e.id&&!Bn.test(e.id)&&e.id.length<64)return"#"+Y(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),c=o.getAttribute("name"),s=o.getAttribute("role"),a=o.getAttribute("type");c&&c.length<64?i+=`[name="${Y(c)}"]`:s?i+=`[role="${Y(s)}"]`:a&&(i==="input"||i==="button")&&(i+=`[type="${Y(a)}"]`);let u=o.parentElement;if(u){let p=u.children,w=0,V=0;for(let O=0;O<p.length;O++){let Te=p[O];Te&&Te.tagName===o.tagName&&(w++,Te===o&&(V=w))}w>1&&(i+=`:nth-of-type(${V})`)}n.unshift(i);let f=n.join(" > ");try{if(document.querySelectorAll(f).length===1)return f}catch{}o=u,r++}return n.join(" > ")}function Y(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}function b(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 xt(e,t){if(t==="off")return null;if(t==="metadata")return Un(e);let n=Hn(e);return n?{mode:"snapshot",...n}:null}function Un(e){return{mode:"metadata",selector:m(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:At(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:At(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:zn(e)}}}function Hn(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let c=0;c<o.children.length&&r.length<6;c++){let s=o.children[c];if(!s||s===e)continue;let a=s.getBoundingClientRect();r.push({selector:m(s),tag:s.tagName.toLowerCase(),box:{x:Math.round(a.x),y:Math.round(a.y),w:Math.round(a.width),h:Math.round(a.height)},interactive:jn(s)})}let i=[];try{let c=e.getAnimations();for(let s of c)"animationName"in s&&i.push(s.animationName)}catch{}return{selector:m(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?m(o):"",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:qn(t),animations:i,siblings:r}}catch{return null}}function At(e,t){return e&&t.includes(e)?e:null}function zn(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 qn(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function jn(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 Lt=7e3,Vn=5e3,Yn=1e4,_t=50,Rt=100,Xn=3,X=6e4,se="application/json",$n="application/json; encoding=gzip",N=[],x=null,ae="",Dt=Lt,Ct=_t,v=null,ce={domMode:"off",compression:"auto"},xe=!1,Wn=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Kn=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),Qn=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,Gn=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ot=d(Zn),Nt=S(()=>R());function It(e,t,n,o,r){ae=e,v=Object.assign(Object.create(null),t),ce={domMode:ao(r?.domMode),compression:co(r?.compression)},Dt=Math.max(Vn,Math.min(n??Lt,Yn)),Ct=Math.max(5,Math.min(o??_t,Rt)),document.addEventListener("visibilitychange",Ot),window.addEventListener("pagehide",Nt)}function l(e){N.length>=Rt||(N.push(e),N.length>=Ct?R():x||(x=setTimeout(R,Dt)))}function R(){Jn()}async function Jn(){if(xe||!N.length||!v)return;xe=!0,x&&(clearTimeout(x),x=null);let e=N;N=[];let t={v:1,sid:v.sid,key:v.key,url:v.url,page:v.page,ts:Date.now(),ua:v.ua,vw:v.vw,vh:v.vh,environment:v.environment,dom_mode:ce.domMode},n=e.map(r=>oo(r,v.page,ce.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>X)if(o.length>0)await ke({...t,events:o}),o=[r];else{let s={...t,events:[r]};JSON.stringify(s).length<=X&&await ke(s),o=[]}else o=i}o.length>0&&await ke({...t,events:o})}catch{}finally{xe=!1}}function Le(e){if(v)for(let t of Object.keys(e))Wn.has(t)&&(v[t]=e[t])}function Pt(){R(),document.removeEventListener("visibilitychange",Ot),window.removeEventListener("pagehide",Nt),x&&(clearTimeout(x),x=null)}function Zn(){document.visibilityState==="hidden"&&R()}async function ke(e){let t=JSON.stringify(e),n=await eo(t,ce.compression);n&&Ft(n,0)}async function eo(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>X)return null;if(t!=="off"){let r=await to(e);if(r&&r.byteLength<=X)return{beaconBody:new Blob([r],{type:$n}),fetchBody:new Uint8Array(r),headers:{"Content-Type":se,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:se}),fetchBody:e,headers:{"Content-Type":se}}}async function to(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=no(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),c=[],s=0;for(;;){let f=await i.read();if(f.done)break;if(s+=f.value.byteLength,s>X)return null;let p=new Uint8Array(f.value.byteLength);p.set(f.value),c.push(p)}let a=new Uint8Array(s),u=0;for(let f of c)a.set(f,u),u+=f.byteLength;return a.buffer}catch{return null}}function no(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:se});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function Ft(e,t){if(ae&&!(navigator.sendBeacon&&navigator.sendBeacon(ae,e.beaconBody)))try{fetch(ae,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<Xn&&setTimeout(()=>Ft(e,t+1),1e3*(t+1))})}catch{}}function oo(e,t,n){let o=e.d??{},r=ro(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},c=kt(o.el,o.element,o.target);if(r==="signal"){i.signal_type=kt(o.s,o.signal_type,o.name)?.slice(0,128),c&&(i.element=c.slice(0,2048));let a=c?so(c,n):null;a&&(i.dom=a)}let s=io(o);return Object.keys(s).length&&(i.metadata=s),i}function ro(e){return e==="pv"?"pageview":e==="sig"?"signal":Kn.has(e)?e:"custom_signal"}function io(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 o=ue(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=ue(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function ue(e,t="",n=0){if(!(n>4)&&!Qn.test(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 Gn.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>ue(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=ue(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function so(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?xt(n,t):null}catch{return null}}function kt(...e){for(let t of e)if(typeof t=="string"&&t)return t}function ao(e){return e==="metadata"||e==="snapshot"?e:"off"}function co(e){return e==="off"?"off":"auto"}function Bt(e){let t=location.href;function n(){let s=location.href;s!==t&&(t=s,e(s,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...s){o.apply(this,s),n()},c=function(...s){r.apply(this,s),n()};return history.pushState=i,history.replaceState=c,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===c&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function _e(e,t){for(let n of t){let o=lo(n.pattern);if(o&&o.test(e))return n.label}return fo(e)}var uo=/^[a-zA-Z0-9/:._*\-]+$/;function lo(e){if(e.length>200||!uo.test(e))return null;let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function fo(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var mo=[".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"]'],k=[],Re=3,Ht=2e3,Ut=8,zt=[],qt=d(po);function De(e,t){Re=e?.threshold??3,Ht=e?.windowMs??2e3,zt=[...mo,...t??[]],document.addEventListener("click",qt,{capture:!0,passive:!0})}function Ce(){document.removeEventListener("click",qt,{capture:!0,passive:!0}),k=[]}function po(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||b(t,zt)||ho(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;k.length&&n-k[0].t>Ht;)k.shift();if(k.push({t:n,x:o,y:r}),k.length<Re)return;let i=k.slice(-Re),c=i[0];for(let p=1;p<i.length;p++){let w=i[p],V=w.x-c.x,O=w.y-c.y;if(V*V+O*O>Ut*Ut)return}let s=c.t,u=(i[i.length-1].t-s)/1e3,f=u>0?i.length/u:i.length;l({t:"sig",ts:n,d:{s:"rage_click",el:m(t),cnt:i.length,vel:Math.round(f*10)/10}}),k=[]}function ho(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick"))}var go=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,vo=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,wo=/^(A|BUTTON|LABEL)$/,jt=[],$=null,bo=5,Vt=d(yo),Yt=d(Eo);function yo(e){$={x:e.clientX,y:e.clientY}}function Oe(e){jt=e??[],document.addEventListener("mousedown",Vt,{capture:!0,passive:!0}),document.addEventListener("click",Yt,{capture:!0,passive:!0})}function Ne(){document.removeEventListener("mousedown",Vt,{capture:!0}),document.removeEventListener("click",Yt,{capture:!0}),$=null}function Eo(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||b(t,jt)||Mo()||Ao(e)||So(t))return;let n=To(t,e.clientX,e.clientY),o=n?Xt(e.clientX,e.clientY,n):-1;l({t:"sig",ts:Date.now(),d:{s:"dead_click",el:m(t),near:n?m(n):"",dist:Math.round(o)}})}function So(e){if(go.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&vo.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&&wo.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function To(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let c=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),s=null,a=1/0;for(let u=0;u<c.length;u++){let f=c[u];if(!f||f===e)continue;let p=Xt(t,n,f);p<a&&(a=p,s=f)}if(s&&a<100)return s;o=i}return null}function Xt(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),c=e-r,s=t-i;return Math.sqrt(c*c+s*s)}function Mo(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Ao(e){if(!$)return!1;let t=e.clientX-$.x,n=e.clientY-$.y;return Math.sqrt(t*t+n*n)>bo}var h=null,Ie=3e3,$t=[],xo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,ko=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Wt=d(Lo);function Pe(e,t){Ie=e?.delayMs??3e3,$t=t??[],document.addEventListener("click",Wt,{capture:!0,passive:!0})}function Fe(){document.removeEventListener("click",Wt,{capture:!0}),W()}function Lo(e){let t=e.target;if(!t||b(t,$t))return;let n=t.getAttribute("role");if(!xo.test(t.tagName)&&!(n&&ko.test(n)))return;if(h){if(h.el===t||h.el.contains(t)){let a=Date.now()-h.ts;a>=Ie&&l({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:h.selector,delay:a}}),W();return}W()}let o=m(t),r=!1,i=new MutationObserver(a=>{for(let u of a){if(u.type==="childList"&&(u.addedNodes.length>0||u.removedNodes.length>0)){r=!0,W();return}if(u.type==="attributes"&&u.target instanceof Element&&(u.target===t||t.contains(u.target)||u.target.contains(t))){r=!0,W();return}}}),c=t.parentElement||document.body;i.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let s=setTimeout(()=>{!r&&h&&(h={...h,timeout:null})},Ie+500);h={el:t,selector:o,ts:Date.now(),observer:i,timeout:s}}function W(){h&&(h.observer.disconnect(),h.timeout&&clearTimeout(h.timeout),h=null)}var _o=100,Qt=800,Gt=2e3,Ro=3,Kt=0,Do=16,le=0,de=0,K=0,Q=0,G=0,fe=0,Be=0,D=[],I=null,Jt=d(Co);function Ue(e){Qt=e?.velocityThreshold??800,Gt=e?.windowMs??2e3,document.addEventListener("mousemove",Jt,{passive:!0})}function He(){document.removeEventListener("mousemove",Jt),I&&clearTimeout(I),ze()}function Co(e){let t=Date.now();t-Kt<Do||(Kt=t,I&&clearTimeout(I),I=setTimeout(()=>ze(),150),Oo(e.clientX,e.clientY,t))}function Oo(e,t,n){if(K===0){le=e,de=t,K=n,Be=n;return}let o=(n-K)/1e3;if(o===0)return;let r=e-le,i=t-de;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i)/o;D.length>=_o&&(D=D.slice(-50)),D.push(s);let a=Math.sign(r),u=Math.sign(i);if((Q!==0&&a!==0&&a!==Q||G!==0&&u!==0&&u!==G)&&fe++,Q=a||Q,G=u||G,le=e,de=t,K=n,n-Be>Gt){if(fe>=Ro){let f=D.reduce((p,w)=>p+w,0)/D.length;f>=Qt&&l({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(f),rev:fe}})}ze(),Be=n}}function ze(){fe=0,D=[],Q=0,G=0,K=0,le=0,de=0,I=null}var No=100,g=[],Zt=3e4;function qe(e){Zt=e?.windowMs??3e4}function je(){g=[]}function Ve(e){let t=Date.now();try{let i=performance.getEntriesByType("navigation");if(i.length>0&&i[0].type==="back_forward")return}catch{}for(;g.length&&t-g[0].ts>Zt;)g.shift();if(g.length>=No&&(g=g.slice(-50)),g.push({path:e,ts:t}),g.length<4)return;let n=e,o=!1,r=[];for(let i=0;i<g.length-1;i++)if(g[i].path===n){let c=g.slice(i,g.length),s=new Set(c.map(a=>a.path));if(s.size>=2){r.push(...Array.from(s)),o=!0;break}}o&&(l({t:"sig",ts:t,d:{s:"loop_nav",pages:r}}),g=[{path:e,ts:t}])}var Io=100,en=1e4,$e=.5,y=[],me=0,We=0,Ye=!1,Xe=0,tn=d(Po);function Ke(e){en=e?.windowMs??1e4,$e=e?.depthThreshold??.5,window.addEventListener("scroll",tn,{passive:!0})}function Qe(){window.removeEventListener("scroll",tn),y=[]}function Ge(){y=[],me=0,We=0}function Po(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1,Fo()}))}function Fo(){let e=Date.now(),t=window.scrollY;if(Xe=document.documentElement.scrollHeight-window.innerHeight,Xe<=0)return;let n=t/Xe,o=t>me?"down":"up";if(e-We<100){me=t;return}for(;y.length&&e-y[0].ts>en;)y.shift();y.length>=Io&&(y=y.slice(-50)),y.push({depth:n,ts:e,direction:o}),me=t,We=e;let r=0,i=1,c=0,s=!1;for(let a=0;a<y.length;a++){let u=y[a].depth;u>r&&(r=u),u>=$e&&(s=!0),s&&u<i&&(i=u),s&&i<.25&&u>=$e&&(c++,s=!1,i=1)}c>=1&&(l({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:c+1}}),y=[])}var Bo=["textarea",'[role="textbox"]',"[contenteditable]"],Z=new Map,L=new Set,C=null,Je=0,nn=5e3,on=[],rn=d(Uo),sn=d(Ho),an=d(zo),cn=S(un),J=null;function Ze(e,t){nn=e?.pauseMs??5e3,on=t??[],document.addEventListener("focusin",rn,{capture:!0,passive:!0}),document.addEventListener("focusout",sn,{capture:!0,passive:!0}),document.addEventListener("submit",an,{capture:!0,passive:!0}),window.addEventListener("pagehide",cn),J=S(()=>{document.visibilityState==="hidden"&&un()}),document.addEventListener("visibilitychange",J)}function et(){document.removeEventListener("focusin",rn,{capture:!0}),document.removeEventListener("focusout",sn,{capture:!0}),document.removeEventListener("submit",an,{capture:!0}),window.removeEventListener("pagehide",cn),J&&(document.removeEventListener("visibilitychange",J),J=null),Z.clear(),L.clear(),C=null}function tt(){Z.clear(),L.clear(),C=null,Je=0}function Uo(e){let t=e.target;if(!t||!ln(t)||b(t,on)||qo(t))return;Z.set(t,Date.now());let n=t.closest("form");n&&n!==C&&(C=n,Je=n.querySelectorAll("input, select, textarea").length)}function Ho(e){let t=e.target;if(!t||!ln(t))return;let n=Z.get(t);if(Z.delete(t),n){let r=Date.now()-n;r>=nn&&l({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:m(t),pause:r}})}let o=t.getAttribute("name")||t.getAttribute("id")||m(t);jo(t)&&L.add(o)}function zo(){L.clear(),C=null}function un(){L.size>0&&C&&(l({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:L.size,total:Je||L.size}}),L.clear(),C=null)}function ln(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function qo(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Bo)try{if(e.matches(t))return!0}catch{return!1}return!1}function jo(e){return"value"in e?e.value.length>0:!1}var P=null,ee=null,dn=/flusterduck\.com|\/v1\/ingest/,mn=d(Vo),pn=d(Yo);function nt(){window.addEventListener("error",mn),window.addEventListener("unhandledrejection",pn),Xo()}function ot(){window.removeEventListener("error",mn),window.removeEventListener("unhandledrejection",pn),$o()}function Vo(e){l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:rt(e.message||"Unknown error",200),ep:"",status:0}})}function Yo(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:rt(t,200),ep:"",status:0}})}function Xo(){P||(P=window.fetch,ee=function(t,n){let o;try{o=P.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;dn.test(i)||l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:fn(i),status:r.status}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;dn.test(i)||l({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:rt(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?fn(t):"",status:0}})}catch{}throw r})},window.fetch=ee)}function $o(){P&&ee&&window.fetch===ee&&(window.fetch=P),P=null,ee=null}function fn(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function rt(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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var hn=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Wo=['[class*="map"]',"canvas",".gallery","[data-zoom]"],F=null,T=0,pe=0,te=0,gn=0,vn=null,wn=[],bn=d(Ko),yn=d(Qo),En=d(Zo),Sn=d(tr),Tn=d(er);function it(e){wn=e??[],document.addEventListener("touchstart",bn,{passive:!0}),document.addEventListener("touchend",yn,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",En,{passive:!0}),window.addEventListener("orientationchange",Sn,{passive:!0})),window.visualViewport?.addEventListener("resize",Tn)}function st(){document.removeEventListener("touchstart",bn),document.removeEventListener("touchend",yn),document.removeEventListener("gesturechange",En),window.removeEventListener("orientationchange",Sn),window.visualViewport?.removeEventListener("resize",Tn)}function Ko(e){let t=e.touches[0];e.touches.length===1&&t&&(F={x:t.clientX,y:t.clientY,ts:Date.now()})}function Qo(e){if(!F||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-F.x,o=t.clientY-F.y,r=Date.now()-F.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Go(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&Jo(i,n,o),F=null}function Go(e,t,n){if(b(e,wn))return;let o=nr(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),c=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((t-i)**2+(n-c)**2);if(s>0&&s<=20){let a=`${Math.round(r.width)}x${Math.round(r.height)}`;l({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:m(o),dist:Math.round(s),size:a}})}}function Jo(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||hn.some(c=>{try{return e.matches(c)||e.closest(c)}catch{return!1}})||!hn.some(c=>{try{return document.querySelector(c)!==null}catch{return!1}}))return;let i=t>0?"right":"left";l({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Zo(){let e=Date.now();if(e-pe>3e4&&(T=0,pe=e),T++,T>=2){let t=document.activeElement||document.body;Wo.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})||l({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:T}}),T=0}}function er(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();t-pe>3e4&&(T=0,pe=t),T++,T>=2&&(l({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:T}}),T=0)}}function tr(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-gn>3e4&&(te=0,gn=e),t!==vn&&(te++,vn=t),te>=3&&(l({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:te}}),te=0)}function nr(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,c=21;for(let s=0;s<r.length;s++){let a=r[s];if(!a)continue;let u=a.getBoundingClientRect(),f=Math.max(u.left,Math.min(t,u.right)),p=Math.max(u.top,Math.min(n,u.bottom)),w=Math.sqrt((t-f)**2+(n-p)**2);w<c&&w>0&&(c=w,i=a)}return i}var E=[],B=null,A=0,at=0,M=[],or=10,rr=5e3,Mn=5,ir=3e3,sr=15,ar=5e3,An=d(cr);function ct(){document.addEventListener("keydown",An,{capture:!0,passive:!0})}function ut(){document.removeEventListener("keydown",An,{capture:!0}),E=[],M=[],B=null}function cr(e){let t=Date.now(),n=e.target;n&&b(n,[])||(e.key==="Tab"?ur(t,n):e.key==="Escape"?lr(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&dr(t,e.target))}function ur(e,t){for(;E.length&&e-E[0].ts>rr;)E.shift();E.length>=50&&(E=E.slice(-25));let n=t?m(t):"";if(E.push({ts:e,el:n}),E.length>=or){let r=E.map(i=>i.el).filter(Boolean);l({t:"sig",ts:e,d:{s:"tab_thrash",cnt:E.length,els:r}}),E=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');o&&(o===B?e-at<=ir?(A++,A>=Mn&&(l({t:"sig",ts:e,d:{s:"focus_trap",container:m(o),attempts:A}}),A=0,B=null)):(at=e,A=1):(B=o,at=e,A=1))}function lr(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');n&&n===B&&(A++,A>=Mn&&(l({t:"sig",ts:e,d:{s:"focus_trap",container:m(n),attempts:A}}),A=0,B=null))}function dr(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(;M.length&&e-M[0].ts>ar;)M.shift();M.length>=50&&(M=M.slice(-25)),M.push({ts:e,container:n});let o=M.filter(r=>r.container===n);o.length>=sr&&(l({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:m(n),keys:o.length}}),M=[])}var U=0,he=0,ge=null,lt=0,ve=!1,fr=4,mr=3e3,xn=d(pr);function dt(){window.addEventListener("scroll",xn,{passive:!0})}function ft(){window.removeEventListener("scroll",xn),U=0,he=0,ge=null,lt=0,ve=!1}function pr(){ve||(ve=!0,requestAnimationFrame(()=>{ve=!1,hr()}))}function hr(){let e=Date.now(),t=window.scrollY,n=t-he;if(Math.abs(n)<2){he=t;return}let o=n>0?"down":"up";ge&&o!==ge&&(e-lt>mr&&(U=0,lt=e),U++,U>=fr&&Math.abs(n)>100&&(l({t:"sig",ts:e,d:{s:"scroll_hijack",rev:U}}),U=0)),ge=o,he=t}var H=0,we=!1,kn=d(gr),Ln=S(_n),ne=null;function mt(){window.addEventListener("scroll",kn,{passive:!0}),window.addEventListener("pagehide",Ln),ne=S(()=>{document.visibilityState==="hidden"&&_n()}),document.addEventListener("visibilitychange",ne)}function pt(){window.removeEventListener("scroll",kn),window.removeEventListener("pagehide",Ln),ne&&(document.removeEventListener("visibilitychange",ne),ne=null),H=0,we=!1}function ht(){H=0}function gr(){we||(we=!0,requestAnimationFrame(()=>{we=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>H&&(H=t)}}))}function _n(){H>.05&&l({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(H*100)/100}})}var Rn=1500,Dn=15e3,vr=5e3,wr=.15,vt="",z=0,gt=0,oe=0,q=0,wt=0,be=null,ye=!1,Ee=d(yr),Cn=d(Er),j=d(br);function bt(){ye||(ye=!0,wt=On(),re(),document.addEventListener("mouseenter",Ee,!0),document.addEventListener("mouseleave",Ee,!0),document.addEventListener("click",j,{capture:!0,passive:!0}),document.addEventListener("keydown",j,{capture:!0,passive:!0}),document.addEventListener("scroll",j,{passive:!0}),window.addEventListener("resize",Cn,{passive:!0}))}function yt(){ye&&(ye=!1,document.removeEventListener("mouseenter",Ee,!0),document.removeEventListener("mouseleave",Ee,!0),document.removeEventListener("click",j,{capture:!0}),document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("scroll",j),window.removeEventListener("resize",Cn),Nn(),vt="",z=0,q=0,oe=0)}function re(){Nn(),be=setTimeout(()=>{l({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:Dn}})},Dn)}function br(){re()}function yr(e){let t=e.target;if(!t)return;let n=m(t),o=Date.now();(n!==vt||o-gt>Rn)&&(vt=n,gt=o,z=0),z+=1,!(z<4)&&(l({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:z,window_ms:Rn}}),z=0,gt=o)}function Er(){let e=Date.now(),t=On(),n=wt||t,o=Math.abs(t-n)/Math.max(n,1);wt=t,!(o<wr)&&((!oe||e-oe>vr)&&(oe=e,q=0),q+=1,!(q<3)&&(l({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:q,area_delta:Math.round(o*1e3)/1e3}}),q=0,oe=e))}function On(){return Math.max(1,window.innerWidth*window.innerHeight)}function Nn(){be&&(clearTimeout(be),be=null)}var Sr="https://api.flusterduck.com/v1/ingest",_=!1,Se=null,ie=null;function Tr(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 In(e){if(_||!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&&_r()){ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){ie=e;return}ie=e,_=!0;let t=Tt(e.cookieless??!1),n=Tr(e.endpoint)??Sr,o=_e(location.pathname,e.pageRules??[]),r=Rr(e.domMode);It(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=document.referrer,c="";if(i)try{c=new URL(i).origin+new URL(i).pathname}catch{c=""}l({t:"pv",ts:Date.now(),d:{ref:c}});let s=e.ignoreElements??[],a=u=>e.signals?.[u]?.enabled!==!1;if(a("rageClick")&&De(e.signals?.rageClick,s),a("deadClick")&&Oe(s),a("speedFrustration")){let u=e.signals?.speedFrustration;Pe(u?{delayMs:u.windowMs}:void 0,s)}if(e.trackMouse!==!1&&a("thrashCursor")&&Ue(e.signals?.thrashCursor),a("loopNav")&&qe(e.signals?.loopNav),a("scrollBounce")&&Ke(),e.trackForms!==!1&&(a("formHesitation")||a("formAbandon"))){let u=e.signals?.formHesitation;Ze(u?{pauseMs:u.threshold}:void 0,s)}a("errorEncounter")&&nt(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&it(s),(a("tabThrash")||a("focusTrap")||a("keyboardNavFrustration"))&&ct(),a("scrollHijack")&&dt(),a("scrollDepthAbandon")&&mt(),a("advancedHeuristics")&&bt(),Se=Bt(S((u,f)=>{R(),Ge(),tt(),ht(),re();let p=_e(f,e.pageRules??[]);Le({page:p,url:u}),Ve(f),l({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function Mr(e,t){if(!_||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);l({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Ar(e,t={}){if(!_||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||l({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function xr(e){if(!_||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}Le({segment:t})}function kr(e){e&&ie&&!_?In(ie):e||(Et(),Ae())}function Lr(){Et(),Ae()}function Et(){_&&(Ce(),Ne(),Fe(),He(),je(),Qe(),et(),ot(),st(),ut(),ft(),pt(),yt(),Pt(),Se&&(Se(),Se=null),_=!1)}function _r(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Rr(e){return e==="metadata"||e==="snapshot"?e:"off"}export{Et as destroy,xr as identify,In as init,Lr as optOut,kr as setConsent,Mr as signal,Ar 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 Xs=/^[0-9a-f]{32}$/;function kr(e){if(e)return Cr();let t=Ys(sn);if(t&&Xs.test(t))return t;let n=Cr();return xr(sn,n,30),n}function an(){xr(sn,"",-1)}function Cr(){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 Ys(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function xr(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var js=/^[:\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="${De(t)}"]`;if(e.id&&!js.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,$s=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ks=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!Ks.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!$s.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}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 Ar(e,t){if(t==="off")return null;if(t==="metadata")return Gs(e);let n=Zs(e);return n?{mode:"snapshot",...n}:null}function Gs(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:Mr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Mr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Qs(e)}}}function Zs(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:ea(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:o?p(o):"",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:Js(t),animations:i,siblings:r}}catch{return null}}function Mr(e,t){return e&&t.includes(e)?e:null}function Qs(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 Js(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function ea(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 Rr=7e3,ta=500,na=1e4,Ir=50,Or=100,oa=3,Ie=6e4,bt="application/json",ra="application/json; encoding=gzip",ae=[],$=null,Nr="",Pr=Rr,Hr=Ir,_=null,yt={domMode:"off",compression:"auto"},ln=!1,un=null,dn=!1;function fn(e){un=e}function pn(e){dn=e}var ia=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),sa=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),aa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function la(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>aa.has(n))}var ca=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Fr=f(da),Br=y(()=>J());function Vr(e,t,n,o,r){Nr=e,_=Object.assign(Object.create(null),t),yt={domMode:wa(r?.domMode),compression:ba(r?.compression)},Pr=Math.max(ta,Math.min(n??Rr,na)),Hr=Math.max(1,Math.min(o??Ir,Or)),document.addEventListener("visibilitychange",Fr),window.addEventListener("pagehide",Br)}function d(e){dn||ae.length>=Or||(ae.push(e),ae.length>=Hr?J():$||($=setTimeout(J,Pr)))}function J(){ua()}async function ua(){if(ln||!ae.length||!_)return;ln=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];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:yt.domMode},n=e.map(r=>ga(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await cn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await cn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await cn({...t,events:o})}catch{}finally{ln=!1}}function mn(e){if(_)for(let t of Object.keys(e))ia.has(t)&&(_[t]=e[t])}function qr(){J(),dn=!1,document.removeEventListener("visibilitychange",Fr),window.removeEventListener("pagehide",Br),$&&(clearTimeout($),$=null)}function da(){document.visibilityState==="hidden"&&J()}async function cn(e){let t=JSON.stringify(e),n=await fa(t,yt.compression);n&&Wr(n,0)}async function fa(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await pa(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ra}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function pa(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=ma(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function ma(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function Wr(e,t,n=Nr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<oa&&setTimeout(()=>Wr(e,t+1,n),1e3*(t+1))})}catch{}}function ga(e,t,n){let o=e.d??{},r=ha(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Dr(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Dr(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Ea(s,n):null;u&&(i.dom=u),i.signal_type&&un&&un(i.signal_type)}let a=va(o);return Object.keys(a).length&&(i.metadata=a),i}function ha(e){return e==="pv"?"pageview":e==="sig"?"signal":sa.has(e)?e:"custom_signal"}function va(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 o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!la(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 ca.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Ea(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Ar(n,t):null}catch{return null}}function Dr(...e){for(let t of e)if(typeof t=="string"&&t)return t}function wa(e){return e==="metadata"||e==="snapshot"?e:"off"}function ba(e){return e==="off"?"off":"auto"}function Ur(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.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=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function gn(e,t){for(let n of t){let o=Sa(n.pattern);if(o&&o.test(e))return n.label}return _a(e)}var ya=/^[a-zA-Z0-9/:._*\-]+$/;function Sa(e){if(e.length>200||!ya.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function _a(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Ta=[".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"]'],P=[],zr=3,Xr=2e3,hn=8,Yr=[],le=[],jr=0,_t=new Map,Tt=new Map,La=1e4,Lt=!1,$r=f(Ca);function vn(e,t){Lt||(Lt=!0,zr=e?.threshold??3,Xr=e?.windowMs??2e3,Yr=[...Ta,...t??[]],jr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",$r,{capture:!0,passive:!0}))}function En(){Lt&&(Lt=!1,document.removeEventListener("click",$r,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Ca(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yr)||Aa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>Xr;)P.shift();P.push({t:n,x:o,y:r});let i=ka();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>hn*hn)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=Ma(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=xa(n),_r=_t.get(b)??0,on=_r+1,Tr=Tt.get(b)??0,Us=Tr>0&&n-Tr<La;_t.set(b,on),Tt.set(b,n);let Lr=_r>=1,zs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,rn)=>se+rn.x,0)/s.length,vt=s.reduce((se,rn)=>se+rn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:Lr,hot_repeat:Us,...zs??{}}}),Lr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:on,burst_count:on,burst_seq:U}}),P=P.slice(-(i-1))}function ka(){return le.length>=3?2:zr}function xa(e){let t=(e-jr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function Ma(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/hn*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Aa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Da=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ra=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ia=/^(A|BUTTON|LABEL)$/,Oa=20,Kr=[],ce=null,Na=5,Ct=new Map,Gr=f(Pa),Zr=f(Ba);function Pa(e){ce={x:e.clientX,y:e.clientY}}function wn(e){Kr=e??[],document.addEventListener("mousedown",Gr,{capture:!0,passive:!0}),document.addEventListener("click",Zr,{capture:!0,passive:!0})}function bn(){document.removeEventListener("mousedown",Gr,{capture:!0}),document.removeEventListener("click",Zr,{capture:!0}),ce=null,Ct.clear()}function yn(){Ct.clear()}function Ha(e){try{return window.getComputedStyle(e).cursor.slice(0,Oa)}catch{return""}}function Fa(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ba(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Kr)||Ua())return;let n=za(e);if(ce=null,n||Va(t))return;let o=qa(t,e.clientX,e.clientY),r=o?Qr(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ha(t),c=Fa(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Va(e){if(Da.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ra.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&&Ia.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function qa(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=Wa(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function Qr(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Wa(e,t,n){return Qr(e,t,n).dist}function Ua(){let e=window.getSelection();return e!==null&&e.toString().length>0}function za(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>Na}var T=null,Sn=3e3,Jr=[],kt="click",xt=0,Xa=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ya=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ei=f(Ka),ti=f(ja),ni=f($a);function _n(e,t){Sn=e?.delayMs??3e3,Jr=t??[],document.addEventListener("click",ei,{capture:!0,passive:!0}),document.addEventListener("keydown",ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",ni,{capture:!0,passive:!0})}function Tn(){document.removeEventListener("click",ei,{capture:!0}),document.removeEventListener("keydown",ti,{capture:!0}),document.removeEventListener("touchstart",ni,{capture:!0}),ue()}function Ln(){ue()}function ja(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function $a(){kt="touch",xt=Date.now()}function Ka(e){let t=e.target;if(!t||v(t,Jr))return;let n=t.getAttribute("role");if(!Xa.test(t.tagName)&&!(n&&Ya.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Sn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Sn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Ga=100,Za=5,oi=800,ri=2e3,Qa=3,kn=0,Ja=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,Cn=0,ee=[],xn=0,de=null,ii=f(el);function Mn(e){oi=e?.velocityThreshold??800,ri=e?.windowMs??2e3,document.addEventListener("mousemove",ii,{passive:!0})}function An(){document.removeEventListener("mousemove",ii),de&&clearTimeout(de),Dn()}function el(e){let t=Date.now();t-kn<Ja||(kn=t,de&&clearTimeout(de),de=setTimeout(()=>Dn(),150),tl(e.clientX,e.clientY,t))}function tl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,Cn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=Ga&&(ee=ee.slice(-50)),ee.push(a),xn+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=Za&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-Cn>ri){if(Dt>=Qa){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=oi&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(xn)}})}Dn(),Cn=n}}function Dn(){Dt=0,ee=[],xn=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,kn=0,de=null}var si=100,ai=5,nl=3,L=[],x=[],Rn=3e4;function In(e){Rn=e?.windowMs??3e4}function On(){L=[],x=[]}function Nn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Rn;)L.shift();for(;x.length&&t-x[0].ts>Rn;)x.shift();if(L.length>=si&&(L=L.slice(-50)),x.length>=si&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=nl&&a.length>u.size){let l=a.slice(-ai).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});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 u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ai).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var ol=100,li=1e4,Hn=.5,C=[],Rt=0,Fn=0,He=!1,Pn=0,ci=f(rl);function Bn(e){li=e?.windowMs??1e4,Hn=e?.depthThreshold??.5,window.addEventListener("scroll",ci,{passive:!0})}function Vn(){window.removeEventListener("scroll",ci),C=[],He=!1}function qn(){C=[],Rt=0,Fn=0,He=!1}function rl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,il()}))}function il(){let e=Date.now(),t=window.scrollY;if(Pn=document.documentElement.scrollHeight-window.innerHeight,Pn<=0)return;let n=t/Pn,o=t>Rt?"down":"up";if(e-Fn<100){Rt=t;return}for(;C.length&&e-C[0].ts>li;)C.shift();C.length>=ol&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Fn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Hn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Hn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var sl=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,Wn=0,ui=5e3,di=[],al=50,fi=f(ll),pi=f(cl),mi=f(ul),gi=y(hi),Fe=null;function Un(e,t){ui=e?.pauseMs??5e3,di=t??[],document.addEventListener("focusin",fi,{capture:!0,passive:!0}),document.addEventListener("focusout",pi,{capture:!0,passive:!0}),document.addEventListener("submit",mi,{capture:!0,passive:!0}),window.addEventListener("pagehide",gi),Fe=y(()=>{document.visibilityState==="hidden"&&hi()}),document.addEventListener("visibilitychange",Fe)}function zn(){document.removeEventListener("focusin",fi,{capture:!0}),document.removeEventListener("focusout",pi,{capture:!0}),document.removeEventListener("submit",mi,{capture:!0}),window.removeEventListener("pagehide",gi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function Xn(){Be.clear(),Ve.clear(),z.clear(),te=null,Wn=0}function ll(e){let t=e.target;if(!t||!vi(t)||v(t,di)||dl(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,Wn=o.querySelectorAll("input, select, textarea").length)}function cl(e){let t=e.target;if(!t||!vi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<al)&&n!==void 0){let a=r-n;if(a>=ui){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);fl(t)&&z.add(s)}function ul(){z.clear(),te=null}function hi(){if(z.size>0&&te){let e=Wn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function vi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function dl(e){if(e.tagName==="TEXTAREA")return!0;for(let t of sl)try{if(e.matches(t))return!0}catch{return!1}return!1}function fl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,Ei=/flusterduck\.com|\/v1\/ingest/,bi=f(gl),yi=f(hl);function jn(){window.addEventListener("error",bi),window.addEventListener("unhandledrejection",yi),vl()}function $n(){window.removeEventListener("error",bi),window.removeEventListener("unhandledrejection",yi),El()}var Yn=/fetch|network|cors|timeout/i;function pl(e){return Yn.test(e)?"network":"script"}function ml(e){if(e instanceof TypeError&&Yn.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return Yn.test(t)?"network":"unhandled_promise"}function gl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Kn(t,200),ep:"",status:0,error_category:pl(t),url:location.pathname}})}function hl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Kn(t,200),ep:"",status:0,error_category:ml(e.reason),url:location.pathname}})}function vl(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:wi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Kn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?wi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function El(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function wi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Kn(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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Si=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],wl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null,_i=[],Ti=f(bl),Li=f(yl),Ci=f(Tl),ki=f(kl),xi=f(Ll);function Qn(e){_i=e??[],document.addEventListener("touchstart",Ti,{passive:!0}),document.addEventListener("touchend",Li,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Ci,{passive:!0}),window.addEventListener("orientationchange",ki,{passive:!0})),window.visualViewport?.addEventListener("resize",xi)}function Jn(){document.removeEventListener("touchstart",Ti),document.removeEventListener("touchend",Li),document.removeEventListener("gesturechange",Ci),window.removeEventListener("orientationchange",ki),window.visualViewport?.removeEventListener("resize",xi),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null}function Mi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function bl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Mi(e.touches),K=null)}function yl(e){if(me>0){let s=e.touches.length>=2?Mi(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Sl(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&_l(i,n,o),K=null}function Sl(e,t,n){if(v(e,_i))return;let o=xl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function _l(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Si.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Si.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Tl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!wl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Ll(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Cl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function kl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Gn>3e4&&(pe=0,Gn=e),t!==Zn&&(pe++,Zn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Cl()}}),pe=0)}function xl(e,t,n){let r=(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<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],eo=[],Ml=10,Al=5e3,Ai=5,Di=3e3,Dl=15,Rl=5e3,Ri=f(Il);function to(e){eo=e??[],document.addEventListener("keydown",Ri,{capture:!0,passive:!0})}function no(){document.removeEventListener("keydown",Ri,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",eo=[]}function Il(e){let t=Date.now(),n=e.target;n&&v(n,eo)||(e.key==="Tab"?Nl(t,n,e.shiftKey):e.key==="Escape"?Pl(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Hl(t,e.target))}function Ol(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Nl(e,t,n){for(;M.length&&e-M[0].ts>Al;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=Ml){let i=M.map(a=>a.el).filter(Boolean),s=Ol(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Di?(A++,F=i,A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function Pl(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===ge){if(e-he>Di){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Hl(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(;H.length&&e-H[0].ts>Rl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Dl&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Fl=1e4,Bl=2,Vl=4,ql=3e3,Xe=null,Ht=0,Wl=2e3,Ii=f(Xl),Oi=f(Ul),Ni=f(zl);function io(){window.addEventListener("wheel",Oi,{passive:!0}),window.addEventListener("touchmove",Ni,{passive:!0}),window.addEventListener("scroll",Ii,{passive:!0})}function so(){window.removeEventListener("wheel",Oi),window.removeEventListener("touchmove",Ni),window.removeEventListener("scroll",Ii),Ft()}function Ft(){ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Xe=null,Ht=0}function Ul(){Xe="wheel",Ht=Date.now()}function zl(){Xe="touch",Ht=Date.now()}function Xl(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,Yl()}))}function Yl(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-oo>ql&&(ve=0,oo=e),ve++,ve>=Vl&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=Wl?Xe:"wheel";e-ro>Fl&&(Pt=0,ro=e),Pt++;let a=Pt>=Bl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Hi=f(jl),je=null,$e=null;function ao(){window.addEventListener("scroll",Hi,{passive:!0}),$e=y(Pi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Pi()}),document.addEventListener("visibilitychange",je)}function lo(){window.removeEventListener("scroll",Hi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function co(){ne=0,Ee=0,Ye=!1}function jl(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Pi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Fi=1500,Bi=15e3,$l=5e3,Kl=.15,uo="",we=0,Bt=0,Ke=0,be=0,fo=0,Vt=null,qt=0,Wt=!1,Ut=f(Zl),Vi=f(Ql),ye=f(Gl);function po(){Wt||(Wt=!0,fo=qi(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Vi,{passive:!0}))}function mo(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Vi),Wi(),uo="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){Wi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:Bi,cycle:e}})},Bi)}function go(){qt=0}function Gl(){Ge()}function Zl(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==uo||o-Bt>Fi)&&(uo=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Fi}}),we=0,Bt=o)}function Ql(){let e=Date.now(),t=qi(),n=fo||t,o=Math.abs(t-n)/Math.max(n,1);fo=t,!(o<Kl)&&((!Ke||e-Ke>$l)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function qi(){return Math.max(1,window.innerWidth*window.innerHeight)}function Wi(){Vt&&(clearTimeout(Vt),Vt=null)}var Ui=6e4,Jl=3,ec=["[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"]'],tc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],zi=[],Xi=f(nc);function ho(e){zi=e??[],document.addEventListener("click",Xi,{capture:!0,passive:!0})}function vo(){document.removeEventListener("click",Xi,{capture:!0}),B=[]}function Eo(){B=[]}function nc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,zi)||!oc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Ui;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<Jl)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Ui}}),B=[]}function oc(e){let t=e;for(let n=0;n<3&&t;n++){if(rc(t)||ic(t))return!0;t=t.parentElement}return!1}function rc(e){for(let t of ec)try{if(e.matches(t))return!0}catch{}return!1}function ic(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return tc.test(o)}var Yi=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ji=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,$i=[],Ki=f(sc);function wo(e){$i=e??[],document.addEventListener("click",Ki,{capture:!0,passive:!0})}function bo(){document.removeEventListener("click",Ki,{capture:!0}),zt=[],Xt.clear()}function yo(){zt=[],Xt.clear()}function sc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$i)||!ac(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:cc(t),...u??{}}})}function ac(e){let t=e;for(let n=0;n<4&&t;n++){if(lc(t))return!0;t=t.parentElement}return!1}function lc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&ji.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if(Yi.test(r)||Yi.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ji.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 u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function cc(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,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var uc=1500,I=null,Gi=[],Zi=f(dc),Qi=f(fc),Ji=f(pc);function So(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0}),document.addEventListener("keydown",Qi,{capture:!0,passive:!0}),window.addEventListener("popstate",Ji)}function _o(){document.removeEventListener("click",Zi,{capture:!0}),document.removeEventListener("keydown",Qi,{capture:!0}),window.removeEventListener("popstate",Ji),I=null}function To(){I=null}function dc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Gi)){if(mc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function fc(e){e.key==="Escape"&&es("escape")}function pc(){es("back_nav")}function es(e){if(!I)return;let t=Date.now()-I.t;if(t>uc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function mc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var ts=1e4,gc=3,hc=/^(checkbox|radio)$/,ns=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,Lo=[],os=f(vc),rs=f(Ec);function Co(e){Lo=e??[],document.addEventListener("change",os,{capture:!0,passive:!0}),document.addEventListener("click",rs,{capture:!0,passive:!0})}function ko(){document.removeEventListener("change",os,{capture:!0}),document.removeEventListener("click",rs,{capture:!0}),Ze.clear()}function xo(){Ze.clear()}function vc(e){let t=e.target;t&&(v(t,Lo)||wc(t)&&is(t))}function Ec(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Lo))return;let n=t.getAttribute("role")??"";ns.test(n)&&t.tagName!=="INPUT"&&is(t)}function is(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>ts;)o.shift();if(o.push({t:n}),o.length<gc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:ts}}),Ze.delete(t)}function wc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?hc.test(e.type??""):ns.test(e.getAttribute("role")??"")}var ss=15e3,bc=3,X=[],as=f(yc);function Mo(){document.addEventListener("copy",as,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("copy",as,{capture:!0}),X=[]}function Do(){X=[]}function yc(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ss;)X.shift();X.push({t:o}),!(X.length<bc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ss}}),X=[])}var ls=15e3,Sc=4,_c=5,Tc=500,Lc=2e3,D=[],Yt=0,Qe=null,oe=null;function Ro(){Qe=y(kc),oe=y(Cc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function Io(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Oo(){D=[],Yt=0}function Cc(){Yt=Date.now(),D=[]}function kc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<_c)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Lc)return;for(;D.length&&o-D[0].t>ls;)D.shift();let r=D[D.length-1];r&&o-r.t<Tc||(D.push({t:o}),!(D.length<Sc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:ls}}),D=[]))}var No=6e4,xc=20,us="_fd_sess",Mc={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},Ac=10,cs={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Po="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ds(e,Date.now())}function Dc(){try{let e=sessionStorage.getItem(us);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Rc(){try{sessionStorage.setItem(us,JSON.stringify(_e))}catch{}}function Ic(){let e=[],n=Date.now()-No,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ds(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>xc&&n.shift()}function Oc(e){let t=e-No,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function Nc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=Mc[n.type]??Ac;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function fs(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function Pc(e,t,n){return fs(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Hc(e,t,n,o){let r=fs(o),i=Ic();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Po||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:No,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,Rc()}function Fc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Oc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ds(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=Nc(),i=Pc(n.size,o,r);i&&(Se!==null&&cs[i]<=cs[Se]||(Se=i,Hc(i,n,o,r)))}function Ho(e){Po=e}function Fo(e){V=[],Se=null,$t=!0,Te=new Map,Po=e??"",Dc(),fn(Fc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function Bo(){$t=!1,V=[],Se=null,Te=new Map,fn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Bc=8,Vo=3e4,qo=5,Vc=5e3,O=[],G="",ot=!1,ps=f(Wc),ms=f(Uc);function Wo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",ps),window.addEventListener("hashchange",ms)}function Uo(){window.removeEventListener("popstate",ps),window.removeEventListener("hashchange",ms),O=[],ot=!1,G=""}function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Vo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<qo)&&(ot||qc(t))}function qc(e){let t=O.filter(c=>e-c.ts<=Vo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<qo||n.length===0||n.some(c=>c.leftAt-c.ts>=Vc)||new Set(n.map(c=>c.path)).size<qo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Bc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Vo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function Wc(){let e=location.pathname+location.search+location.hash;rt(e)}function Uc(){let e=location.pathname+location.search+location.hash;rt(e)}var zc=.3,gs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,hs=f(Xc),vs=f(jc);function Xo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",hs,{passive:!0}),window.addEventListener("click",vs,{capture:!0})}function Yo(){window.removeEventListener("scroll",hs),window.removeEventListener("click",vs,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function Xc(){it||(it=!0,requestAnimationFrame(Yc))}function Yc(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>gs&&(N=!1),re==="down"){let s=ie-t,a=n*zc;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function jc(e){if(!N)return;let t=Date.now();if(t-at>gs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var $c=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Kc=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Gc=/^(A|BUTTON|LABEL)$/,Zc=3,Es=9e4,Qc=5,lt=new Map,ws=[],ct=null,Jc=5,bs=f(eu),ys=f(su);function eu(e){ct={x:e.clientX,y:e.clientY}}function jo(e){ws=e??[],document.addEventListener("mousedown",bs,{capture:!0,passive:!0}),document.addEventListener("click",ys,{capture:!0,passive:!0})}function $o(){document.removeEventListener("mousedown",bs,{capture:!0}),document.removeEventListener("click",ys,{capture:!0}),ct=null,lt.clear()}function Ko(){lt.clear()}function tu(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 nu(e,t){return e*4+t}function ou(e){if($c.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Kc.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&&Gc.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ru(){let e=window.getSelection();return e!==null&&e.toString().length>0}function iu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>Jc}function su(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ws)||ru()||iu(e)||ou(t))return;let{row:n,col:o}=tu(e.clientX,e.clientY),r=nu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<Es);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=Zc){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=Qc))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:Es}}),lt.set(r,[])}}var Go=3,Le=12e4,S=new Map,Zt=[],ut=null,Ss=f(du),Gt=f(fu);function Qo(e){Zt=e??[],document.addEventListener("invalid",Ss,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(pu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function Jo(){document.removeEventListener("invalid",Ss,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function er(){for(let e of S.values())Z(e);S.clear()}function Zo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function tr(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 Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function au(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function lu(e){return f(t=>{Ls(e)})}function cu(e){return f(t=>{Ls(e)})}function _s(e,t){let n=lu(t),o=cu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Ts(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();au(t);let n=p(e),o=S.get(n);if(!o){_s(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n)))}function uu(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function Ls(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,tr(n.el)){n.cycles+=1,n.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Zo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function du(e){let t=e.target;t&&Ts(t)}function fu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||tr(t)&&_s(t,n)}function pu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=tr(n);i&&!r?Ts(n):!i&&r&&uu(n)}}var Ce=null,dt=null,or=[],Cs=0,ft=new Map;function rr(e){or=e?.length?e:["[data-fd-impression]"],Cs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(gu),{threshold:[0,.5,1]}),ks(),dt=new MutationObserver(y(mu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ir(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function sr(){ft.clear(),Ce&&ks()}function ks(){for(let e of or)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)nr(t[n])}catch{}}function nr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function mu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of or)try{o.matches(r)&&nr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)nr(i[s])}catch{}}}function gu(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Cs),viewport_position:s}})}}}var hu=2,vu=3,Eu=6e4,pt=new Map,xs=[],Ms=f(wu);function ar(e){xs=e??[],document.addEventListener("input",Ms,{capture:!0,passive:!0})}function lr(){document.removeEventListener("input",Ms,{capture:!0}),pt.clear()}function cr(){pt.clear()}function wu(e){let t=e.target;if(!t||!bu(t)||v(t,xs))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Eu){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=vu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=hu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:yu(t)}}),pt.delete(r);return}i.lastValue=o}function bu(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 yu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var As=2e3,Su=3e4,q=null,Ds=As,Rs=[],Jt=new Map,Is=f(_u),Os=f(Tu),Ns=f(mt);function ur(e,t){Ds=e?.dwellMs??As,Rs=t??[],document.addEventListener("mouseover",Is,{passive:!0}),document.addEventListener("mouseout",Os,{passive:!0}),document.addEventListener("click",Ns,{capture:!0,passive:!0})}function dr(){document.removeEventListener("mouseover",Is),document.removeEventListener("mouseout",Os),document.removeEventListener("click",Ns,{capture:!0}),mt(),Jt.clear()}function fr(){mt(),Jt.clear()}function _u(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Rs)||!Lu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Su)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Ds);q={el:t,selector:n,startTs:r,timer:i}}function Tu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Lu(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 o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Cu=20,ku=500,xu=3e3,Mu=6e4,en=0,tn=0,W=null,Ps=y(Au);function pr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Ps)}function mr(){document.removeEventListener("mouseleave",Ps),W&&(clearTimeout(W),W=null)}function gr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Au(e){if(e.clientY>Cu)return;let t=Date.now();t-en<xu||t-tn<Mu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),ku))}var Du=2500,Ru=4e3,Hs=200,Iu=500,Ou=.1,Nu=.25,xe=null,Me=null,j=null,ke=0;function hr(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function vr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:hr(o,Du,Ru)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Hs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:hr(o,Hs,Iu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Fs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:hr(ke,Ou,Nu)}})}ke=0}}function Er(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Fs()}function wr(){if(Fs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var Bs=[],Vs=f(Pu);function br(e){Bs=e??[],document.addEventListener("paste",Vs,{capture:!0,passive:!0})}function yr(){document.removeEventListener("paste",Vs,{capture:!0})}function Pu(e){let t=e.target;if(!t||!Hu(t)||v(t,Bs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Fu(t)}})},100)}function Hu(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 Fu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Bu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Vu(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 Ws(e){if(Q||!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&&Yu()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=kr(e.cookieless??!1),n=Vu(e.endpoint)??Bu,o=gn(location.pathname,e.pageRules??[]),r=ju(e.domMode);Vr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=qs(location.pathname,e.ignorePages??[]);i&&pn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&vn(e.signals?.rageClick,u),l("deadClick")&&wn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;_n(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Mn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&In(e.signals?.loopNav),l("scrollBounce")&&Bn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Un(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&Qo(u)}if(l("errorEncounter")&&jn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&Qn(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&to(u),l("scrollHijack")&&io(),l("scrollDepthAbandon")&&ao(),l("advancedHeuristics")&&po(),l("helpHunt")&&ho(u),l("closeClick")&&wo(u),l("closeClickReversal")&&So(u),l("filterSpiral")&&Co(u),l("copyFrustration")&&Mo(),l("textSelectFrustration")&&Ro(),l("deadClickTrapZone")&&jo(u),Fo(o),l("navigationConfusion")&&Wo(),l("scrollToClickConfusion")&&Xo(),l("elementImpression")&&rr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&ar(u),e.trackForms!==!1&&l("pasteBlocked")&&br(u),l("hoverDwell")){let c=e.signals?.hoverDwell;ur(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&pr(),l("performanceVitals")&&vr(),nn=Ur(y((c,m)=>{J(),qn(),Xn(),co(),Ln(),Ge(),go(),Eo(),yo(),To(),xo(),Do(),Oo(),Ko(),er(),yn(),Ft(),Kt(),zo(),sr(),cr(),fr(),gr(),wr(),rt(m),Ho(m);let E=gn(m,e.pageRules??[]),w=qs(m,e.ignorePages??[]);pn(w),mn({page:E,url:c}),Nn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function qu(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Wu(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Uu(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}mn({segment:t})}function zu(e){e&&gt&&!Q?Ws(gt):e||(Sr(),an())}function Xu(){Sr(),an()}function Sr(){Q&&(En(),bn(),Tn(),An(),On(),Vn(),zn(),$n(),Jn(),no(),so(),lo(),mo(),vo(),bo(),_o(),ko(),Ao(),Io(),$o(),Jo(),Bo(),Uo(),Yo(),ir(),lr(),dr(),mr(),Er(),yr(),qr(),nn&&(nn(),nn=null),Q=!1)}function Yu(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ju(e){return e==="metadata"||e==="snapshot"?e:"off"}function qs(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}export{Sr as destroy,Uu as identify,Ws as init,Xu as optOut,zu as setConsent,qu as signal,Wu as track};
package/dist/queue.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { SDKEvent, QueueMeta, QueueOptions } from './types';
2
+ export declare function setCorrelatorHook(fn: ((signalType: string) => void) | null): void;
3
+ export declare function setQueuePaused(val: boolean): void;
2
4
  export declare function initQueue(ep: string, meta: QueueMeta, interval?: number, maxSize?: number, options?: QueueOptions): void;
3
5
  export declare function enqueue(event: SDKEvent): void;
4
6
  export declare function flush(): void;
@@ -1,2 +1,3 @@
1
1
  export declare function getSelector(el: Element): string;
2
+ export declare function getElementLabel(el: Element): string;
2
3
  export declare function isIgnored(el: Element, ignoreSelectors: string[]): boolean;
@@ -1,3 +1,4 @@
1
1
  export declare function initAdvancedSignals(): void;
2
2
  export declare function destroyAdvancedSignals(): void;
3
3
  export declare function resetAdvancedSignals(): void;
4
+ export declare function resetAdvancedCycle(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initCloseClickReversal(ignore?: string[]): void;
2
+ export declare function destroyCloseClickReversal(): void;
3
+ export declare function resetCloseClickReversal(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initCloseClick(ignore?: string[]): void;
2
+ export declare function destroyCloseClick(): void;
3
+ export declare function resetCloseClick(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initCopyFrustration(): void;
2
+ export declare function destroyCopyFrustration(): void;
3
+ export declare function resetCopyFrustration(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initDeadClickTrapZone(ignore?: string[]): void;
2
+ export declare function destroyDeadClickTrapZone(): void;
3
+ export declare function resetDeadClickTrapZone(): void;
@@ -1,2 +1,3 @@
1
1
  export declare function initDeadClick(ignore?: string[]): void;
2
2
  export declare function destroyDeadClick(): void;
3
+ export declare function resetDeadClick(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initElementImpression(selectors?: string[]): void;
2
+ export declare function destroyElementImpression(): void;
3
+ export declare function resetElementImpression(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initExitIntent(): void;
2
+ export declare function destroyExitIntent(): void;
3
+ export declare function resetExitIntent(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initFilterSpiral(ignore?: string[]): void;
2
+ export declare function destroyFilterSpiral(): void;
3
+ export declare function resetFilterSpiral(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initFormValidationLoop(ignore?: string[]): void;
2
+ export declare function destroyFormValidationLoop(): void;
3
+ export declare function resetFormValidationLoop(): void;
@@ -0,0 +1,4 @@
1
+ export declare function onSignal(type: string): void;
2
+ export declare function setFrustrationCorrelatorPage(page: string): void;
3
+ export declare function initFrustrationCorrelator(page?: string): void;
4
+ export declare function destroyFrustrationCorrelator(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initHelpHunt(ignore?: string[]): void;
2
+ export declare function destroyHelpHunt(): void;
3
+ export declare function resetHelpHunt(): void;
@@ -0,0 +1,5 @@
1
+ export declare function initHoverDwell(opts?: {
2
+ dwellMs?: number;
3
+ }, ignore?: string[]): void;
4
+ export declare function destroyHoverDwell(): void;
5
+ export declare function resetHoverDwell(): void;
@@ -1,6 +1,6 @@
1
1
  export { initRageClick, destroyRageClick } from './rage-click';
2
- export { initDeadClick, destroyDeadClick } from './dead-click';
3
- export { initSpeedFrustration, destroySpeedFrustration } from './speed-frustration';
2
+ export { initDeadClick, destroyDeadClick, resetDeadClick } from './dead-click';
3
+ export { initSpeedFrustration, destroySpeedFrustration, resetSpeedFrustration } from './speed-frustration';
4
4
  export { initThrashCursor, destroyThrashCursor } from './thrash-cursor';
5
5
  export { initLoopNav, destroyLoopNav, recordNavigation } from './loop-nav';
6
6
  export { initScrollBounce, destroyScrollBounce, resetScrollBounce, } from './scroll-bounce';
@@ -8,6 +8,23 @@ export { initFormSignals, destroyFormSignals, resetFormSignals, } from './form-s
8
8
  export { initErrorEncounter, destroyErrorEncounter } from './error-encounter';
9
9
  export { initMobileSignals, destroyMobileSignals } from './mobile-signals';
10
10
  export { initKeyboardSignals, destroyKeyboardSignals, } from './keyboard-signals';
11
- export { initScrollHijack, destroyScrollHijack } from './scroll-hijack';
11
+ export { initScrollHijack, destroyScrollHijack, resetScrollHijack } from './scroll-hijack';
12
12
  export { initScrollDepthAbandon, destroyScrollDepthAbandon, resetScrollDepthAbandon, } from './scroll-depth-abandon';
13
- export { initAdvancedSignals, destroyAdvancedSignals, resetAdvancedSignals, } from './advanced-signals';
13
+ export { initAdvancedSignals, destroyAdvancedSignals, resetAdvancedSignals, resetAdvancedCycle, } from './advanced-signals';
14
+ export { initHelpHunt, destroyHelpHunt, resetHelpHunt } from './help-hunt';
15
+ export { initCloseClick, destroyCloseClick, resetCloseClick } from './close-click';
16
+ export { initCloseClickReversal, destroyCloseClickReversal, resetCloseClickReversal, } from './close-click-reversal';
17
+ export { initFilterSpiral, destroyFilterSpiral, resetFilterSpiral } from './filter-spiral';
18
+ export { initCopyFrustration, destroyCopyFrustration, resetCopyFrustration } from './copy-frustration';
19
+ export { initTextSelectFrustration, destroyTextSelectFrustration, resetTextSelectFrustration, } from './text-select-frustration';
20
+ export { initFrustrationCorrelator, destroyFrustrationCorrelator, setFrustrationCorrelatorPage, } from './frustration-correlator';
21
+ export { initNavigationConfusion, destroyNavigationConfusion, resetNavigationConfusion, recordPageVisit, } from './navigation-confusion';
22
+ export { initScrollToClickConfusion, destroyScrollToClickConfusion, resetScrollToClickConfusion, } from './scroll-to-click-confusion';
23
+ export { initDeadClickTrapZone, destroyDeadClickTrapZone, resetDeadClickTrapZone, } from './dead-click-trap-zone';
24
+ export { initFormValidationLoop, destroyFormValidationLoop, resetFormValidationLoop, } from './form-validation-loop';
25
+ export { initElementImpression, destroyElementImpression, resetElementImpression, } from './element-impression';
26
+ export { initInputCorrection, destroyInputCorrection, resetInputCorrection, } from './input-correction';
27
+ export { initHoverDwell, destroyHoverDwell, resetHoverDwell, } from './hover-dwell';
28
+ export { initExitIntent, destroyExitIntent, resetExitIntent } from './exit-intent';
29
+ export { initPerformanceVitals, destroyPerformanceVitals, resetPerformanceVitals, } from './performance-vitals';
30
+ export { initPasteBlocked, destroyPasteBlocked } from './paste-blocked';
@@ -0,0 +1,3 @@
1
+ export declare function initInputCorrection(ignore?: string[]): void;
2
+ export declare function destroyInputCorrection(): void;
3
+ export declare function resetInputCorrection(): void;
@@ -1,2 +1,2 @@
1
- export declare function initKeyboardSignals(): void;
1
+ export declare function initKeyboardSignals(ignore?: string[]): void;
2
2
  export declare function destroyKeyboardSignals(): void;
@@ -0,0 +1,4 @@
1
+ export declare function initNavigationConfusion(): void;
2
+ export declare function destroyNavigationConfusion(): void;
3
+ export declare function resetNavigationConfusion(): void;
4
+ export declare function recordPageVisit(path: string): void;
@@ -0,0 +1,2 @@
1
+ export declare function initPasteBlocked(ignore?: string[]): void;
2
+ export declare function destroyPasteBlocked(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initPerformanceVitals(): void;
2
+ export declare function destroyPerformanceVitals(): void;
3
+ export declare function resetPerformanceVitals(): void;
@@ -1,2 +1,3 @@
1
1
  export declare function initScrollHijack(): void;
2
2
  export declare function destroyScrollHijack(): void;
3
+ export declare function resetScrollHijack(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initScrollToClickConfusion(): void;
2
+ export declare function destroyScrollToClickConfusion(): void;
3
+ export declare function resetScrollToClickConfusion(): void;
@@ -2,3 +2,4 @@ export declare function initSpeedFrustration(opts?: {
2
2
  delayMs?: number;
3
3
  }, ignore?: string[]): void;
4
4
  export declare function destroySpeedFrustration(): void;
5
+ export declare function resetSpeedFrustration(): void;
@@ -0,0 +1,3 @@
1
+ export declare function initTextSelectFrustration(): void;
2
+ export declare function destroyTextSelectFrustration(): void;
3
+ export declare function resetTextSelectFrustration(): void;
package/dist/types.d.ts CHANGED
@@ -20,6 +20,7 @@ export interface Config {
20
20
  compression?: CompressionMode;
21
21
  ignoreElements?: string[];
22
22
  ignorePages?: string[];
23
+ elementImpressionSelectors?: string[];
23
24
  }
24
25
  export interface SignalOpts {
25
26
  enabled?: boolean;
@@ -44,6 +45,7 @@ export interface Batch {
44
45
  vw: number;
45
46
  vh: number;
46
47
  environment?: string;
48
+ segment?: Record<string, string>;
47
49
  dom_mode: DOMMode;
48
50
  events: IngestEvent[];
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flusterduck",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Lightweight UX confusion monitoring SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",