flusterduck 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 c=/^[:\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&&!c.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 c=o.parentElement;if(c){const e=c.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=c,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,f=/^(INPUT|TEXTAREA|SELECT)$/;function d(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!f.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 w(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 m(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",y=[],b=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1,O=new WeakMap;function $(t){E=t}var U=new Set;function N(t){return U.add(t),()=>{U.delete(t)}}function R(t){S=t}var C=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),j=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),L=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),I=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,B=e(()=>{"hidden"===document.visibilityState&&q()}),P=t(()=>q());function z(t){S||y.length>=100||((t=>{if("sig"!==t.t||!U.size)return;const e=t.d??{},n="string"==typeof e.s?e.s:"";if(!n)return;const o={name:n,element:"string"==typeof e.el?e.el:"",weight:"number"==typeof e.w?e.w:0,meta:e.meta&&"object"==typeof e.meta?e.meta:{},ts:t.ts};for(const t of U)try{t(o)}catch{}})(t),(t=>{if(!E||"sig"!==t.t)return;const e=V(t.d?.s,t.d?.signal_type,t.d?.name);if(e)try{E(e.slice(0,128),t.ts)}catch{}})(t),y.push(t),y.length>=T?q():b||(b=setTimeout(q,k)))}function q(){(async()=>{if(A)return;if(!y.length||!D)return;A=!0,b&&(clearTimeout(b),b=null);const t=y;y=[];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=[];let o={source:[],events:[]};try{for(const r of t){const t=Z(r,D.page,x.domMode),i=[...o.events,t];JSON.stringify({...e,events:i}).length>v?o.events.length>0?(n.push(o),o={source:[r],events:[t]}):(JSON.stringify({...e,events:[t]}).length<=v&&n.push({source:[r],events:[t]}),o={source:[],events:[]}):(o.source.push(r),o.events=i)}o.events.length>0&&n.push(o);for(const t of n)J({...e,events:t.events}).then(e=>{e||X(t.source)}).catch(()=>X(t.source))}catch(t){}finally{A=!1}})()}function X(t){const e=t.filter(t=>{const e=O.get(t)??0;return!(e>=3||(O.set(t,e+1),0))});if(!e.length)return;const n=[...e,...y];y=n.length>100?n.slice(-100):n,b||(b=setTimeout(q,k))}function F(t){if(D)for(const e of Object.keys(t))C.has(e)&&(D[e]=t[e])}async function J(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 s=0;for(;;){const t=await r.read();if(t.done)break;if(s+=t.value.byteLength,s>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const c=new Uint8Array(s);let a=0;for(const t of i)c.set(t,a),a+=t.byteLength;return c.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);return!n||(async(t,e=M)=>{if(!e)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(e,t.beaconBody))return!0}catch{}try{return await fetch(e,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}),!0}catch{return!1}})(n)}function Z(t,e,n){const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":j.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=V(o.el,o.element,o.target);if("signal"===r){i.signal_type=V(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: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:w(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:m(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 c=(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=H(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=H(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(c).length&&(i.metadata=c),i}function H(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>L.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(I.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>H(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=H(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function V(...t){for(const e of t)if("string"==typeof e&&e)return e}function W(t){return"off"===t?"off":"auto"}function Y(t,e){for(const n of e){const e=K(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id"))(t)}var G=/^[a-zA-Z0-9/:._*\-]+$/;function K(t){if(t.length>200)return null;if(!G.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var Q=[".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"]'],tt=[],et=3,nt=2e3,ot=24,rt=[],it=[],st=0,ct=new Map,at=new Map,ut=!1,lt=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,rt))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(;tt.length&&n-tt[0].t>nt;)tt.shift();tt.push({t:n,x:o,y:r});const i=it.length>=3?2:et;if(tt.length<i)return;const s=tt.slice(-i);for(let t=0;t<s.length-1;t++)for(let e=t+1;e<s.length;e++){const n=s[t],o=s[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>ot*ot)return}const c=(s[s.length-1].t-s[0].t)/1e3,u=c>0?s.length/c:s.length,l=Math.round(100*Math.min(1,(s.length-i)/i+u/10))/100,f=((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],s=t[r],c=s.x-i.x,a=s.y-i.y;e+=Math.sqrt(c*c+a*a),n++}i=Math.max(0,2-e/n/ot*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(s,i,u),h=a(e),w=d(e);it.push({selector:h,ts:n});const m=it.length,_=(t=>{const e=(t-st)/6e4;return e<=0?0:Math.round(it.length/e*10)/10})(n),v=ct.get(h)??0,g=v+1,y=at.get(h)??0,b=y>0&&n-y<1e4;ct.set(h,g),at.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=s.reduce((t,e)=>t+e.x,0)/s.length,o=s.reduce((t,e)=>t+e.y,0)/s.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}})();z({t:"sig",ts:n,d:{s:"rage_click",el:h,...w?{el_label:w}:{},cnt:s.length,vel:Math.round(10*u)/10,intensity:l,quality:f,burst_seq:m,burst_rate_per_min:_,repeated_target:M,hot_repeat:b,...k??{}}}),M&&z({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...w?{el_label:w}:{},total_hits:g,burst_count:g,burst_seq:m}}),tt=tt.slice(-(i-1))});function ft(){ut&&(ut=!1,document.removeEventListener("click",lt,{capture:!0,passive:!0}),tt=[],it=[],ct.clear(),at.clear())}var dt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,pt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,ht=/^(A|BUTTON|LABEL)$/,wt=[],mt=null,_t=new Map,vt=e(t=>{mt={x:t.clientX,y:t.clientY}}),gt=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,wt))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!mt)return!1;const e=t.clientX-mt.x,n=t.clientY-mt.y;return Math.sqrt(e*e+n*n)>5})(t);if(mt=null,n)return;if((t=>{if(dt.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&pt.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||!ht.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 s=null,c=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=kt(e,n,r);a<c&&(c=a,s=r)}if(s&&c<100)return s;o=r}return null})(e,t.clientX,t.clientY),r=o?Mt(t.clientX,t.clientY,o):null,i=a(e),s=(_t.get(i)??0)+1;_t.set(i,s);const c=s>=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),f=d(e),h=o?d(o):"";z({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...f?{el_label:f}:{},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}:{},...c?{repeated:!0,repeat_cnt:s}:{}}})});function yt(){document.removeEventListener("mousedown",vt,{capture:!0}),document.removeEventListener("click",gt,{capture:!0}),mt=null,_t.clear()}function bt(){_t.clear()}function Mt(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 kt(t,e,n){return Mt(t,e,n).dist}var Tt=null,Dt=3e3,xt=[],At="click",Et=0,St=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ot=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,$t=e(t=>{const e=t.target;if(!e)return;if(p(e,xt))return;const n=e.getAttribute("role");if(!(St.test(e.tagName)||n&&Ot.test(n)))return;const o=Date.now();if(o-Et>50&&(At="click",Et=o),Tt){if(Tt.el===e||Tt.el.contains(e)){const t=o-Tt.ts;return t>=Dt&&z({t:"sig",ts:o,d:{s:"speed_frustration",el:Tt.selector,delay:t,interaction_type:At,observed_delay_ms:t}}),void jt()}jt()}const r=a(e);let i=!1;const s=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void jt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void jt()}}),c=e.parentElement||document.body;s.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&Tt&&(Tt.observer.disconnect(),Tt={...Tt,timeout:null})},Dt+500);Tt={el:e,selector:r,ts:o,observer:s,timeout:u}}),Ut=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(At="keydown",Et=Date.now()))}),Nt=e(()=>{At="touch",Et=Date.now()});function Rt(){document.removeEventListener("click",$t,{capture:!0}),document.removeEventListener("keydown",Ut,{capture:!0}),document.removeEventListener("touchstart",Nt,{capture:!0}),jt()}function Ct(){jt()}function jt(){Tt&&(Tt.observer.disconnect(),Tt.timeout&&clearTimeout(Tt.timeout),Tt=null)}var Lt=800,It=2e3,Bt=0,Pt=0,zt=0,qt=0,Xt=0,Ft=0,Jt=0,Zt=0,Ht=[],Vt=0,Wt=null,Yt=e(t=>{const e=Date.now();e-Bt<16||(Bt=e,Wt&&clearTimeout(Wt),Wt=setTimeout(()=>Kt(),150),((t,e,n)=>{if(0===qt)return Pt=t,zt=e,qt=n,void(Zt=n);const o=(n-qt)/1e3;if(0===o)return;const r=t-Pt,i=e-zt;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i),c=s/o;Ht.length>=100&&(Ht=Ht.slice(-50)),Ht.push(c),Vt+=s;const a=Math.sign(r),u=Math.sign(i);if(s>=5&&(0!==Xt&&0!==a&&a!==Xt||0!==Ft&&0!==u&&u!==Ft)&&Jt++,Xt=a||Xt,Ft=u||Ft,Pt=t,zt=e,qt=n,n-Zt>It){if(Jt>=3){const t=Ht.reduce((t,e)=>t+e,0)/Ht.length;t>=Lt&&z({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Jt,distance_px:Math.round(Vt)}})}Kt(),Zt=n}})(t.clientX,t.clientY,e))});function Gt(){document.removeEventListener("mousemove",Yt),Wt&&clearTimeout(Wt),Kt()}function Kt(){Jt=0,Ht=[],Vt=0,Xt=0,Ft=0,qt=0,Pt=0,zt=0,Bt=0,Wt=null}var Qt=[],te=[],ee=3e4;function ne(){Qt=[],te=[]}var oe=1e4,re=.5,ie=[],se=0,ce=0,ae=!1,ue=0,le=e(()=>{ae||(ae=!0,requestAnimationFrame(()=>{ae=!1,(()=>{const t=Date.now(),e=window.scrollY;if((ue=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/ue,o=e>se?"down":"up";if(t-ce<100)return void(se=e);for(;ie.length&&t-ie[0].ts>oe;)ie.shift();ie.length>=100&&(ie=ie.slice(-50)),ie.push({depth:n,ts:t,direction:o}),se=e,ce=t;let r=0,i=1,s=0,c=!1,a=0,u=0,l=0,f=1,d=0;for(let t=1;t<ie.length;t++)ie[t].direction!==ie[t-1].direction&&d++;for(let t=0;t<ie.length;t++){const e=ie[t],n=e.depth;if(n>r&&(r=n),n>=re&&(c||(a=e.ts,l=n),c=!0),c&&n<i&&(i=n,u=e.ts,f=n),c&&i<.25&&n>=re){if(u-a<200){c=!1,i=1,a=e.ts,l=n;continue}s++,c=!1,i=1}}if(s>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-f),o=Math.round(n/e*1e3);z({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1,vel:o,dir_changes:d}}),ie=[]}})()}))});function fe(t){oe=t?.windowMs??1e4,re=t?.depthThreshold??.5,window.addEventListener("scroll",le,{passive:!0})}function de(){window.removeEventListener("scroll",le),ie=[],ae=!1}function pe(){ie=[],se=0,ce=0,ae=!1}var he=["textarea",'[role="textbox"]',"[contenteditable]"],we=new Map,me=new Map,_e=new Set,ve=null,ge=0,ye=5e3,be=[],Me=e(t=>{const e=t.target;if(!e||!Oe(e))return;if(p(e,be))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of he)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();we.set(e,n),me.set(e,n);const o=e.closest("form");o&&o!==ve&&(ve=o,ge=o.querySelectorAll("input, select, textarea").length)}),ke=e(t=>{const e=t.target;if(!e||!Oe(e))return;const n=we.get(e),o=me.get(e);we.delete(e),me.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=ye){const n=d(e);z({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)&&_e.add(i)}),Te=e(()=>{_e.clear(),ve=null}),De=t(Se),xe=null;function Ae(){document.removeEventListener("focusin",Me,{capture:!0}),document.removeEventListener("focusout",ke,{capture:!0}),document.removeEventListener("submit",Te,{capture:!0}),window.removeEventListener("pagehide",De),xe&&(document.removeEventListener("visibilitychange",xe),xe=null),we.clear(),me.clear(),_e.clear(),ve=null}function Ee(){Se(),we.clear(),me.clear(),_e.clear(),ve=null,ge=0}function Se(){if(_e.size>0&&ve){const t=ge||_e.size,e=Math.round(_e.size/t*100)/100;z({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:_e.size,total:t,field_count:t,completion_rate:e}}),_e.clear(),ve=null}}function Oe(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var $e=null,Ue=null,Ne=/flusterduck\.com|\/v1\/ingest/,Re=e(t=>{const e=t.message||"Unknown error";var n;z({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:ze(e,200),ep:"",status:0,error_category:(n=e,Ie.test(n)?"network":"script"),url:location.pathname}})}),Ce=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");z({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:ze(e,200),ep:"",status:0,error_category:Be(t.reason),url:location.pathname}})});function je(){window.addEventListener("error",Re),window.addEventListener("unhandledrejection",Ce),$e||($e=window.fetch,Ue=function(t,e){let n;try{n=$e.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;Ne.test(n)||z({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:Pe(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;Ne.test(n)||z({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:ze(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?Pe(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=Ue)}function Le(){window.removeEventListener("error",Re),window.removeEventListener("unhandledrejection",Ce),$e&&Ue&&window.fetch===Ue&&(window.fetch=$e),$e=null,Ue=null}var Ie=/fetch|network|cors|timeout/i;function Be(t){if(t instanceof TypeError&&Ie.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return Ie.test(e)?"network":"unhandled_promise"}function Pe(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 ze(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 qe=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Xe=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Fe=null,Je=0,Ze=1,He=0,Ve=0,We=0,Ye=0,Ge=0,Ke=null,Qe=[],tn=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(Fe={x:e.clientX,y:e.clientY,ts:Date.now()},Je=0):2===t.touches.length&&(Je=cn(t.touches),Fe=null)}),en=e(t=>{if(Je>0){const e=t.touches.length>=2?cn(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&&(Ze=Math.round(e/Je*100)/100),Je=0}if(!Fe)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-Fe.x,o=e.clientY-Fe.y,r=Date.now()-Fe.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,Qe))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 c=s.getBoundingClientRect(),a=Math.max(c.left,Math.min(e,c.right)),u=Math.max(c.top,Math.min(n,c.bottom)),l=Math.sqrt((e-a)**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)),c=Math.sqrt((e-i)**2+(n-s)**2);if(c>0&&c<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;z({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(c),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(qe.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!qe.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";z({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),Fe=null}),nn=e(()=>{const t=Date.now();if(t-Ve>3e4&&(He=0,Ve=t),++He>=2){const e=document.activeElement||document.body;!Xe.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-We>200&&(We=t,z({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:He,pinch_scale:Ze}})),He=0,Ze=1}}),on=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ge>3e4&&(Ye=0,Ge=t),e!==Ke&&(Ye++,Ke=e),Ye>=3&&(z({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:Ye,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),Ye=0)}),rn=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Ve>3e4&&(He=0,Ve=e),++He>=2&&e-We>200){const n=Math.round(100*t.scale)/100;We=e,z({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:He,pinch_scale:n}}),He=0,Ze=1}}});function sn(){document.removeEventListener("touchstart",tn),document.removeEventListener("touchend",en),document.removeEventListener("gesturechange",nn),window.removeEventListener("orientationchange",on),window.visualViewport?.removeEventListener("resize",rn),Fe=null,Je=0,Ze=1,He=0,Ve=0,We=0,Ye=0,Ge=0,Ke=null}function cn(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 an=[],un=null,ln=0,fn=0,dn="",pn=[],hn=[],wn=e(t=>{const e=Date.now(),n=t.target;n&&p(n,hn)||("Tab"===t.key?((t,e,n)=>{for(;an.length&&t-an[0].ts>5e3;)an.shift();an.length>=50&&(an=an.slice(-25));const o=e?a(e):"";if(an.push({ts:t,el:o,shift:n}),an.length>=10){const e=an.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})(an);z({t:"sig",ts:t,d:{s:"tab_thrash",cnt:an.length,els:e,direction_changes:n}}),an=[]}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===un?t-fn<=3e3?(ln++,dn=n,ln>=5&&(z({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:ln,trapped_element:dn}}),ln=0,dn="",un=null)):(fn=t,ln=1,dn=n):(un=r,fn=t,ln=1,dn=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===un){if(t-fn>3e3)return fn=t,ln=1,void(dn=a(e));ln++,dn=a(e),ln>=5&&(z({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:ln,trapped_element:dn}}),ln=0,dn="",un=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(;pn.length&&t-pn[0].ts>5e3;)pn.shift();pn.length>=50&&(pn=pn.slice(-25)),pn.push({ts:t,container:n});const o=pn.filter(t=>t.container===n);o.length>=15&&(z({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),pn=[])})(e,t.target))});function mn(){document.removeEventListener("keydown",wn,{capture:!0}),an=[],pn=[],un=null,ln=0,fn=0,dn="",hn=[]}var _n=0,vn=0,gn=null,yn=0,bn=!1,Mn=0,kn=0,Tn=null,Dn=0,xn=e(()=>{bn||(bn=!0,requestAnimationFrame(()=>{bn=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-vn;if(Math.abs(n)<2)return void(vn=e);const o=n>0?"down":"up";gn&&o!==gn&&(t-yn>3e3&&(_n=0,yn=t),++_n>=4)&&Math.abs(n)>100&&(t-kn>1e4&&(Mn=0,kn=t),Mn++,z({t:"sig",ts:t,d:{s:"scroll_hijack",rev:_n,source:null!==Tn&&t-Dn<=2e3?Tn:"wheel",repeated:Mn>=2}}),_n=0),gn=o,vn=e})()}))}),An=e(()=>{Tn="wheel",Dn=Date.now()}),En=e(()=>{Tn="touch",Dn=Date.now()});function Sn(){window.addEventListener("wheel",An,{passive:!0}),window.addEventListener("touchmove",En,{passive:!0}),window.addEventListener("scroll",xn,{passive:!0})}function On(){window.removeEventListener("wheel",An),window.removeEventListener("touchmove",En),window.removeEventListener("scroll",xn),$n()}function $n(){_n=0,vn=0,gn=null,yn=0,bn=!1,Mn=0,kn=0,Tn=null,Dn=0}var Un=0,Nn=0,Rn=!1,Cn=e(()=>{Rn||(Rn=!0,requestAnimationFrame(()=>{Rn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Un&&(Un=e,0===Nn&&(Nn=Date.now()))}}))}),jn=null,Ln=null;function In(){window.addEventListener("scroll",Cn,{passive:!0}),Ln=t(zn),window.addEventListener("pagehide",Ln),jn=t(()=>{"hidden"===document.visibilityState&&zn()}),document.addEventListener("visibilitychange",jn)}function Bn(){window.removeEventListener("scroll",Cn),Ln&&(window.removeEventListener("pagehide",Ln),Ln=null),jn&&(document.removeEventListener("visibilitychange",jn),jn=null),Un=0,Nn=0,Rn=!1}function Pn(){Un=0,Nn=0,Rn=!1}function zn(){if(Un>.05){const t=Date.now(),e=Nn>0?Math.max(0,t-Nn):0;z({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 qn="",Xn=0,Fn=0,Jn=0,Zn=0,Hn=0,Vn=null,Wn=0,Yn=!1,Gn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==qn||o-Fn>1500)&&(qn=n,Fn=o,Xn=0),(Xn+=1)<4||(z({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Xn,window_ms:1500}}),Xn=0,Fn=o)}),Kn=e(()=>{const t=Date.now(),e=oo(),n=Hn||e,o=Math.abs(e-n)/Math.max(n,1);Hn=e,o<.15||((!Jn||t-Jn>5e3)&&(Jn=t,Zn=0),(Zn+=1)<3||(z({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Zn,area_delta:Math.round(1e3*o)/1e3}}),Zn=0,Jn=t))}),Qn=e(()=>{no()});function to(){Yn||(Yn=!0,Hn=oo(),no(),document.addEventListener("mouseenter",Gn,!0),document.addEventListener("mouseleave",Gn,!0),document.addEventListener("click",Qn,{capture:!0,passive:!0}),document.addEventListener("keydown",Qn,{capture:!0,passive:!0}),document.addEventListener("scroll",Qn,{passive:!0}),window.addEventListener("resize",Kn,{passive:!0}))}function eo(){Yn&&(Yn=!1,document.removeEventListener("mouseenter",Gn,!0),document.removeEventListener("mouseleave",Gn,!0),document.removeEventListener("click",Qn,{capture:!0}),document.removeEventListener("keydown",Qn,{capture:!0}),document.removeEventListener("scroll",Qn),window.removeEventListener("resize",Kn),ro(),qn="",Xn=0,Fn=0,Zn=0,Jn=0,Wn=0)}function no(){ro();const t=Wn+=1;Vn=setTimeout(()=>{z({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function oo(){return Math.max(1,window.innerWidth*window.innerHeight)}function ro(){Vn&&(clearTimeout(Vn),Vn=null)}var io=["[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"]'],so=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,co=[],ao=[],uo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,ao))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(po(e))return!0;if(ho(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;co.length&&n-co[0].t>6e4;)co.shift();const o=a(e);if(co.push({t:n,el:o}),co.length<3)return;const r=new Set(co.map(t=>t.el)).size,i=d(e);z({t:"sig",ts:n,d:{s:"help_hunt",cnt:co.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),co=[]});function lo(){document.removeEventListener("click",uo,{capture:!0}),co=[]}function fo(){co=[]}function po(t){for(const e of io)try{if(t.matches(e))return!0}catch{}return!1}function ho(t){const e=t.id??"",n=t.className??"";return so.test("string"==typeof n?`${e} ${n}`:e)}var wo=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,mo=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,_o=[],vo=new Map,go=[],yo=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,go))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(ko(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=d(e);_o.push({t:n,el:o});const i=(vo.get(o)??0)+1;vo.set(o,i);const s=_o.length,c=(()=>{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}})();z({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:s,element_cnt:i,repeated:i>1,container:To(e),...c??{}}})});function bo(){document.removeEventListener("click",yo,{capture:!0}),_o=[],vo.clear()}function Mo(){_o=[],vo.clear()}function ko(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&&mo.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(wo.test(t.id??"")||wo.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&mo.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 To(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 Do=null,xo=[],Ao=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,xo)||(Do=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:d(e),t:Date.now()}))}),Eo=e(t=>{"Escape"===t.key&&Uo("escape")}),So=e(()=>{Uo("back_nav")});function Oo(){document.removeEventListener("click",Ao,{capture:!0}),document.removeEventListener("keydown",Eo,{capture:!0}),window.removeEventListener("popstate",So),Do=null}function $o(){Do=null}function Uo(t){if(!Do)return;const e=Date.now()-Do.t;e>1500||z({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Do.el,...Do.label?{el_label:Do.label}:{},elapsed_ms:e}}),Do=null}var No=/^(checkbox|radio)$/,Ro=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Co=new Map,jo=[],Lo=e(t=>{const e=t.target;e&&(p(e,jo)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?No.test(t.type??""):Ro.test(t.getAttribute("role")??"")))(e)&&zo(e))}),Io=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,jo))return;const n=e.getAttribute("role")??"";Ro.test(n)&&"INPUT"!==e.tagName&&zo(e)});function Bo(){document.removeEventListener("change",Lo,{capture:!0}),document.removeEventListener("click",Io,{capture:!0}),Co.clear()}function Po(){Co.clear()}function zo(t){const e=a(t),n=Date.now();let o=Co.get(e);for(o||(o=[],Co.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=d(t);z({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),Co.delete(e)}var qo=[],Xo=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(;qo.length&&o-qo[0].t>15e3;)qo.shift();qo.push({t:o}),qo.length<3||(z({t:"sig",ts:o,d:{s:"copy_frustration",cnt:qo.length,window_ms:15e3}}),qo=[])});function Fo(){document.addEventListener("copy",Xo,{capture:!0,passive:!0})}function Jo(){document.removeEventListener("copy",Xo,{capture:!0}),qo=[]}function Zo(){qo=[]}var Ho=[],Vo=0,Wo=null,Yo=null;function Go(){Wo=t(er),Yo=t(tr),document.addEventListener("selectionchange",Wo),document.addEventListener("copy",Yo,{capture:!0,passive:!0}),document.addEventListener("cut",Yo,{capture:!0,passive:!0})}function Ko(){Wo&&(document.removeEventListener("selectionchange",Wo),Wo=null),Yo&&(document.removeEventListener("copy",Yo,{capture:!0}),document.removeEventListener("cut",Yo,{capture:!0}),Yo=null),Ho=[],Vo=0}function Qo(){Ho=[],Vo=0}function tr(){Vo=Date.now(),Ho=[]}function er(){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-Vo<2e3)return;for(;Ho.length&&n-Ho[0].t>15e3;)Ho.shift();const o=Ho[Ho.length-1];o&&n-o.t<500||(Ho.push({t:n}),Ho.length<4||(z({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:Ho.length,window_ms:15e3}}),Ho=[]))}var nr=6e4,or="_fd_sess",rr={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},ir={low:1,medium:2,high:3,critical:4},sr=[],cr=null,ar=!1,ur=new Map,lr={totalSignals:0,pagesWithFrustration:0},fr="",dr=null,pr=null,hr=null,wr=null;function mr(t){ar&&_r(t,Date.now())}function _r(t,e){ur.has(t)||ur.set(t,[]);const n=ur.get(t);n.push(e),n.length>20&&n.shift()}function vr(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 gr(t,e){if(!ar)return;if("frustration_burst"===t)return;const n=e??Date.now();(t=>{const e=t-nr;let n=0;for(;n<sr.length&&sr[n].ts<e;)n++;n>0&&(sr=sr.slice(n))})(n),0===sr.length&&(cr=null),sr.push({type:t,ts:n}),_r(t,n);const{distinctTypes:o,totalWeight:r,typeCounts:i}=(()=>{const t=new Map;let e=0;for(const n of sr)t.set(n.type,(t.get(n.type)??0)+1),e+=rr[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),s=((t,e,n)=>vr(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(o.size,r,i);s&&(null!==cr&&ir[s]<=ir[cr]||(cr=s,((t,e,n,o)=>{const r=vr(o),i=(()=>{const t=[],e=Date.now()-nr,n=[];for(const[t,o]of ur.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})();z({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:fr||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:nr,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:lr.totalSignals,session_pages_with_frustration:lr.pagesWithFrustration}}),lr.totalSignals+=sr.length,lr.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(or,JSON.stringify(lr))}catch{}})()})(s,o,r,i)))}function yr(){ar=!1,sr=[],cr=null,ur=new Map,$(null),dr&&(window.removeEventListener("popstate",dr),dr=null),pr&&(window.removeEventListener("hashchange",pr),pr=null),hr&&(document.removeEventListener("visibilitychange",hr),hr=null),wr&&(window.removeEventListener("pagehide",wr),wr=null)}var br=3e4,Mr=[],kr="",Tr=!1,Dr=e(()=>{Or(location.pathname+location.search+location.hash)}),xr=e(()=>{Or(location.pathname+location.search+location.hash)});function Ar(){Mr=[],Tr=!1,kr=location.pathname+location.search+location.hash,window.addEventListener("popstate",Dr),window.addEventListener("hashchange",xr)}function Er(){window.removeEventListener("popstate",Dr),window.removeEventListener("hashchange",xr),Mr=[],Tr=!1,kr=""}function Sr(){Mr=[],Tr=!1,kr=location.pathname+location.search+location.hash}function Or(t){const e=Date.now();if(kr&&kr!==t){const t=Mr[Mr.length-1];t&&t.path===kr&&null===t.leftAt&&(t.leftAt=e)}for(;Mr.length&&e-Mr[0].ts>br;)Mr.shift();t!==kr&&(Mr.push({path:t,ts:e,leftAt:null}),kr=t),Mr.length<5||Tr||(t=>{const e=Mr.filter(e=>t-e.ts<=br),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),s=Math.max(...r),c=e.map(t=>t.path).slice(-8);Tr=!0,z({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:br,avg_dwell_ms:i,pages:c,max_dwell_ms:s}})})(e)}var $r=[],Ur=!1,Nr="none",Rr=0,Cr=0,jr=0,Lr=!1,Ir=e(()=>{Ur||(Ur=!0,requestAnimationFrame(Xr))}),Br=e(t=>{if(!Lr)return;const e=Date.now();if(e-jr>3e3)return void(Lr=!1);if(window.scrollY+t.clientY>Cr+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(Rr-Cr),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,s=i?a(i):"",c=i?d(i):"";Lr=!1,Rr=window.scrollY,Nr="none",$r=[],z({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:s,...c?{click_el_label:c}:{},scroll_back_pct:r}})});function Pr(){$r=[],Nr="none",Rr=0,Cr=0,jr=0,Lr=!1,Ur=!1,window.addEventListener("scroll",Ir,{passive:!0}),window.addEventListener("click",Br,{capture:!0})}function zr(){window.removeEventListener("scroll",Ir),window.removeEventListener("click",Br,{capture:!0}),qr()}function qr(){$r=[],Nr="none",Rr=0,Cr=0,jr=0,Lr=!1,Ur=!1}function Xr(){Ur=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=$r[$r.length-1];if(o&&t-o.ts<50)return;if($r.push({y:e,ts:t}),$r.length>60&&($r=$r.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==Nr&&Lr&&(Lr=!1),e>Rr&&(Rr=e),void(Nr="down");Lr&&t-jr>3e3&&(Lr=!1),"down"===Nr&&Rr-e>=.3*n&&!Lr&&(Cr=e,jr=t,Lr=!0),Nr="up"}}var Fr=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Jr=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Zr=/^(A|BUTTON|LABEL)$/,Hr=new Map,Vr=[],Wr=null,Yr=e(t=>{Wr={x:t.clientX,y:t.clientY}}),Gr=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,Vr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Wr)return!1;const e=t.clientX-Wr.x,n=t.clientY-Wr.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Fr.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Jr.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||!Zr.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(),s=a(e),c=(Hr.get(r)??[]).filter(t=>i-t.ts<9e4);if(c.push({ts:i,selector:s}),Hr.set(r,c),c.length>=3){const t=new Map;for(const e of c)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",s=0;for(const[n,o]of t)o>s&&(s=o,e=n);const a=new Set,u=[];for(const t of c)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?d(t):""}catch{return""}})();z({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:c.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Hr.set(r,[])}});function Kr(){document.removeEventListener("mousedown",Yr,{capture:!0}),document.removeEventListener("click",Gr,{capture:!0}),Wr=null,Hr.clear()}function Qr(){Hr.clear()}var ti=12e4,ei=new Map,ni=[],oi=null,ri=e(t=>{const e=t.target;e&&pi(e)}),ii=e(t=>{const e=t.target;if(!e||!li(e))return;if(p(e,ni))return;const n=a(e);ei.has(n)||ui(e)&&di(e,n)});function si(){document.removeEventListener("invalid",ri,{capture:!0}),document.removeEventListener("input",ii,{capture:!0}),document.removeEventListener("change",ii,{capture:!0}),oi&&(oi.disconnect(),oi=null);for(const t of ei.values())fi(t);ei.clear()}function ci(){for(const t of ei.values())fi(t);ei.clear()}function ai(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function ui(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 li(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function fi(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function di(t,n){const o=(t=>e(e=>{wi(t)}))(n),r=(t=>e(e=>{wi(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 ei.set(n,i),i}function pi(t){if(!li(t))return;if(p(t,ni))return;const e=Date.now();(t=>{for(const[e,n]of ei)t-n.lastTs>ti&&(fi(n),ei.delete(e))})(e);const n=a(t),o=ei.get(n);if(!o)return void di(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(z({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ti,field_type:ai(t)}}),fi(o),ei.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(z({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ti,field_type:ai(t)}}),fi(o),ei.delete(n)))}function hi(t){if(!li(t))return;const e=Date.now(),n=a(t),o=ei.get(n);return o?e-o.lastTs>ti?(fi(o),void ei.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function wi(t){const e=Date.now(),n=ei.get(t);if(n){if(e-n.lastTs>ti)return fi(n),void ei.delete(t);if(n.lastTs=e,ui(n.el))return n.cycles+=1,void(n.cycles>=3&&(z({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...d(n.el)?{el_label:d(n.el)}:{},cycles:n.cycles,window_ms:ti,field_type:ai(n.el)}}),fi(n),ei.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function mi(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!li(t))continue;if(p(t,ni))continue;const n=e.oldValue,o="true"===n||""===n,r=ui(t);r&&!o?pi(t):!r&&o&&hi(t)}}var _i=null,vi=null,gi=[],yi=0,bi=new Map;function Mi(){_i&&(_i.disconnect(),_i=null),vi&&(vi.disconnect(),vi=null),bi.clear()}function ki(){bi.clear(),_i&&Ti()}function Ti(){for(const t of gi)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Di(e[t])}catch{}}function Di(t){bi.has(t)||(bi.set(t,{firstSeenTs:0,emitted:!1}),_i.observe(t))}function xi(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 gi)try{n.matches(t)&&Di(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Di(e[t])}catch{}}}function Ai(t){const e=Date.now();for(const n of t){const t=bi.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",s=a(n.target),c=d(n.target);z({t:"sig",ts:e,d:{s:"element_impression",el:s,...c?{el_label:c}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-yi),viewport_position:i}})}}}var Ei=new Map,Si=[],Oi=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,Si))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Ei.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=d(e);return z({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:Ni(e)}}),void Ei.delete(r)}i.lastValue=o}else Ei.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function $i(){document.removeEventListener("input",Oi,{capture:!0}),Ei.clear()}function Ui(){Ei.clear()}function Ni(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Ri=null,Ci=2e3,ji=[],Li=new Map,Ii=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,ji))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(Ri?.selector===n)return;Xi();const o=Date.now();if(o-(Li.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=d(e);Li.set(n,t),Ri=null,z({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Ci);Ri={el:e,selector:n,startTs:r,timer:i}}),Bi=e(t=>{if(!Ri)return;const e=t.target;if(e!==Ri.el&&!Ri.el.contains(e))return;const n=t.relatedTarget;n&&Ri.el.contains(n)||Xi()}),Pi=e(Xi);function zi(){document.removeEventListener("mouseover",Ii),document.removeEventListener("mouseout",Bi),document.removeEventListener("click",Pi,{capture:!0}),Xi(),Li.clear()}function qi(){Xi(),Li.clear()}function Xi(){Ri&&(clearTimeout(Ri.timer),Ri=null)}var Fi=0,Ji=0,Zi=null,Hi=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Fi<3e3||n-Ji<6e4||(Zi&&clearTimeout(Zi),Zi=setTimeout(t(()=>{const t=Date.now();Ji=t,Zi=null,z({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Fi)}})}),500))});function Vi(){Fi=Date.now(),Ji=0,document.addEventListener("mouseleave",Hi)}function Wi(){document.removeEventListener("mouseleave",Hi),Zi&&(clearTimeout(Zi),Zi=null)}function Yi(){Fi=Date.now(),Ji=0,Zi&&(clearTimeout(Zi),Zi=null)}var Gi=null,Ki=null,Qi=null,ts=0;function es(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function ns(){if("undefined"!=typeof PerformanceObserver){try{(Gi=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);z({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:es(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Gi=null}try{(Ki=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||z({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:es(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Ki=null}try{(Qi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ts+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Qi=null}}}function os(){if(Qi){if(Qi.disconnect(),Qi=null,ts>0){const t=Math.round(1e3*ts)/1e3;z({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:es(ts,.1,.25)}})}ts=0}}function rs(){Gi&&(Gi.disconnect(),Gi=null),Ki&&(Ki.disconnect(),Ki=null),os()}function is(){if(os(),"undefined"!=typeof PerformanceObserver)try{(Qi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ts+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Qi=null}}var ss=[],cs=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,ss))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=d(e);z({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:us(e)}})},100)});function as(){document.removeEventListener("paste",cs,{capture:!0})}function us(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var ls=!1,fs=null,ds=null,ps=[],hs="__flusterduck_instance__",ws=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,ms=[];function _s(e){if(ls)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(ds=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(ds=e);if(!(()=>{const t=window;return!(t[hs]&&t[hs]!==ws||(t[hs]=ws,0))})())return void(ds=e);ds=e,ls=!0,"function"==typeof e.onSignal&&ps.push(N(e.onSignal)),e.emitSignalEvents&&ps.push(N(ks));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),c=(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=Y(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:W(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.removeEventListener("visibilitychange",B),window.removeEventListener("pagehide",P),document.addEventListener("visibilitychange",B),window.addEventListener("pagehide",P)})(c,{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 f=Ds(location.pathname,e.ignorePages??[]);f&&R(!0);const d=document.referrer;let p="";if(d)try{p=new URL(d).origin+new URL(d).pathname}catch{p=""}f||z({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[];ms=[];for(const n of function(e,n,o){const r=t=>{const n=e.signals?.[t];return!1!==n?.enabled},i=!1!==e.trackForms;return[{when:()=>r("rageClick"),start:()=>((t,e)=>{ut||(ut=!0,et=t?.threshold??3,nt=t?.windowMs??2e3,ot=t?.radius&&t.radius>0?t.radius:24,rt=[...Q,...e??[]],st=Date.now(),tt=[],it=[],ct.clear(),at.clear(),document.addEventListener("click",lt,{capture:!0,passive:!0}))})(e.signals?.rageClick,n),stop:ft},{when:()=>r("deadClick"),start:()=>(t=>{wt=t??[],document.addEventListener("mousedown",vt,{capture:!0,passive:!0}),document.addEventListener("click",gt,{capture:!0,passive:!0})})(n),stop:yt,reset:bt},{when:()=>r("speedFrustration"),start:()=>{const t=e.signals?.speedFrustration;((t,e)=>{Dt=t?.delayMs??3e3,xt=e??[],document.addEventListener("click",$t,{capture:!0,passive:!0}),document.addEventListener("keydown",Ut,{capture:!0,passive:!0}),document.addEventListener("touchstart",Nt,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,n)},stop:Rt,reset:Ct},{when:()=>!1!==e.trackMouse&&r("thrashCursor"),start:()=>{const t=e.signals?.thrashCursor;var n;n=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,Lt=n?.velocityThreshold??800,It=n?.windowMs??2e3,document.addEventListener("mousemove",Yt,{passive:!0})},stop:Gt},{when:()=>r("loopNav"),start:()=>{return t=e.signals?.loopNav,void(ee=t?.windowMs??3e4);var t},stop:ne},{when:()=>r("scrollBounce"),start:fe,stop:de,reset:pe},{when:()=>i&&(r("formHesitation")||r("formAbandon")),start:()=>{const o=e.signals?.formHesitation;((e,n)=>{ye=e?.pauseMs??5e3,be=n??[],document.addEventListener("focusin",Me,{capture:!0,passive:!0}),document.addEventListener("focusout",ke,{capture:!0,passive:!0}),document.addEventListener("submit",Te,{capture:!0,passive:!0}),window.addEventListener("pagehide",De),xe=t(()=>{"hidden"===document.visibilityState&&Se()}),document.addEventListener("visibilitychange",xe)})(o?{pauseMs:o.threshold}:void 0,n)},stop:Ae,reset:Ee},{when:()=>i&&r("formValidationLoop"),start:()=>(t=>{ni=t??[],document.addEventListener("invalid",ri,{capture:!0,passive:!0}),document.addEventListener("input",ii,{capture:!0,passive:!0}),document.addEventListener("change",ii,{capture:!0,passive:!0}),(oi=new MutationObserver(mi)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(n),stop:si,reset:ci},{when:()=>r("errorEncounter"),start:je,stop:Le},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>(t=>{Qe=t??[],document.addEventListener("touchstart",tn,{passive:!0}),document.addEventListener("touchend",en,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",nn,{passive:!0}),window.addEventListener("orientationchange",on,{passive:!0})),window.visualViewport?.addEventListener("resize",rn)})(n),stop:sn},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>(t=>{hn=t??[],document.addEventListener("keydown",wn,{capture:!0,passive:!0})})(n),stop:mn},{when:()=>r("scrollHijack"),start:Sn,stop:On,reset:$n},{when:()=>r("scrollDepthAbandon"),start:In,stop:Bn,reset:Pn},{when:()=>r("advancedHeuristics"),start:to,stop:eo,reset:()=>{no(),Wn=0}},{when:()=>r("helpHunt"),start:()=>(t=>{ao=t??[],document.addEventListener("click",uo,{capture:!0,passive:!0})})(n),stop:lo,reset:fo},{when:()=>r("closeClick"),start:()=>(t=>{go=t??[],document.addEventListener("click",yo,{capture:!0,passive:!0})})(n),stop:bo,reset:Mo},{when:()=>r("closeClickReversal"),start:()=>(t=>{xo=t??[],document.addEventListener("click",Ao,{capture:!0,passive:!0}),document.addEventListener("keydown",Eo,{capture:!0,passive:!0}),window.addEventListener("popstate",So)})(n),stop:Oo,reset:$o},{when:()=>r("filterSpiral"),start:()=>(t=>{jo=t??[],document.addEventListener("change",Lo,{capture:!0,passive:!0}),document.addEventListener("click",Io,{capture:!0,passive:!0})})(n),stop:Bo,reset:Po},{when:()=>r("copyFrustration"),start:Fo,stop:Jo,reset:Zo},{when:()=>r("textSelectFrustration"),start:Go,stop:Ko,reset:Qo},{when:()=>r("deadClickTrapZone"),start:()=>(t=>{Vr=t??[],document.addEventListener("mousedown",Yr,{capture:!0,passive:!0}),document.addEventListener("click",Gr,{capture:!0,passive:!0})})(n),stop:Kr,reset:Qr},{when:()=>!0,start:()=>(t=>{sr=[],cr=null,ar=!0,ur=new Map,fr=t??"",(()=>{try{const t=sessionStorage.getItem(or);if(t){const e=JSON.parse(t);lr={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),$(gr),dr=()=>mr("popstate"),pr=()=>mr("hashchange"),hr=()=>{"hidden"===document.visibilityState&&mr("visibilitychange")},wr=()=>mr("pagehide"),window.addEventListener("popstate",dr),window.addEventListener("hashchange",pr),document.addEventListener("visibilitychange",hr),window.addEventListener("pagehide",wr)})(o),stop:yr},{when:()=>r("navigationConfusion"),start:Ar,stop:Er,reset:Sr},{when:()=>r("scrollToClickConfusion"),start:Pr,stop:zr,reset:qr},{when:()=>r("elementImpression"),start:()=>{return n=e.elementImpressionSelectors,gi=n?.length?n:["[data-fd-impression]"],yi=Date.now(),void("undefined"!=typeof IntersectionObserver&&(_i=new IntersectionObserver(t(Ai),{threshold:[0,.5,1]}),Ti(),(vi=new MutationObserver(t(xi))).observe(document.body,{childList:!0,subtree:!0})));var n},stop:Mi,reset:ki},{when:()=>i&&r("inputCorrection"),start:()=>(t=>{Si=t??[],document.addEventListener("input",Oi,{capture:!0,passive:!0})})(n),stop:$i,reset:Ui},{when:()=>i&&r("pasteBlocked"),start:()=>(t=>{ss=t??[],document.addEventListener("paste",cs,{capture:!0,passive:!0})})(n),stop:as},{when:()=>r("hoverDwell"),start:()=>{const t=e.signals?.hoverDwell;((t,e)=>{Ci=t?.dwellMs??2e3,ji=e??[],document.addEventListener("mouseover",Ii,{passive:!0}),document.addEventListener("mouseout",Bi,{passive:!0}),document.addEventListener("click",Pi,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,n)},stop:zi,reset:qi},{when:()=>r("exitIntent"),start:Vi,stop:Wi,reset:Yi},{when:()=>r("performanceVitals"),start:ns,stop:rs,reset:is}]}(e,h,a))n.when()&&(n.start(),ms.push({stop:n.stop,reset:n.reset}));fs=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)=>{for(const t of ms)t.reset?.();q(),Or(n),(t=>{fr=t})(n);const o=Y(n,e.pageRules??[]),r=Ds(n,e.ignorePages??[]);R(r),F({page:o,url:t}),(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>ee;)Qt.shift();for(;te.length&&e-te[0].ts>ee;)te.shift();if(Qt.length>=100&&(Qt=Qt.slice(-50)),te.length>=100&&(te=te.slice(-50)),Qt.push({path:t,ts:e}),r){te.push({path:t,ts:e});const n=te.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 z({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(te=te.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 s=[];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){s.push(...Array.from(n)),i=!0;break}}i&&(z({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:Qt.slice(-5).map(t=>t.path)}}),Qt=[{path:t,ts:e}],te=te.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(n),r||z({t:"pv",ts:Date.now(),d:{ref:""}})}))}function vs(t,e){if(!ls)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);z({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 gs(t,e={}){if(!ls)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||z({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ys(t){if(!ls)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++)}F({segment:e})}function bs(t){t&&ds&&!ls?_s(ds):t||(Ts(),r())}function Ms(){Ts(),r()}function ks(t){if("undefined"!=typeof window&&"undefined"!=typeof CustomEvent)try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:t}))}catch{}}function Ts(){if(ls){for(const t of ps)t();ps=[];for(const t of ms)t.stop();ms=[],q(),S=!1,document.removeEventListener("visibilitychange",B),window.removeEventListener("pagehide",P),b&&(clearTimeout(b),b=null),fs&&(fs(),fs=null),(()=>{const t=window;t[hs]===ws&&delete t[hs]})(),ls=!1}}function Ds(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 xs(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:xs(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{}_s(o),t.flusterduck=Object.freeze({init:_s,signal:vs,track:gs,identify:ys,setConsent:bs,optOut:Ms,destroy:Ts})}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(){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 c=/^[:\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&&!c.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 c=o.parentElement;if(c){const e=c.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=c,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,f=/^(INPUT|TEXTAREA|SELECT)$/;function d(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!f.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 w(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 m(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",y=[],b=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1,O=!0;function $(t){O=t}var U=new WeakMap;function N(t){E=t}var R=new Set;function C(t){return R.add(t),()=>{R.delete(t)}}function j(t){S=t}var L=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),I=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),B=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),P=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,z=e(()=>{"hidden"===document.visibilityState&&F()}),q=t(()=>F());function X(t){S||y.length>=100||((t=>{if("sig"!==t.t||!R.size)return;const e=t.d??{},n="string"==typeof e.s?e.s:"";if(!n)return;const o={name:n,element:"string"==typeof e.el?e.el:"",weight:"number"==typeof e.w?e.w:0,meta:e.meta&&"object"==typeof e.meta?e.meta:{},ts:t.ts};for(const t of R)try{t(o)}catch{}})(t),(t=>{if(!E||"sig"!==t.t)return;const e=Y(t.d?.s,t.d?.signal_type,t.d?.name);if(e)try{E(e.slice(0,128),t.ts)}catch{}})(t),O&&(y.push(t),y.length>=T?F():b||(b=setTimeout(F,k))))}function F(){(async()=>{if(A)return;if(!y.length||!D)return;A=!0,b&&(clearTimeout(b),b=null);const t=y;y=[];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=[];let o={source:[],events:[]};try{for(const r of t){const t=V(r,D.page,x.domMode),i=[...o.events,t];JSON.stringify({...e,events:i}).length>v?o.events.length>0?(n.push(o),o={source:[r],events:[t]}):(JSON.stringify({...e,events:[t]}).length<=v&&n.push({source:[r],events:[t]}),o={source:[],events:[]}):(o.source.push(r),o.events=i)}o.events.length>0&&n.push(o);for(const t of n)H({...e,events:t.events}).then(e=>{e||J(t.source)}).catch(()=>J(t.source))}catch(t){}finally{A=!1}})()}function J(t){const e=t.filter(t=>{const e=U.get(t)??0;return!(e>=3||(U.set(t,e+1),0))});if(!e.length)return;const n=[...e,...y];y=n.length>100?n.slice(-100):n,b||(b=setTimeout(F,k))}function Z(t){if(D)for(const e of Object.keys(t))L.has(e)&&(D[e]=t[e])}async function H(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 s=0;for(;;){const t=await r.read();if(t.done)break;if(s+=t.value.byteLength,s>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const c=new Uint8Array(s);let a=0;for(const t of i)c.set(t,a),a+=t.byteLength;return c.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);return!n||(async(t,e=M)=>{if(!e)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(e,t.beaconBody))return!0}catch{}try{return await fetch(e,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}),!0}catch{return!1}})(n)}function V(t,e,n){const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":I.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=Y(o.el,o.element,o.target);if("signal"===r){i.signal_type=Y(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: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:w(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:m(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 c=(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=W(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=W(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(c).length&&(i.metadata=c),i}function W(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>B.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(P.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>W(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=W(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function Y(...t){for(const e of t)if("string"==typeof e&&e)return e}function G(t){return"off"===t?"off":"auto"}function K(t,e){for(const n of e){const e=tt(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id"))(t)}var Q=/^[a-zA-Z0-9/:._*\-]+$/;function tt(t){if(t.length>200)return null;if(!Q.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var et=[".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"]'],nt=[],ot=3,rt=2e3,it=24,st=[],ct=[],at=0,ut=new Map,lt=new Map,ft=!1,dt=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,st))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(;nt.length&&n-nt[0].t>rt;)nt.shift();nt.push({t:n,x:o,y:r});const i=ct.length>=3?2:ot;if(nt.length<i)return;const s=nt.slice(-i);for(let t=0;t<s.length-1;t++)for(let e=t+1;e<s.length;e++){const n=s[t],o=s[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>it*it)return}const c=(s[s.length-1].t-s[0].t)/1e3,u=c>0?s.length/c:s.length,l=Math.round(100*Math.min(1,(s.length-i)/i+u/10))/100,f=((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],s=t[r],c=s.x-i.x,a=s.y-i.y;e+=Math.sqrt(c*c+a*a),n++}i=Math.max(0,2-e/n/it*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(s,i,u),h=a(e),w=d(e);ct.push({selector:h,ts:n});const m=ct.length,_=(t=>{const e=(t-at)/6e4;return e<=0?0:Math.round(ct.length/e*10)/10})(n),v=ut.get(h)??0,g=v+1,y=lt.get(h)??0,b=y>0&&n-y<1e4;ut.set(h,g),lt.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=s.reduce((t,e)=>t+e.x,0)/s.length,o=s.reduce((t,e)=>t+e.y,0)/s.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}})();X({t:"sig",ts:n,d:{s:"rage_click",el:h,...w?{el_label:w}:{},cnt:s.length,vel:Math.round(10*u)/10,intensity:l,quality:f,burst_seq:m,burst_rate_per_min:_,repeated_target:M,hot_repeat:b,...k??{}}}),M&&X({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...w?{el_label:w}:{},total_hits:g,burst_count:g,burst_seq:m}}),nt=nt.slice(-(i-1))});function pt(){ft&&(ft=!1,document.removeEventListener("click",dt,{capture:!0,passive:!0}),nt=[],ct=[],ut.clear(),lt.clear())}var ht=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,wt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,mt=/^(A|BUTTON|LABEL)$/,_t=[],vt=null,gt=new Map,yt=e(t=>{vt={x:t.clientX,y:t.clientY}}),bt=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,_t))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!vt)return!1;const e=t.clientX-vt.x,n=t.clientY-vt.y;return Math.sqrt(e*e+n*n)>5})(t);if(vt=null,n)return;if((t=>{if(ht.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&wt.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||!mt.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 s=null,c=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=Dt(e,n,r);a<c&&(c=a,s=r)}if(s&&c<100)return s;o=r}return null})(e,t.clientX,t.clientY),r=o?Tt(t.clientX,t.clientY,o):null,i=a(e),s=(gt.get(i)??0)+1;gt.set(i,s);const c=s>=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),f=d(e),h=o?d(o):"";X({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...f?{el_label:f}:{},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}:{},...c?{repeated:!0,repeat_cnt:s}:{}}})});function Mt(){document.removeEventListener("mousedown",yt,{capture:!0}),document.removeEventListener("click",bt,{capture:!0}),vt=null,gt.clear()}function kt(){gt.clear()}function Tt(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 Dt(t,e,n){return Tt(t,e,n).dist}var xt=null,At=3e3,Et=[],St="click",Ot=0,$t=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ut=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Nt=e(t=>{const e=t.target;if(!e)return;if(p(e,Et))return;const n=e.getAttribute("role");if(!($t.test(e.tagName)||n&&Ut.test(n)))return;const o=Date.now();if(o-Ot>50&&(St="click",Ot=o),xt){if(xt.el===e||xt.el.contains(e)){const t=o-xt.ts;return t>=At&&X({t:"sig",ts:o,d:{s:"speed_frustration",el:xt.selector,delay:t,interaction_type:St,observed_delay_ms:t}}),void It()}It()}const r=a(e);let i=!1;const s=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void It();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void It()}}),c=e.parentElement||document.body;s.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&xt&&(xt.observer.disconnect(),xt={...xt,timeout:null})},At+500);xt={el:e,selector:r,ts:o,observer:s,timeout:u}}),Rt=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(St="keydown",Ot=Date.now()))}),Ct=e(()=>{St="touch",Ot=Date.now()});function jt(){document.removeEventListener("click",Nt,{capture:!0}),document.removeEventListener("keydown",Rt,{capture:!0}),document.removeEventListener("touchstart",Ct,{capture:!0}),It()}function Lt(){It()}function It(){xt&&(xt.observer.disconnect(),xt.timeout&&clearTimeout(xt.timeout),xt=null)}var Bt=800,Pt=2e3,zt=0,qt=0,Xt=0,Ft=0,Jt=0,Zt=0,Ht=0,Vt=0,Wt=[],Yt=0,Gt=null,Kt=e(t=>{const e=Date.now();e-zt<16||(zt=e,Gt&&clearTimeout(Gt),Gt=setTimeout(()=>te(),150),((t,e,n)=>{if(0===Ft)return qt=t,Xt=e,Ft=n,void(Vt=n);const o=(n-Ft)/1e3;if(0===o)return;const r=t-qt,i=e-Xt;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i),c=s/o;Wt.length>=100&&(Wt=Wt.slice(-50)),Wt.push(c),Yt+=s;const a=Math.sign(r),u=Math.sign(i);if(s>=5&&(0!==Jt&&0!==a&&a!==Jt||0!==Zt&&0!==u&&u!==Zt)&&Ht++,Jt=a||Jt,Zt=u||Zt,qt=t,Xt=e,Ft=n,n-Vt>Pt){if(Ht>=3){const t=Wt.reduce((t,e)=>t+e,0)/Wt.length;t>=Bt&&X({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Ht,distance_px:Math.round(Yt)}})}te(),Vt=n}})(t.clientX,t.clientY,e))});function Qt(){document.removeEventListener("mousemove",Kt),Gt&&clearTimeout(Gt),te()}function te(){Ht=0,Wt=[],Yt=0,Jt=0,Zt=0,Ft=0,qt=0,Xt=0,zt=0,Gt=null}var ee=[],ne=[],oe=3e4;function re(){ee=[],ne=[]}var ie=1e4,se=.5,ce=[],ae=0,ue=0,le=!1,fe=0,de=e(()=>{le||(le=!0,requestAnimationFrame(()=>{le=!1,(()=>{const t=Date.now(),e=window.scrollY;if((fe=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/fe,o=e>ae?"down":"up";if(t-ue<100)return void(ae=e);for(;ce.length&&t-ce[0].ts>ie;)ce.shift();ce.length>=100&&(ce=ce.slice(-50)),ce.push({depth:n,ts:t,direction:o}),ae=e,ue=t;let r=0,i=1,s=0,c=!1,a=0,u=0,l=0,f=1,d=0;for(let t=1;t<ce.length;t++)ce[t].direction!==ce[t-1].direction&&d++;for(let t=0;t<ce.length;t++){const e=ce[t],n=e.depth;if(n>r&&(r=n),n>=se&&(c||(a=e.ts,l=n),c=!0),c&&n<i&&(i=n,u=e.ts,f=n),c&&i<.25&&n>=se){if(u-a<200){c=!1,i=1,a=e.ts,l=n;continue}s++,c=!1,i=1}}if(s>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-f),o=Math.round(n/e*1e3);X({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1,vel:o,dir_changes:d}}),ce=[]}})()}))});function pe(t){ie=t?.windowMs??1e4,se=t?.depthThreshold??.5,window.addEventListener("scroll",de,{passive:!0})}function he(){window.removeEventListener("scroll",de),ce=[],le=!1}function we(){ce=[],ae=0,ue=0,le=!1}var me=["textarea",'[role="textbox"]',"[contenteditable]"],_e=new Map,ve=new Map,ge=new Set,ye=null,be=0,Me=5e3,ke=[],Te=e(t=>{const e=t.target;if(!e||!Ue(e))return;if(p(e,ke))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of me)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();_e.set(e,n),ve.set(e,n);const o=e.closest("form");o&&o!==ye&&(ye=o,be=o.querySelectorAll("input, select, textarea").length)}),De=e(t=>{const e=t.target;if(!e||!Ue(e))return;const n=_e.get(e),o=ve.get(e);_e.delete(e),ve.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=Me){const n=d(e);X({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)&&ge.add(i)}),xe=e(()=>{ge.clear(),ye=null}),Ae=t($e),Ee=null;function Se(){document.removeEventListener("focusin",Te,{capture:!0}),document.removeEventListener("focusout",De,{capture:!0}),document.removeEventListener("submit",xe,{capture:!0}),window.removeEventListener("pagehide",Ae),Ee&&(document.removeEventListener("visibilitychange",Ee),Ee=null),_e.clear(),ve.clear(),ge.clear(),ye=null}function Oe(){$e(),_e.clear(),ve.clear(),ge.clear(),ye=null,be=0}function $e(){if(ge.size>0&&ye){const t=be||ge.size,e=Math.round(ge.size/t*100)/100;X({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:ge.size,total:t,field_count:t,completion_rate:e}}),ge.clear(),ye=null}}function Ue(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var Ne=null,Re=null,Ce=/flusterduck\.com|\/v1\/ingest/,je=e(t=>{const e=t.message||"Unknown error";var n;X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Xe(e,200),ep:"",status:0,error_category:(n=e,Pe.test(n)?"network":"script"),url:location.pathname}})}),Le=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Xe(e,200),ep:"",status:0,error_category:ze(t.reason),url:location.pathname}})});function Ie(){window.addEventListener("error",je),window.addEventListener("unhandledrejection",Le),Ne||(Ne=window.fetch,Re=function(t,e){let n;try{n=Ne.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;Ce.test(n)||X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:qe(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;Ce.test(n)||X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Xe(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?qe(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=Re)}function Be(){window.removeEventListener("error",je),window.removeEventListener("unhandledrejection",Le),Ne&&Re&&window.fetch===Re&&(window.fetch=Ne),Ne=null,Re=null}var Pe=/fetch|network|cors|timeout/i;function ze(t){if(t instanceof TypeError&&Pe.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return Pe.test(e)?"network":"unhandled_promise"}function qe(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 Xe(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 Fe=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Je=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Ze=null,He=0,Ve=1,We=0,Ye=0,Ge=0,Ke=0,Qe=0,tn=null,en=[],nn=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(Ze={x:e.clientX,y:e.clientY,ts:Date.now()},He=0):2===t.touches.length&&(He=un(t.touches),Ze=null)}),on=e(t=>{if(He>0){const e=t.touches.length>=2?un(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&&(Ve=Math.round(e/He*100)/100),He=0}if(!Ze)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-Ze.x,o=e.clientY-Ze.y,r=Date.now()-Ze.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,en))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 c=s.getBoundingClientRect(),a=Math.max(c.left,Math.min(e,c.right)),u=Math.max(c.top,Math.min(n,c.bottom)),l=Math.sqrt((e-a)**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)),c=Math.sqrt((e-i)**2+(n-s)**2);if(c>0&&c<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;X({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(c),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(Fe.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!Fe.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";X({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),Ze=null}),rn=e(()=>{const t=Date.now();if(t-Ye>3e4&&(We=0,Ye=t),++We>=2){const e=document.activeElement||document.body;!Je.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Ge>200&&(Ge=t,X({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:We,pinch_scale:Ve}})),We=0,Ve=1}}),sn=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Qe>3e4&&(Ke=0,Qe=t),e!==tn&&(Ke++,tn=e),Ke>=3&&(X({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:Ke,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),Ke=0)}),cn=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Ye>3e4&&(We=0,Ye=e),++We>=2&&e-Ge>200){const n=Math.round(100*t.scale)/100;Ge=e,X({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:We,pinch_scale:n}}),We=0,Ve=1}}});function an(){document.removeEventListener("touchstart",nn),document.removeEventListener("touchend",on),document.removeEventListener("gesturechange",rn),window.removeEventListener("orientationchange",sn),window.visualViewport?.removeEventListener("resize",cn),Ze=null,He=0,Ve=1,We=0,Ye=0,Ge=0,Ke=0,Qe=0,tn=null}function un(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 ln=[],fn=null,dn=0,pn=0,hn="",wn=[],mn=[],_n=e(t=>{const e=Date.now(),n=t.target;n&&p(n,mn)||("Tab"===t.key?((t,e,n)=>{for(;ln.length&&t-ln[0].ts>5e3;)ln.shift();ln.length>=50&&(ln=ln.slice(-25));const o=e?a(e):"";if(ln.push({ts:t,el:o,shift:n}),ln.length>=10){const e=ln.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})(ln);X({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ln.length,els:e,direction_changes:n}}),ln=[]}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===fn?t-pn<=3e3?(dn++,hn=n,dn>=5&&(X({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:dn,trapped_element:hn}}),dn=0,hn="",fn=null)):(pn=t,dn=1,hn=n):(fn=r,pn=t,dn=1,hn=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===fn){if(t-pn>3e3)return pn=t,dn=1,void(hn=a(e));dn++,hn=a(e),dn>=5&&(X({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:dn,trapped_element:hn}}),dn=0,hn="",fn=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(;wn.length&&t-wn[0].ts>5e3;)wn.shift();wn.length>=50&&(wn=wn.slice(-25)),wn.push({ts:t,container:n});const o=wn.filter(t=>t.container===n);o.length>=15&&(X({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),wn=[])})(e,t.target))});function vn(){document.removeEventListener("keydown",_n,{capture:!0}),ln=[],wn=[],fn=null,dn=0,pn=0,hn="",mn=[]}var gn=0,yn=0,bn=null,Mn=0,kn=!1,Tn=0,Dn=0,xn=null,An=0,En=e(()=>{kn||(kn=!0,requestAnimationFrame(()=>{kn=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-yn;if(Math.abs(n)<2)return void(yn=e);const o=n>0?"down":"up";bn&&o!==bn&&(t-Mn>3e3&&(gn=0,Mn=t),++gn>=4)&&Math.abs(n)>100&&(t-Dn>1e4&&(Tn=0,Dn=t),Tn++,X({t:"sig",ts:t,d:{s:"scroll_hijack",rev:gn,source:null!==xn&&t-An<=2e3?xn:"wheel",repeated:Tn>=2}}),gn=0),bn=o,yn=e})()}))}),Sn=e(()=>{xn="wheel",An=Date.now()}),On=e(()=>{xn="touch",An=Date.now()});function $n(){window.addEventListener("wheel",Sn,{passive:!0}),window.addEventListener("touchmove",On,{passive:!0}),window.addEventListener("scroll",En,{passive:!0})}function Un(){window.removeEventListener("wheel",Sn),window.removeEventListener("touchmove",On),window.removeEventListener("scroll",En),Nn()}function Nn(){gn=0,yn=0,bn=null,Mn=0,kn=!1,Tn=0,Dn=0,xn=null,An=0}var Rn=0,Cn=0,jn=!1,Ln=e(()=>{jn||(jn=!0,requestAnimationFrame(()=>{jn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Rn&&(Rn=e,0===Cn&&(Cn=Date.now()))}}))}),In=null,Bn=null;function Pn(){window.addEventListener("scroll",Ln,{passive:!0}),Bn=t(Xn),window.addEventListener("pagehide",Bn),In=t(()=>{"hidden"===document.visibilityState&&Xn()}),document.addEventListener("visibilitychange",In)}function zn(){window.removeEventListener("scroll",Ln),Bn&&(window.removeEventListener("pagehide",Bn),Bn=null),In&&(document.removeEventListener("visibilitychange",In),In=null),Rn=0,Cn=0,jn=!1}function qn(){Rn=0,Cn=0,jn=!1}function Xn(){if(Rn>.05){const t=Date.now(),e=Cn>0?Math.max(0,t-Cn):0;X({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*Rn)/100,max_depth:Math.round(100*Rn),dwell_ms:e}})}}var Fn="",Jn=0,Zn=0,Hn=0,Vn=0,Wn=0,Yn=null,Gn=0,Kn=!1,Qn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==Fn||o-Zn>1500)&&(Fn=n,Zn=o,Jn=0),(Jn+=1)<4||(X({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Jn,window_ms:1500}}),Jn=0,Zn=o)}),to=e(()=>{const t=Date.now(),e=io(),n=Wn||e,o=Math.abs(e-n)/Math.max(n,1);Wn=e,o<.15||((!Hn||t-Hn>5e3)&&(Hn=t,Vn=0),(Vn+=1)<3||(X({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Vn,area_delta:Math.round(1e3*o)/1e3}}),Vn=0,Hn=t))}),eo=e(()=>{ro()});function no(){Kn||(Kn=!0,Wn=io(),ro(),document.addEventListener("mouseenter",Qn,!0),document.addEventListener("mouseleave",Qn,!0),document.addEventListener("click",eo,{capture:!0,passive:!0}),document.addEventListener("keydown",eo,{capture:!0,passive:!0}),document.addEventListener("scroll",eo,{passive:!0}),window.addEventListener("resize",to,{passive:!0}))}function oo(){Kn&&(Kn=!1,document.removeEventListener("mouseenter",Qn,!0),document.removeEventListener("mouseleave",Qn,!0),document.removeEventListener("click",eo,{capture:!0}),document.removeEventListener("keydown",eo,{capture:!0}),document.removeEventListener("scroll",eo),window.removeEventListener("resize",to),so(),Fn="",Jn=0,Zn=0,Vn=0,Hn=0,Gn=0)}function ro(){so();const t=Gn+=1;Yn=setTimeout(()=>{X({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function io(){return Math.max(1,window.innerWidth*window.innerHeight)}function so(){Yn&&(clearTimeout(Yn),Yn=null)}var co=["[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"]'],ao=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,uo=[],lo=[],fo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,lo))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(wo(e))return!0;if(mo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;uo.length&&n-uo[0].t>6e4;)uo.shift();const o=a(e);if(uo.push({t:n,el:o}),uo.length<3)return;const r=new Set(uo.map(t=>t.el)).size,i=d(e);X({t:"sig",ts:n,d:{s:"help_hunt",cnt:uo.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),uo=[]});function po(){document.removeEventListener("click",fo,{capture:!0}),uo=[]}function ho(){uo=[]}function wo(t){for(const e of co)try{if(t.matches(e))return!0}catch{}return!1}function mo(t){const e=t.id??"",n=t.className??"";return ao.test("string"==typeof n?`${e} ${n}`:e)}var _o=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,vo=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,go=[],yo=new Map,bo=[],Mo=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,bo))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(Do(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=d(e);go.push({t:n,el:o});const i=(yo.get(o)??0)+1;yo.set(o,i);const s=go.length,c=(()=>{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}})();X({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:s,element_cnt:i,repeated:i>1,container:xo(e),...c??{}}})});function ko(){document.removeEventListener("click",Mo,{capture:!0}),go=[],yo.clear()}function To(){go=[],yo.clear()}function Do(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&&vo.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(_o.test(t.id??"")||_o.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&vo.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 xo(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 Ao=null,Eo=[],So=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,Eo)||(Ao=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:d(e),t:Date.now()}))}),Oo=e(t=>{"Escape"===t.key&&Ro("escape")}),$o=e(()=>{Ro("back_nav")});function Uo(){document.removeEventListener("click",So,{capture:!0}),document.removeEventListener("keydown",Oo,{capture:!0}),window.removeEventListener("popstate",$o),Ao=null}function No(){Ao=null}function Ro(t){if(!Ao)return;const e=Date.now()-Ao.t;e>1500||X({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Ao.el,...Ao.label?{el_label:Ao.label}:{},elapsed_ms:e}}),Ao=null}var Co=/^(checkbox|radio)$/,jo=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Lo=new Map,Io=[],Bo=e(t=>{const e=t.target;e&&(p(e,Io)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Co.test(t.type??""):jo.test(t.getAttribute("role")??"")))(e)&&Xo(e))}),Po=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Io))return;const n=e.getAttribute("role")??"";jo.test(n)&&"INPUT"!==e.tagName&&Xo(e)});function zo(){document.removeEventListener("change",Bo,{capture:!0}),document.removeEventListener("click",Po,{capture:!0}),Lo.clear()}function qo(){Lo.clear()}function Xo(t){const e=a(t),n=Date.now();let o=Lo.get(e);for(o||(o=[],Lo.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=d(t);X({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),Lo.delete(e)}var Fo=[],Jo=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(;Fo.length&&o-Fo[0].t>15e3;)Fo.shift();Fo.push({t:o}),Fo.length<3||(X({t:"sig",ts:o,d:{s:"copy_frustration",cnt:Fo.length,window_ms:15e3}}),Fo=[])});function Zo(){document.addEventListener("copy",Jo,{capture:!0,passive:!0})}function Ho(){document.removeEventListener("copy",Jo,{capture:!0}),Fo=[]}function Vo(){Fo=[]}var Wo=[],Yo=0,Go=null,Ko=null;function Qo(){Go=t(or),Ko=t(nr),document.addEventListener("selectionchange",Go),document.addEventListener("copy",Ko,{capture:!0,passive:!0}),document.addEventListener("cut",Ko,{capture:!0,passive:!0})}function tr(){Go&&(document.removeEventListener("selectionchange",Go),Go=null),Ko&&(document.removeEventListener("copy",Ko,{capture:!0}),document.removeEventListener("cut",Ko,{capture:!0}),Ko=null),Wo=[],Yo=0}function er(){Wo=[],Yo=0}function nr(){Yo=Date.now(),Wo=[]}function or(){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-Yo<2e3)return;for(;Wo.length&&n-Wo[0].t>15e3;)Wo.shift();const o=Wo[Wo.length-1];o&&n-o.t<500||(Wo.push({t:n}),Wo.length<4||(X({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:Wo.length,window_ms:15e3}}),Wo=[]))}var rr=6e4,ir="_fd_sess",sr={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},cr={low:1,medium:2,high:3,critical:4},ar=[],ur=null,lr=!1,fr=new Map,dr={totalSignals:0,pagesWithFrustration:0},pr="",hr=null,wr=null,mr=null,_r=null;function vr(t){lr&&gr(t,Date.now())}function gr(t,e){fr.has(t)||fr.set(t,[]);const n=fr.get(t);n.push(e),n.length>20&&n.shift()}function yr(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 br(t,e){if(!lr)return;if("frustration_burst"===t)return;const n=e??Date.now();(t=>{const e=t-rr;let n=0;for(;n<ar.length&&ar[n].ts<e;)n++;n>0&&(ar=ar.slice(n))})(n),0===ar.length&&(ur=null),ar.push({type:t,ts:n}),gr(t,n);const{distinctTypes:o,totalWeight:r,typeCounts:i}=(()=>{const t=new Map;let e=0;for(const n of ar)t.set(n.type,(t.get(n.type)??0)+1),e+=sr[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),s=((t,e,n)=>yr(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(o.size,r,i);s&&(null!==ur&&cr[s]<=cr[ur]||(ur=s,((t,e,n,o)=>{const r=yr(o),i=(()=>{const t=[],e=Date.now()-rr,n=[];for(const[t,o]of fr.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})();X({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:pr||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:rr,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:dr.totalSignals,session_pages_with_frustration:dr.pagesWithFrustration}}),dr.totalSignals+=ar.length,dr.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(ir,JSON.stringify(dr))}catch{}})()})(s,o,r,i)))}function Mr(){lr=!1,ar=[],ur=null,fr=new Map,N(null),hr&&(window.removeEventListener("popstate",hr),hr=null),wr&&(window.removeEventListener("hashchange",wr),wr=null),mr&&(document.removeEventListener("visibilitychange",mr),mr=null),_r&&(window.removeEventListener("pagehide",_r),_r=null)}var kr=3e4,Tr=[],Dr="",xr=!1,Ar=e(()=>{Ur(location.pathname+location.search+location.hash)}),Er=e(()=>{Ur(location.pathname+location.search+location.hash)});function Sr(){Tr=[],xr=!1,Dr=location.pathname+location.search+location.hash,window.addEventListener("popstate",Ar),window.addEventListener("hashchange",Er)}function Or(){window.removeEventListener("popstate",Ar),window.removeEventListener("hashchange",Er),Tr=[],xr=!1,Dr=""}function $r(){Tr=[],xr=!1,Dr=location.pathname+location.search+location.hash}function Ur(t){const e=Date.now();if(Dr&&Dr!==t){const t=Tr[Tr.length-1];t&&t.path===Dr&&null===t.leftAt&&(t.leftAt=e)}for(;Tr.length&&e-Tr[0].ts>kr;)Tr.shift();t!==Dr&&(Tr.push({path:t,ts:e,leftAt:null}),Dr=t),Tr.length<5||xr||(t=>{const e=Tr.filter(e=>t-e.ts<=kr),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),s=Math.max(...r),c=e.map(t=>t.path).slice(-8);xr=!0,X({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:kr,avg_dwell_ms:i,pages:c,max_dwell_ms:s}})})(e)}var Nr=[],Rr=!1,Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Pr=e(()=>{Rr||(Rr=!0,requestAnimationFrame(Jr))}),zr=e(t=>{if(!Br)return;const e=Date.now();if(e-Ir>3e3)return void(Br=!1);if(window.scrollY+t.clientY>Lr+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(jr-Lr),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,s=i?a(i):"",c=i?d(i):"";Br=!1,jr=window.scrollY,Cr="none",Nr=[],X({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:s,...c?{click_el_label:c}:{},scroll_back_pct:r}})});function qr(){Nr=[],Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Rr=!1,window.addEventListener("scroll",Pr,{passive:!0}),window.addEventListener("click",zr,{capture:!0})}function Xr(){window.removeEventListener("scroll",Pr),window.removeEventListener("click",zr,{capture:!0}),Fr()}function Fr(){Nr=[],Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Rr=!1}function Jr(){Rr=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Nr[Nr.length-1];if(o&&t-o.ts<50)return;if(Nr.push({y:e,ts:t}),Nr.length>60&&(Nr=Nr.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==Cr&&Br&&(Br=!1),e>jr&&(jr=e),void(Cr="down");Br&&t-Ir>3e3&&(Br=!1),"down"===Cr&&jr-e>=.3*n&&!Br&&(Lr=e,Ir=t,Br=!0),Cr="up"}}var Zr=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Hr=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Vr=/^(A|BUTTON|LABEL)$/,Wr=new Map,Yr=[],Gr=null,Kr=e(t=>{Gr={x:t.clientX,y:t.clientY}}),Qr=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,Yr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Gr)return!1;const e=t.clientX-Gr.x,n=t.clientY-Gr.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Zr.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Hr.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||!Vr.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(),s=a(e),c=(Wr.get(r)??[]).filter(t=>i-t.ts<9e4);if(c.push({ts:i,selector:s}),Wr.set(r,c),c.length>=3){const t=new Map;for(const e of c)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",s=0;for(const[n,o]of t)o>s&&(s=o,e=n);const a=new Set,u=[];for(const t of c)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?d(t):""}catch{return""}})();X({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:c.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Wr.set(r,[])}});function ti(){document.removeEventListener("mousedown",Kr,{capture:!0}),document.removeEventListener("click",Qr,{capture:!0}),Gr=null,Wr.clear()}function ei(){Wr.clear()}var ni=12e4,oi=new Map,ri=[],ii=null,si=e(t=>{const e=t.target;e&&wi(e)}),ci=e(t=>{const e=t.target;if(!e||!di(e))return;if(p(e,ri))return;const n=a(e);oi.has(n)||fi(e)&&hi(e,n)});function ai(){document.removeEventListener("invalid",si,{capture:!0}),document.removeEventListener("input",ci,{capture:!0}),document.removeEventListener("change",ci,{capture:!0}),ii&&(ii.disconnect(),ii=null);for(const t of oi.values())pi(t);oi.clear()}function ui(){for(const t of oi.values())pi(t);oi.clear()}function li(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function fi(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 di(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function pi(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function hi(t,n){const o=(t=>e(e=>{_i(t)}))(n),r=(t=>e(e=>{_i(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 oi.set(n,i),i}function wi(t){if(!di(t))return;if(p(t,ri))return;const e=Date.now();(t=>{for(const[e,n]of oi)t-n.lastTs>ni&&(pi(n),oi.delete(e))})(e);const n=a(t),o=oi.get(n);if(!o)return void hi(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ni,field_type:li(t)}}),pi(o),oi.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ni,field_type:li(t)}}),pi(o),oi.delete(n)))}function mi(t){if(!di(t))return;const e=Date.now(),n=a(t),o=oi.get(n);return o?e-o.lastTs>ni?(pi(o),void oi.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function _i(t){const e=Date.now(),n=oi.get(t);if(n){if(e-n.lastTs>ni)return pi(n),void oi.delete(t);if(n.lastTs=e,fi(n.el))return n.cycles+=1,void(n.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...d(n.el)?{el_label:d(n.el)}:{},cycles:n.cycles,window_ms:ni,field_type:li(n.el)}}),pi(n),oi.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function vi(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!di(t))continue;if(p(t,ri))continue;const n=e.oldValue,o="true"===n||""===n,r=fi(t);r&&!o?wi(t):!r&&o&&mi(t)}}var gi=null,yi=null,bi=[],Mi=0,ki=new Map;function Ti(){gi&&(gi.disconnect(),gi=null),yi&&(yi.disconnect(),yi=null),ki.clear()}function Di(){ki.clear(),gi&&xi()}function xi(){for(const t of bi)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Ai(e[t])}catch{}}function Ai(t){ki.has(t)||(ki.set(t,{firstSeenTs:0,emitted:!1}),gi.observe(t))}function Ei(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 bi)try{n.matches(t)&&Ai(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Ai(e[t])}catch{}}}function Si(t){const e=Date.now();for(const n of t){const t=ki.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",s=a(n.target),c=d(n.target);X({t:"sig",ts:e,d:{s:"element_impression",el:s,...c?{el_label:c}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-Mi),viewport_position:i}})}}}var Oi=new Map,$i=[],Ui=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,$i))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Oi.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=d(e);return X({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:Ci(e)}}),void Oi.delete(r)}i.lastValue=o}else Oi.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function Ni(){document.removeEventListener("input",Ui,{capture:!0}),Oi.clear()}function Ri(){Oi.clear()}function Ci(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var ji=null,Li=2e3,Ii=[],Bi=new Map,Pi=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Ii))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(ji?.selector===n)return;Ji();const o=Date.now();if(o-(Bi.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=d(e);Bi.set(n,t),ji=null,X({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Li);ji={el:e,selector:n,startTs:r,timer:i}}),zi=e(t=>{if(!ji)return;const e=t.target;if(e!==ji.el&&!ji.el.contains(e))return;const n=t.relatedTarget;n&&ji.el.contains(n)||Ji()}),qi=e(Ji);function Xi(){document.removeEventListener("mouseover",Pi),document.removeEventListener("mouseout",zi),document.removeEventListener("click",qi,{capture:!0}),Ji(),Bi.clear()}function Fi(){Ji(),Bi.clear()}function Ji(){ji&&(clearTimeout(ji.timer),ji=null)}var Zi=0,Hi=0,Vi=null,Wi=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Zi<3e3||n-Hi<6e4||(Vi&&clearTimeout(Vi),Vi=setTimeout(t(()=>{const t=Date.now();Hi=t,Vi=null,X({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Zi)}})}),500))});function Yi(){Zi=Date.now(),Hi=0,document.addEventListener("mouseleave",Wi)}function Gi(){document.removeEventListener("mouseleave",Wi),Vi&&(clearTimeout(Vi),Vi=null)}function Ki(){Zi=Date.now(),Hi=0,Vi&&(clearTimeout(Vi),Vi=null)}var Qi=null,ts=null,es=null,ns=0;function os(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function rs(){if("undefined"!=typeof PerformanceObserver){try{(Qi=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);X({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:os(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Qi=null}try{(ts=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||X({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:os(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{ts=null}try{(es=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ns+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{es=null}}}function is(){if(es){if(es.disconnect(),es=null,ns>0){const t=Math.round(1e3*ns)/1e3;X({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:os(ns,.1,.25)}})}ns=0}}function ss(){Qi&&(Qi.disconnect(),Qi=null),ts&&(ts.disconnect(),ts=null),is()}function cs(){if(is(),"undefined"!=typeof PerformanceObserver)try{(es=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ns+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{es=null}}var as=[],us=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,as))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=d(e);X({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:fs(e)}})},100)});function ls(){document.removeEventListener("paste",us,{capture:!0})}function fs(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var ds=!1,ps=null,hs=null,ws=[],ms="__flusterduck_instance__",_s=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,vs=[];function gs(e){if(ds)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(hs=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(hs=e);if(!(()=>{const t=window;return!(t[ms]&&t[ms]!==_s||(t[ms]=_s,0))})())return void(hs=e);hs=e,ds=!0,$("none"!==e.transport),"function"==typeof e.onSignal&&ws.push(C(e.onSignal)),e.emitSignalEvents&&ws.push(C(Ds));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),c=(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=K(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:G(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.removeEventListener("visibilitychange",z),window.removeEventListener("pagehide",q),document.addEventListener("visibilitychange",z),window.addEventListener("pagehide",q)})(c,{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 f=As(location.pathname,e.ignorePages??[]);f&&j(!0);const d=document.referrer;let p="";if(d)try{p=new URL(d).origin+new URL(d).pathname}catch{p=""}f||X({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[];vs=[];for(const n of function(e,n,o){const r=t=>{const n=e.signals?.[t];return!1!==n?.enabled},i=!1!==e.trackForms;return[{when:()=>r("rageClick"),start:()=>((t,e)=>{ft||(ft=!0,ot=t?.threshold??3,rt=t?.windowMs??2e3,it=t?.radius&&t.radius>0?t.radius:24,st=[...et,...e??[]],at=Date.now(),nt=[],ct=[],ut.clear(),lt.clear(),document.addEventListener("click",dt,{capture:!0,passive:!0}))})(e.signals?.rageClick,n),stop:pt},{when:()=>r("deadClick"),start:()=>(t=>{_t=t??[],document.addEventListener("mousedown",yt,{capture:!0,passive:!0}),document.addEventListener("click",bt,{capture:!0,passive:!0})})(n),stop:Mt,reset:kt},{when:()=>r("speedFrustration"),start:()=>{const t=e.signals?.speedFrustration;((t,e)=>{At=t?.delayMs??3e3,Et=e??[],document.addEventListener("click",Nt,{capture:!0,passive:!0}),document.addEventListener("keydown",Rt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Ct,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,n)},stop:jt,reset:Lt},{when:()=>!1!==e.trackMouse&&r("thrashCursor"),start:()=>{const t=e.signals?.thrashCursor;var n;n=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,Bt=n?.velocityThreshold??800,Pt=n?.windowMs??2e3,document.addEventListener("mousemove",Kt,{passive:!0})},stop:Qt},{when:()=>r("loopNav"),start:()=>{return t=e.signals?.loopNav,void(oe=t?.windowMs??3e4);var t},stop:re},{when:()=>r("scrollBounce"),start:pe,stop:he,reset:we},{when:()=>i&&(r("formHesitation")||r("formAbandon")),start:()=>{const o=e.signals?.formHesitation;((e,n)=>{Me=e?.pauseMs??5e3,ke=n??[],document.addEventListener("focusin",Te,{capture:!0,passive:!0}),document.addEventListener("focusout",De,{capture:!0,passive:!0}),document.addEventListener("submit",xe,{capture:!0,passive:!0}),window.addEventListener("pagehide",Ae),Ee=t(()=>{"hidden"===document.visibilityState&&$e()}),document.addEventListener("visibilitychange",Ee)})(o?{pauseMs:o.threshold}:void 0,n)},stop:Se,reset:Oe},{when:()=>i&&r("formValidationLoop"),start:()=>(t=>{ri=t??[],document.addEventListener("invalid",si,{capture:!0,passive:!0}),document.addEventListener("input",ci,{capture:!0,passive:!0}),document.addEventListener("change",ci,{capture:!0,passive:!0}),(ii=new MutationObserver(vi)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(n),stop:ai,reset:ui},{when:()=>r("errorEncounter"),start:Ie,stop:Be},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>(t=>{en=t??[],document.addEventListener("touchstart",nn,{passive:!0}),document.addEventListener("touchend",on,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",rn,{passive:!0}),window.addEventListener("orientationchange",sn,{passive:!0})),window.visualViewport?.addEventListener("resize",cn)})(n),stop:an},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>(t=>{mn=t??[],document.addEventListener("keydown",_n,{capture:!0,passive:!0})})(n),stop:vn},{when:()=>r("scrollHijack"),start:$n,stop:Un,reset:Nn},{when:()=>r("scrollDepthAbandon"),start:Pn,stop:zn,reset:qn},{when:()=>r("advancedHeuristics"),start:no,stop:oo,reset:()=>{ro(),Gn=0}},{when:()=>r("helpHunt"),start:()=>(t=>{lo=t??[],document.addEventListener("click",fo,{capture:!0,passive:!0})})(n),stop:po,reset:ho},{when:()=>r("closeClick"),start:()=>(t=>{bo=t??[],document.addEventListener("click",Mo,{capture:!0,passive:!0})})(n),stop:ko,reset:To},{when:()=>r("closeClickReversal"),start:()=>(t=>{Eo=t??[],document.addEventListener("click",So,{capture:!0,passive:!0}),document.addEventListener("keydown",Oo,{capture:!0,passive:!0}),window.addEventListener("popstate",$o)})(n),stop:Uo,reset:No},{when:()=>r("filterSpiral"),start:()=>(t=>{Io=t??[],document.addEventListener("change",Bo,{capture:!0,passive:!0}),document.addEventListener("click",Po,{capture:!0,passive:!0})})(n),stop:zo,reset:qo},{when:()=>r("copyFrustration"),start:Zo,stop:Ho,reset:Vo},{when:()=>r("textSelectFrustration"),start:Qo,stop:tr,reset:er},{when:()=>r("deadClickTrapZone"),start:()=>(t=>{Yr=t??[],document.addEventListener("mousedown",Kr,{capture:!0,passive:!0}),document.addEventListener("click",Qr,{capture:!0,passive:!0})})(n),stop:ti,reset:ei},{when:()=>!0,start:()=>(t=>{ar=[],ur=null,lr=!0,fr=new Map,pr=t??"",(()=>{try{const t=sessionStorage.getItem(ir);if(t){const e=JSON.parse(t);dr={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),N(br),hr=()=>vr("popstate"),wr=()=>vr("hashchange"),mr=()=>{"hidden"===document.visibilityState&&vr("visibilitychange")},_r=()=>vr("pagehide"),window.addEventListener("popstate",hr),window.addEventListener("hashchange",wr),document.addEventListener("visibilitychange",mr),window.addEventListener("pagehide",_r)})(o),stop:Mr},{when:()=>r("navigationConfusion"),start:Sr,stop:Or,reset:$r},{when:()=>r("scrollToClickConfusion"),start:qr,stop:Xr,reset:Fr},{when:()=>r("elementImpression"),start:()=>{return n=e.elementImpressionSelectors,bi=n?.length?n:["[data-fd-impression]"],Mi=Date.now(),void("undefined"!=typeof IntersectionObserver&&(gi=new IntersectionObserver(t(Si),{threshold:[0,.5,1]}),xi(),(yi=new MutationObserver(t(Ei))).observe(document.body,{childList:!0,subtree:!0})));var n},stop:Ti,reset:Di},{when:()=>i&&r("inputCorrection"),start:()=>(t=>{$i=t??[],document.addEventListener("input",Ui,{capture:!0,passive:!0})})(n),stop:Ni,reset:Ri},{when:()=>i&&r("pasteBlocked"),start:()=>(t=>{as=t??[],document.addEventListener("paste",us,{capture:!0,passive:!0})})(n),stop:ls},{when:()=>r("hoverDwell"),start:()=>{const t=e.signals?.hoverDwell;((t,e)=>{Li=t?.dwellMs??2e3,Ii=e??[],document.addEventListener("mouseover",Pi,{passive:!0}),document.addEventListener("mouseout",zi,{passive:!0}),document.addEventListener("click",qi,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,n)},stop:Xi,reset:Fi},{when:()=>r("exitIntent"),start:Yi,stop:Gi,reset:Ki},{when:()=>r("performanceVitals"),start:rs,stop:ss,reset:cs}]}(e,h,a))n.when()&&(n.start(),vs.push({stop:n.stop,reset:n.reset}));ps=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)=>{for(const t of vs)t.reset?.();F(),Ur(n),(t=>{pr=t})(n);const o=K(n,e.pageRules??[]),r=As(n,e.ignorePages??[]);j(r),Z({page:o,url:t}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;ee.length&&e-ee[0].ts>oe;)ee.shift();for(;ne.length&&e-ne[0].ts>oe;)ne.shift();if(ee.length>=100&&(ee=ee.slice(-50)),ne.length>=100&&(ne=ne.slice(-50)),ee.push({path:t,ts:e}),r){ne.push({path:t,ts:e});const n=ne.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 X({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(ne=ne.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(ee.length<4)return;let i=!1;const s=[];for(let e=0;e<ee.length-1;e++)if(ee[e].path===t){const t=ee.slice(e,ee.length),n=new Set(t.map(t=>t.path));if(n.size>=2){s.push(...Array.from(n)),i=!0;break}}i&&(X({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:ee.slice(-5).map(t=>t.path)}}),ee=[{path:t,ts:e}],ne=ne.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(n),r||X({t:"pv",ts:Date.now(),d:{ref:""}})}))}function ys(t,e){if(!ds)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);X({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 bs(t,e={}){if(!ds)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||X({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function Ms(t){if(!ds)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;if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=t[o];"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(e[o.slice(0,64)]=String(r).slice(0,256),n++)}Z({segment:e})}function ks(t){t&&hs&&!ds?gs(hs):t||(xs(),r())}function Ts(){xs(),r()}function Ds(t){if("undefined"!=typeof window&&"undefined"!=typeof CustomEvent)try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:t}))}catch{}}function xs(){if(ds){for(const t of ws)t();ws=[],$(!0);for(const t of vs)t.stop();vs=[],F(),S=!1,document.removeEventListener("visibilitychange",z),window.removeEventListener("pagehide",q),b&&(clearTimeout(b),b=null),ps&&(ps(),ps=null),(()=>{const t=window;t[ms]===_s&&delete t[ms]})(),ds=!1}}function As(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 Es(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:Es(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{}gs(o),t.flusterduck=Object.freeze({init:gs,signal:ys,track:bs,identify:Ms,setConsent:ks,optOut:Ts,destroy:xs})}catch{}})()})();
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var _n=Object.defineProperty;var Ha=Object.getOwnPropertyDescriptor;var Fa=Object.getOwnPropertyNames;var Ba=Object.prototype.hasOwnProperty;var Wa=(e,t)=>{for(var n in t)_n(e,n,{get:t[n],enumerable:!0})},Ua=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fa(t))!Ba.call(e,o)&&o!==n&&_n(e,o,{get:()=>t[o],enumerable:!(r=Ha(t,o))||r.enumerable});return e};var Va=e=>Ua(_n({},"__esModule",{value:!0}),e);var cf={};Wa(cf,{destroy:()=>gn,destroyPostHogTrigger:()=>Ra,identify:()=>fa,init:()=>zo,initPostHogTrigger:()=>Da,onSignal:()=>ga,optOut:()=>ma,setConsent:()=>pa,signal:()=>ua,track:()=>da});module.exports=Va(cf);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Tn="_fd_s";var qa=/^[0-9a-f]{32}$/;function Jo(e){if(e)return Qo();let t=za(Tn);if(t&&qa.test(t))return t;let n=Qo();return ei(Tn,n,30),n}function Ln(){ei(Tn,"",-1)}function Qo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function za(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function ei(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var $a=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!$a.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,Xa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ya=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Ya.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!Xa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ni(e,t){if(t==="off")return null;if(t==="metadata")return ja(e);let n=Ka(e);return n?{mode:"snapshot",...n}:null}function ja(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:ti(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:ti(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Ga(e)}}}function Ka(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Qa(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Za(t),animations:i,siblings:o}}catch{return null}}function ti(e,t){return e&&t.includes(e)?e:null}function Ga(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 Za(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Qa(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 ii=7e3,Ja=500,el=1e4,si=50,Be=100,tl=3,We=6e4,xt="application/json",nl="application/json; encoding=gzip",j=[],B=null,ai="",Dn=ii,li=si,_=null,At={domMode:"off",compression:"auto"},Cn=!1,kn=null,Rn=!1,ri=new WeakMap;function In(e){kn=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function rl(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function ol(e){if(!kn||e.t!=="sig")return;let t=An(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{kn(t.slice(0,128),e.ts)}catch{}}function On(e){Rn=e}var il=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),sl=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),al=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ll(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>al.has(n))}var cl=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Mn=f(dl),xn=y(()=>J());function ci(e,t,n,r,o){ai=e,_=Object.assign(Object.create(null),t),At={domMode:yl(o?.domMode),compression:Sl(o?.compression)},Dn=Math.max(Ja,Math.min(n??ii,el)),li=Math.max(1,Math.min(r??si,Be)),document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),document.addEventListener("visibilitychange",Mn),window.addEventListener("pagehide",xn)}function u(e){Rn||j.length>=Be||(rl(e),ol(e),j.push(e),j.length>=li?J():B||(B=setTimeout(J,Dn)))}function J(){ul()}async function ul(){if(Cn||!j.length||!_)return;Cn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=vl(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)fl({...t,events:o.events}).then(i=>{i||oi(o.source)}).catch(()=>oi(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Cn=!1}}function oi(e){let t=e.filter(r=>{let o=ri.get(r)??0;return o>=tl?!1:(ri.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,Dn))}function Nn(e){if(_)for(let t of Object.keys(e))il.has(t)&&(_[t]=e[t])}function ui(){J(),Rn=!1,document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),B&&(clearTimeout(B),B=null)}function dl(){document.visibilityState==="hidden"&&J()}async function fl(e){let t=JSON.stringify(e),n=await pl(t,At.compression);return n?hl(n):!0}async function pl(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await ml(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:nl}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function ml(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=gl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function gl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function hl(e,t=ai){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function vl(e,t,n){let r=e.d??{},o=wl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=An(r.el,r.element,r.target);if(o==="signal"){i.signal_type=An(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?bl(s,n):null;c&&(i.dom=c)}let a=El(r);return Object.keys(a).length&&(i.metadata=a),i}function wl(e){return e==="pv"?"pageview":e==="sig"?"signal":sl.has(e)?e:"custom_signal"}function El(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!ll(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 cl.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function bl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ni(n,t):null}catch{return null}}function An(...e){for(let t of e)if(typeof t=="string"&&t)return t}function yl(e){return e==="metadata"||e==="snapshot"?e:"off"}function Sl(e){return e==="off"?"off":"auto"}function di(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function Pn(e,t){for(let n of t){let r=Tl(n.pattern);if(r&&r.test(e))return n.label}return Ll(e)}var _l=/^[a-zA-Z0-9/:._*\-]+$/;function Tl(e){if(e.length>200||!_l.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Ll(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id")}var Cl=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],W=[],fi=3,pi=2e3,mi=24,It=mi,gi=[],pe=[],hi=0,Ot=new Map,Nt=new Map,kl=1e4,Pt=!1,vi=f(Ml);function Hn(e,t){Pt||(Pt=!0,fi=e?.threshold??3,pi=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:mi,gi=[...Cl,...t??[]],hi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",vi,{capture:!0,passive:!0}))}function Fn(){Pt&&(Pt=!1,document.removeEventListener("click",vi,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function Ml(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,gi)||Rl(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>pi;)W.shift();W.push({t:n,x:r,y:o});let i=xl();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=Dl(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=Al(n),Ko=Ot.get(b)??0,yn=Ko+1,Go=Nt.get(b)??0,Na=Go>0&&n-Go<kl;Ot.set(b,yn),Nt.set(b,n);let Zo=Ko>=1,Pa=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,Sn)=>de+Sn.x,0)/s.length,Ct=s.reduce((de,Sn)=>de+Sn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Zo,hot_repeat:Na,...Pa??{}}}),Zo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:yn,burst_count:yn,burst_seq:Y}}),W=W.slice(-(i-1))}function xl(){return pe.length>=3?2:fi}function Al(e){let t=(e-hi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function Dl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function Rl(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Il=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ol=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Nl=/^(A|BUTTON|LABEL)$/,Pl=20,wi=[],me=null,Hl=5,Ht=new Map,Ei=f(Fl),bi=f(Ul);function Fl(e){me={x:e.clientX,y:e.clientY}}function Bn(e){wi=e??[],document.addEventListener("mousedown",Ei,{capture:!0,passive:!0}),document.addEventListener("click",bi,{capture:!0,passive:!0})}function Wn(){document.removeEventListener("mousedown",Ei,{capture:!0}),document.removeEventListener("click",bi,{capture:!0}),me=null,Ht.clear()}function Un(){Ht.clear()}function Bl(e){try{return window.getComputedStyle(e).cursor.slice(0,Pl)}catch{return""}}function Wl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ul(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,wi)||$l())return;let n=Xl(e);if(me=null,n||Vl(t))return;let r=ql(t,e.clientX,e.clientY),o=r?yi(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Bl(t),l=Wl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function Vl(e){if(Il.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ol.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&&Nl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ql(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=zl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function yi(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function zl(e,t,n){return yi(e,t,n).dist}function $l(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Xl(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Hl}var T=null,Vn=3e3,Si=[],Ft="click",Bt=0,Yl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,jl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,_i=f(Zl),Ti=f(Kl),Li=f(Gl);function qn(e,t){Vn=e?.delayMs??3e3,Si=t??[],document.addEventListener("click",_i,{capture:!0,passive:!0}),document.addEventListener("keydown",Ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",Li,{capture:!0,passive:!0})}function zn(){document.removeEventListener("click",_i,{capture:!0}),document.removeEventListener("keydown",Ti,{capture:!0}),document.removeEventListener("touchstart",Li,{capture:!0}),ge()}function $n(){ge()}function Kl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Gl(){Ft="touch",Bt=Date.now()}function Zl(e){let t=e.target;if(!t||v(t,Si))return;let n=t.getAttribute("role");if(!Yl.test(t.tagName)&&!(n&&jl.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Vn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Vn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Ql=100,Jl=5,Ci=800,ki=2e3,ec=3,Yn=0,tc=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,Xn=0,oe=[],jn=0,he=null,Mi=f(nc);function Kn(e){Ci=e?.velocityThreshold??800,ki=e?.windowMs??2e3,document.addEventListener("mousemove",Mi,{passive:!0})}function Gn(){document.removeEventListener("mousemove",Mi),he&&clearTimeout(he),Zn()}function nc(e){let t=Date.now();t-Yn<tc||(Yn=t,he&&clearTimeout(he),he=setTimeout(()=>Zn(),150),rc(e.clientX,e.clientY,t))}function rc(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,Xn=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=Ql&&(oe=oe.slice(-50)),oe.push(a),jn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Jl&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-Xn>ki){if(Vt>=ec){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Ci&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(jn)}})}Zn(),Xn=n}}function Zn(){Vt=0,oe=[],jn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,Yn=0,he=null}var xi=100,Ai=5,oc=3,L=[],M=[],Qn=3e4;function Jn(e){Qn=e?.windowMs??3e4}function er(){L=[],M=[]}function tr(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Qn;)L.shift();for(;M.length&&t-M[0].ts>Qn;)M.shift();if(L.length>=xi&&(L=L.slice(-50)),M.length>=xi&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=oc&&a.length>c.size){let d=a.slice(-Ai).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ai).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var ic=100,Di=1e4,rr=.5,C=[],qt=0,or=0,ze=!1,nr=0,Ri=f(sc);function ir(e){Di=e?.windowMs??1e4,rr=e?.depthThreshold??.5,window.addEventListener("scroll",Ri,{passive:!0})}function sr(){window.removeEventListener("scroll",Ri),C=[],ze=!1}function ar(){C=[],qt=0,or=0,ze=!1}function sc(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,ac()}))}function ac(){let e=Date.now(),t=window.scrollY;if(nr=document.documentElement.scrollHeight-window.innerHeight,nr<=0)return;let n=t/nr,r=t>qt?"down":"up";if(e-or<100){qt=t;return}for(;C.length&&e-C[0].ts>Di;)C.shift();C.length>=ic&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,or=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=rr&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=rr){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var lc=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,lr=0,Ii=5e3,Oi=[],cc=50,Ni=f(uc),Pi=f(dc),Hi=f(fc),Fi=y(fr),$e=null;function cr(e,t){Ii=e?.pauseMs??5e3,Oi=t??[],document.addEventListener("focusin",Ni,{capture:!0,passive:!0}),document.addEventListener("focusout",Pi,{capture:!0,passive:!0}),document.addEventListener("submit",Hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",Fi),$e=y(()=>{document.visibilityState==="hidden"&&fr()}),document.addEventListener("visibilitychange",$e)}function ur(){document.removeEventListener("focusin",Ni,{capture:!0}),document.removeEventListener("focusout",Pi,{capture:!0}),document.removeEventListener("submit",Hi,{capture:!0}),window.removeEventListener("pagehide",Fi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function dr(){fr(),Xe.clear(),Ye.clear(),K.clear(),ie=null,lr=0}function uc(e){let t=e.target;if(!t||!Bi(t)||v(t,Oi)||pc(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,lr=r.querySelectorAll("input, select, textarea").length)}function dc(e){let t=e.target;if(!t||!Bi(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<cc)&&n!==void 0){let a=o-n;if(a>=Ii){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);mc(t)&&K.add(s)}function fc(){K.clear(),ie=null}function fr(){if(K.size>0&&ie){let e=lr||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Bi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function pc(e){if(e.tagName==="TEXTAREA")return!0;for(let t of lc)try{if(e.matches(t))return!0}catch{return!1}return!1}function mc(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Wi=/flusterduck\.com|\/v1\/ingest/,Vi=f(vc),qi=f(wc);function mr(){window.addEventListener("error",Vi),window.addEventListener("unhandledrejection",qi),Ec()}function gr(){window.removeEventListener("error",Vi),window.removeEventListener("unhandledrejection",qi),bc()}var pr=/fetch|network|cors|timeout/i;function gc(e){return pr.test(e)?"network":"script"}function hc(e){if(e instanceof TypeError&&pr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return pr.test(t)?"network":"unhandled_promise"}function vc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:hr(t,200),ep:"",status:0,error_category:gc(t),url:location.pathname}})}function wc(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:hr(t,200),ep:"",status:0,error_category:hc(e.reason),url:location.pathname}})}function Ec(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Ui(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:hr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Ui(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function bc(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function Ui(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function hr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var zi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],yc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,vr=0,wr=null,$i=[],Xi=f(Sc),Yi=f(_c),ji=f(Cc),Ki=f(xc),Gi=f(kc);function Er(e){$i=e??[],document.addEventListener("touchstart",Xi,{passive:!0}),document.addEventListener("touchend",Yi,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",ji,{passive:!0}),window.addEventListener("orientationchange",Ki,{passive:!0})),window.visualViewport?.addEventListener("resize",Gi)}function br(){document.removeEventListener("touchstart",Xi),document.removeEventListener("touchend",Yi),document.removeEventListener("gesturechange",ji),window.removeEventListener("orientationchange",Ki),window.visualViewport?.removeEventListener("resize",Gi),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,vr=0,wr=null}function Zi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function Sc(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Zi(e.touches),ee=null)}function _c(e){if(Ee>0){let s=e.touches.length>=2?Zi(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&Tc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&Lc(i,n,r),ee=null}function Tc(e,t,n){if(v(e,$i))return;let r=Ac(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function Lc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||zi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!zi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Cc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!yc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function kc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function Mc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function xc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-vr>3e4&&(we=0,vr=e),t!==wr&&(we++,wr=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:Mc()}}),we=0)}function Ac(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],yr=[],Dc=10,Rc=5e3,Qi=5,Ji=3e3,Ic=15,Oc=5e3,es=f(Nc);function Sr(e){yr=e??[],document.addEventListener("keydown",es,{capture:!0,passive:!0})}function _r(){document.removeEventListener("keydown",es,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",yr=[]}function Nc(e){let t=Date.now(),n=e.target;n&&v(n,yr)||(e.key==="Tab"?Hc(t,n,e.shiftKey):e.key==="Escape"?Fc(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Bc(t,e.target))}function Pc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Hc(e,t,n){for(;x.length&&e-x[0].ts>Rc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=Dc){let i=x.map(a=>a.el).filter(Boolean),s=Pc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=Ji?(A++,V=i,A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function Fc(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>Ji){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Bc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>Oc;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=Ic&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,Tr=0,Xt=!1,Yt=0,Lr=0,Wc=1e4,Uc=2,Vc=4,qc=3e3,Qe=null,jt=0,zc=2e3,ts=f(Yc),ns=f($c),rs=f(Xc);function Cr(){window.addEventListener("wheel",ns,{passive:!0}),window.addEventListener("touchmove",rs,{passive:!0}),window.addEventListener("scroll",ts,{passive:!0})}function kr(){window.removeEventListener("wheel",ns),window.removeEventListener("touchmove",rs),window.removeEventListener("scroll",ts),Kt()}function Kt(){Se=0,zt=0,$t=null,Tr=0,Xt=!1,Yt=0,Lr=0,Qe=null,jt=0}function $c(){Qe="wheel",jt=Date.now()}function Xc(){Qe="touch",jt=Date.now()}function Yc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,jc()}))}function jc(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-Tr>qc&&(Se=0,Tr=e),Se++,Se>=Vc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=zc?Qe:"wheel";e-Lr>Wc&&(Yt=0,Lr=e),Yt++;let a=Yt>=Uc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,is=f(Kc),et=null,tt=null;function Mr(){window.addEventListener("scroll",is,{passive:!0}),tt=y(os),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&os()}),document.addEventListener("visibilitychange",et)}function xr(){window.removeEventListener("scroll",is),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function Ar(){se=0,_e=0,Je=!1}function Kc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function os(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var ss=1500,as=15e3,Gc=5e3,Zc=.15,Dr="",Te=0,Gt=0,nt=0,Le=0,Rr=0,Zt=null,Qt=0,Jt=!1,en=f(Jc),ls=f(eu),Ce=f(Qc);function Ir(){Jt||(Jt=!0,Rr=cs(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",ls,{passive:!0}))}function Or(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",ls),us(),Dr="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){us(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:as,cycle:e}})},as)}function Nr(){Qt=0}function Qc(){rt()}function Jc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Dr||r-Gt>ss)&&(Dr=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:ss}}),Te=0,Gt=r)}function eu(){let e=Date.now(),t=cs(),n=Rr||t,r=Math.abs(t-n)/Math.max(n,1);Rr=t,!(r<Zc)&&((!nt||e-nt>Gc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function cs(){return Math.max(1,window.innerWidth*window.innerHeight)}function us(){Zt&&(clearTimeout(Zt),Zt=null)}var ds=6e4,tu=3,nu=["[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"]'],ru=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],fs=[],ps=f(ou);function Pr(e){fs=e??[],document.addEventListener("click",ps,{capture:!0,passive:!0})}function Hr(){document.removeEventListener("click",ps,{capture:!0}),q=[]}function Fr(){q=[]}function ou(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,fs)||!iu(t))return;let n=Date.now();for(;q.length&&n-q[0].t>ds;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<tu)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ds}}),q=[]}function iu(e){let t=e;for(let n=0;n<3&&t;n++){if(su(t)||au(t))return!0;t=t.parentElement}return!1}function su(e){for(let t of nu)try{if(e.matches(t))return!0}catch{}return!1}function au(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return ru.test(r)}var ms=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,gs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,hs=[],vs=f(lu);function Br(e){hs=e??[],document.addEventListener("click",vs,{capture:!0,passive:!0})}function Wr(){document.removeEventListener("click",vs,{capture:!0}),tn=[],nn.clear()}function Ur(){tn=[],nn.clear()}function lu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hs)||!cu(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:du(t),...c??{}}})}function cu(e){let t=e;for(let n=0;n<4&&t;n++){if(uu(t))return!0;t=t.parentElement}return!1}function uu(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&gs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ms.test(o)||ms.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&gs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function du(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var fu=1500,O=null,ws=[],Es=f(pu),bs=f(mu),ys=f(gu);function Vr(e){ws=e??[],document.addEventListener("click",Es,{capture:!0,passive:!0}),document.addEventListener("keydown",bs,{capture:!0,passive:!0}),window.addEventListener("popstate",ys)}function qr(){document.removeEventListener("click",Es,{capture:!0}),document.removeEventListener("keydown",bs,{capture:!0}),window.removeEventListener("popstate",ys),O=null}function zr(){O=null}function pu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,ws)){if(hu(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function mu(e){e.key==="Escape"&&Ss("escape")}function gu(){Ss("back_nav")}function Ss(e){if(!O)return;let t=Date.now()-O.t;if(t>fu){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function hu(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var _s=1e4,vu=3,wu=/^(checkbox|radio)$/,Ts=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,$r=[],Ls=f(Eu),Cs=f(bu);function Xr(e){$r=e??[],document.addEventListener("change",Ls,{capture:!0,passive:!0}),document.addEventListener("click",Cs,{capture:!0,passive:!0})}function Yr(){document.removeEventListener("change",Ls,{capture:!0}),document.removeEventListener("click",Cs,{capture:!0}),ot.clear()}function jr(){ot.clear()}function Eu(e){let t=e.target;t&&(v(t,$r)||yu(t)&&ks(t))}function bu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$r))return;let n=t.getAttribute("role")??"";Ts.test(n)&&t.tagName!=="INPUT"&&ks(t)}function ks(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>_s;)r.shift();if(r.push({t:n}),r.length<vu)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:_s}}),ot.delete(t)}function yu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?wu.test(e.type??""):Ts.test(e.getAttribute("role")??"")}var Ms=15e3,Su=3,G=[],xs=f(_u);function Kr(){document.addEventListener("copy",xs,{capture:!0,passive:!0})}function Gr(){document.removeEventListener("copy",xs,{capture:!0}),G=[]}function Zr(){G=[]}function _u(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>Ms;)G.shift();G.push({t:r}),!(G.length<Su)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:Ms}}),G=[])}var As=15e3,Tu=4,Lu=5,Cu=500,ku=2e3,D=[],rn=0,it=null,ae=null;function Qr(){it=y(xu),ae=y(Mu),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function Jr(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function eo(){D=[],rn=0}function Mu(){rn=Date.now(),D=[]}function xu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<Lu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<ku)return;for(;D.length&&r-D[0].t>As;)D.shift();let o=D[D.length-1];o&&r-o.t<Cu||(D.push({t:r}),!(D.length<Tu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:As}}),D=[]))}var to=6e4,Au=20,Rs="_fd_sess",Du={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},Ru=10,Ds={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},no="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Is(e,Date.now())}function Iu(){try{let e=sessionStorage.getItem(Rs);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Ou(){try{sessionStorage.setItem(Rs,JSON.stringify(Me))}catch{}}function Nu(){let e=[],n=Date.now()-to,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Is(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>Au&&n.shift()}function Pu(e){let t=e-to,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Hu(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=Du[n.type]??Ru;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Os(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Fu(e,t,n){return Os(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Bu(e,t,n,r){let o=Os(r),i=Nu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:no||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:to,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,Ou()}function Wu(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();Pu(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Is(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Hu(),s=Fu(r.size,o,i);s&&(ke!==null&&Ds[s]<=Ds[ke]||(ke=s,Bu(s,r,o,i)))}function ro(e){no=e}function oo(e){z=[],ke=null,sn=!0,xe=new Map,no=e??"",Iu(),In(Wu),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function io(){sn=!1,z=[],ke=null,xe=new Map,In(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var Uu=8,so=3e4,ao=5,Vu=5e3,N=[],te="",ut=!1,Ns=f(zu),Ps=f($u);function lo(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Ns),window.addEventListener("hashchange",Ps)}function co(){window.removeEventListener("popstate",Ns),window.removeEventListener("hashchange",Ps),N=[],ut=!1,te=""}function uo(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>so;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<ao)&&(ut||qu(t))}function qu(e){let t=N.filter(l=>e-l.ts<=so),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<ao||n.length===0||n.some(l=>l.leftAt-l.ts>=Vu)||new Set(n.map(l=>l.path)).size<ao)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-Uu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:so,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function zu(){let e=location.pathname+location.search+location.hash;dt(e)}function $u(){let e=location.pathname+location.search+location.hash;dt(e)}var Xu=.3,Hs=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Fs=f(Yu),Bs=f(Ku);function fo(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Fs,{passive:!0}),window.addEventListener("click",Bs,{capture:!0})}function po(){window.removeEventListener("scroll",Fs),window.removeEventListener("click",Bs,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Yu(){ft||(ft=!0,requestAnimationFrame(ju))}function ju(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Hs&&(P=!1),le==="down"){let s=ce-t,a=n*Xu;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Ku(e){if(!P)return;let t=Date.now();if(t-mt>Hs){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Gu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Zu=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Qu=/^(A|BUTTON|LABEL)$/,Ju=3,Ws=9e4,ed=5,gt=new Map,Us=[],ht=null,td=5,Vs=f(nd),qs=f(ld);function nd(e){ht={x:e.clientX,y:e.clientY}}function mo(e){Us=e??[],document.addEventListener("mousedown",Vs,{capture:!0,passive:!0}),document.addEventListener("click",qs,{capture:!0,passive:!0})}function go(){document.removeEventListener("mousedown",Vs,{capture:!0}),document.removeEventListener("click",qs,{capture:!0}),ht=null,gt.clear()}function ho(){gt.clear()}function rd(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 od(e,t){return e*4+t}function id(e){if(Gu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Zu.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&&Qu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function sd(){let e=window.getSelection();return e!==null&&e.toString().length>0}function ad(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>td}function ld(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Us)||sd()||ad(e)||id(t))return;let{row:n,col:r}=rd(e.clientX,e.clientY),o=od(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Ws);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=Ju){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=ed))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Ws}}),gt.set(o,[])}}var vo=3,Ae=12e4,S=new Map,cn=[],vt=null,zs=f(pd),ln=f(md);function Eo(e){cn=e??[],document.addEventListener("invalid",zs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(gd),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function bo(){document.removeEventListener("invalid",zs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function yo(){for(let e of S.values())ne(e);S.clear()}function wo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function So(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function cd(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function ud(e){return f(t=>{Ys(e)})}function dd(e){return f(t=>{Ys(e)})}function $s(e,t){let n=ud(t),r=dd(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function Xs(e){if(!un(e)||v(e,cn))return;let t=Date.now();cd(t);let n=p(e),r=S.get(n);if(!r){$s(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=vo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:wo(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=vo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:wo(e)}}),ne(r),S.delete(n)))}function fd(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function Ys(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,So(n.el)){n.cycles+=1,n.cycles>=vo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:wo(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function pd(e){let t=e.target;t&&Xs(t)}function md(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||So(t)&&$s(t,n)}function gd(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=So(n);i&&!o?Xs(n):!i&&o&&fd(n)}}var De=null,wt=null,To=[],js=0,Et=new Map;function Lo(e){To=e?.length?e:["[data-fd-impression]"],js=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(vd),{threshold:[0,.5,1]}),Ks(),wt=new MutationObserver(y(hd)),wt.observe(document.body,{childList:!0,subtree:!0}))}function Co(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function ko(){Et.clear(),De&&Ks()}function Ks(){for(let e of To)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)_o(t[n])}catch{}}function _o(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function hd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of To)try{r.matches(o)&&_o(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)_o(i[s])}catch{}}}function vd(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-js),viewport_position:s}})}}}var wd=2,Ed=3,bd=6e4,bt=new Map,Gs=[],Zs=f(yd);function Mo(e){Gs=e??[],document.addEventListener("input",Zs,{capture:!0,passive:!0})}function xo(){document.removeEventListener("input",Zs,{capture:!0}),bt.clear()}function Ao(){bt.clear()}function yd(e){let t=e.target;if(!t||!Sd(t)||v(t,Gs))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>bd){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=Ed)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=wd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:_d(t)}}),bt.delete(o);return}i.lastValue=r}function Sd(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 _d(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Qs=2e3,Td=3e4,$=null,Js=Qs,ea=[],dn=new Map,ta=f(Ld),na=f(Cd),ra=f(yt);function Do(e,t){Js=e?.dwellMs??Qs,ea=t??[],document.addEventListener("mouseover",ta,{passive:!0}),document.addEventListener("mouseout",na,{passive:!0}),document.addEventListener("click",ra,{capture:!0,passive:!0})}function Ro(){document.removeEventListener("mouseover",ta),document.removeEventListener("mouseout",na),document.removeEventListener("click",ra,{capture:!0}),yt(),dn.clear()}function Io(){yt(),dn.clear()}function Ld(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ea)||!kd(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<Td)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Js);$={el:t,selector:n,startTs:o,timer:i}}function Cd(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function kd(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var Md=20,xd=500,Ad=3e3,Dd=6e4,fn=0,pn=0,X=null,oa=y(Rd);function Oo(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",oa)}function No(){document.removeEventListener("mouseleave",oa),X&&(clearTimeout(X),X=null)}function Po(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function Rd(e){if(e.clientY>Md)return;let t=Date.now();t-fn<Ad||t-pn<Dd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),xd))}var Id=2500,Od=4e3,ia=200,Nd=500,Pd=.1,Hd=.25,Ie=null,Oe=null,Q=null,Re=0;function Ho(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Fo(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Ho(r,Id,Od)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<ia||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Ho(r,ia,Nd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function sa(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Ho(Re,Pd,Hd)}})}Re=0}}function Bo(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),sa()}function Wo(){if(sa(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var aa=[],la=f(Fd);function Uo(e){aa=e??[],document.addEventListener("paste",la,{capture:!0,passive:!0})}function Vo(){document.removeEventListener("paste",la,{capture:!0})}function Fd(e){let t=e.target;if(!t||!Bd(t)||v(t,aa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:Wd(t)}})},100)}function Bd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Wd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Ud="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",qo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function Vd(){let e=window;return e[St]&&e[St]!==qo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=qo,!0)}function qd(){let e=window;e[St]===qo&&delete e[St]}var _t=[];function zd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Hn(e.signals?.rageClick,t),stop:Fn},{when:()=>r("deadClick"),start:()=>Bn(t),stop:Wn,reset:Un},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;qn(i?{delayMs:i.windowMs}:void 0,t)},stop:zn,reset:$n},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Kn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Gn},{when:()=>r("loopNav"),start:()=>Jn(e.signals?.loopNav),stop:er},{when:()=>r("scrollBounce"),start:ir,stop:sr,reset:ar},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;cr(i?{pauseMs:i.threshold}:void 0,t)},stop:ur,reset:dr},{when:()=>o&&r("formValidationLoop"),start:()=>Eo(t),stop:bo,reset:yo},{when:()=>r("errorEncounter"),start:mr,stop:gr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>Er(t),stop:br},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>Sr(t),stop:_r},{when:()=>r("scrollHijack"),start:Cr,stop:kr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:Mr,stop:xr,reset:Ar},{when:()=>r("advancedHeuristics"),start:Ir,stop:Or,reset:()=>{rt(),Nr()}},{when:()=>r("helpHunt"),start:()=>Pr(t),stop:Hr,reset:Fr},{when:()=>r("closeClick"),start:()=>Br(t),stop:Wr,reset:Ur},{when:()=>r("closeClickReversal"),start:()=>Vr(t),stop:qr,reset:zr},{when:()=>r("filterSpiral"),start:()=>Xr(t),stop:Yr,reset:jr},{when:()=>r("copyFrustration"),start:Kr,stop:Gr,reset:Zr},{when:()=>r("textSelectFrustration"),start:Qr,stop:Jr,reset:eo},{when:()=>r("deadClickTrapZone"),start:()=>mo(t),stop:go,reset:ho},{when:()=>!0,start:()=>oo(n),stop:io},{when:()=>r("navigationConfusion"),start:lo,stop:co,reset:uo},{when:()=>r("scrollToClickConfusion"),start:fo,stop:po,reset:an},{when:()=>r("elementImpression"),start:()=>Lo(e.elementImpressionSelectors),stop:Co,reset:ko},{when:()=>o&&r("inputCorrection"),start:()=>Mo(t),stop:xo,reset:Ao},{when:()=>o&&r("pasteBlocked"),start:()=>Uo(t),stop:Vo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;Do(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Ro,reset:Io},{when:()=>r("exitIntent"),start:Oo,stop:No,reset:Po},{when:()=>r("performanceVitals"),start:Fo,stop:Bo,reset:Wo}]}function $d(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 zo(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Yd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!Vd()){Ne=e;return}Ne=e,re=!0,typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(Xd));let t=Jo(e.cookieless??!1),n=$d(e.endpoint)??Ud,r=Pn(location.pathname,e.pageRules??[]),o=jd(e.domMode);ci(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=ca(location.pathname,e.ignorePages??[]);i&&On(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of zd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=di(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),ro(l);let g=Pn(l,e.pageRules??[]),w=ca(l,e.ignorePages??[]);On(w),Nn({page:g,url:d}),tr(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function ua(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function da(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function fa(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}Nn({segment:t})}function pa(e){e&&Ne&&!re?zo(Ne):e||(gn(),Ln())}function ma(){gn(),Ln()}function ga(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function Xd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function gn(){if(re){for(let e of ue)e();ue=[];for(let e of _t)e.stop();_t=[],ui(),mn&&(mn(),mn=null),qd(),re=!1}}function Yd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function jd(e){return e==="metadata"||e==="snapshot"?e:"off"}function ca(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var Ea=.1,ba=.01,ya=3e4,Sa=50,_a=1e4,Kd=500,Gd=3e4,Zd=6e4,ha=10,Qd=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Jd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,ef=/^\$\$?(heatmap|scroll)/,Ta=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],En=!1,hn=null,vn=null,Tt=null,H=null,wn=null,La=Ea,Ca=ba,ka=new Set,Ma=new Set(Ta),xa=ya,Yo=Sa,Aa=_a,R=[],bn=0,F=[];function va(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Da(e){En||(En=!0,La=va(e?.baselineSampleRate,Ea),Ca=va(e?.scrollSampleRate,ba),ka=new Set(e?.conversionEvents??[]),Ma=new Set(e?.criticalSignals?.length?e.criticalSignals:Ta),xa=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:ya,Yo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:Sa,Aa=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:_a,R=[],bn=0,F=[],vn=fe(lf),wa()||(hn=setInterval(()=>{wa()&&jo()},Kd),setTimeout(()=>jo(),Gd)))}function Ra(){En&&(En=!1,jo(),vn&&(vn(),vn=null),Tt&&wn&&Tt.capture.__fd_wrapped&&(Tt.capture=wn),Tt=null,H=null,wn=null,R=[],F=[],bn=0)}function jo(){hn&&(clearInterval(hn),hn=null)}function wa(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;wn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return nf(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function tf(e){return Qd.has(e)?"critical":ka.has(e)||Jd.test(e)?"conversion":ef.test(e)?"scroll":"baseline"}function nf(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=tf(e);if(o==="critical"||o==="conversion")return H(e,Xo(t,r),n);if(r<bn)return H(e,{...Xo(t,r),fd_boosted:!0},n);if(rf(o==="scroll"?Ca:La))return H(e,Xo(t,r),n);af({name:e,properties:t,ts:r})}function rf(e){if(e>=1)return!0;if(e<=0)return!1;let t=of();return t?sf(t)%1e4/1e4<e:Math.random()<e}var $o="";function of(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return $o||($o=Math.random().toString(36).slice(2)),$o}function sf(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Xo(e,t){return Oa(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function af(e){R.push(e),Ia(e.ts)}function Ia(e){let t=e-xa;for(;R.length&&R[0].ts<t;)R.shift();R.length>Yo&&(R=R.slice(-Yo))}function Oa(e){let t=e-Zd;F=F.filter(n=>n.ts>=t),F.length>ha&&(F=F.slice(-ha))}function lf({name:e,ts:t}){if(F.push({name:e,ts:t}),Oa(t),!Ma.has(e)||(bn=t+Aa,!H||!R.length))return;Ia(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}
1
+ "use strict";var _n=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames;var Ua=Object.prototype.hasOwnProperty;var Va=(e,t)=>{for(var n in t)_n(e,n,{get:t[n],enumerable:!0})},qa=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wa(t))!Ua.call(e,o)&&o!==n&&_n(e,o,{get:()=>t[o],enumerable:!(r=Ba(t,o))||r.enumerable});return e};var za=e=>qa(_n({},"__esModule",{value:!0}),e);var df={};Va(df,{destroy:()=>gn,destroyPostHogTrigger:()=>Oa,identify:()=>ma,init:()=>$o,initPostHogTrigger:()=>Ia,onSignal:()=>va,optOut:()=>ha,setConsent:()=>ga,signal:()=>fa,track:()=>pa});module.exports=za(df);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Tn="_fd_s";var $a=/^[0-9a-f]{32}$/;function ei(e){if(e)return Jo();let t=Xa(Tn);if(t&&$a.test(t))return t;let n=Jo();return ti(Tn,n,30),n}function Ln(){ti(Tn,"",-1)}function Jo(){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 Xa(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function ti(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var Ya=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!Ya.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,ja=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ka=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Ka.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!ja.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ri(e,t){if(t==="off")return null;if(t==="metadata")return Ga(e);let n=Za(e);return n?{mode:"snapshot",...n}:null}function Ga(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:ni(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:ni(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Qa(e)}}}function Za(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:el(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Ja(t),animations:i,siblings:o}}catch{return null}}function ni(e,t){return e&&t.includes(e)?e:null}function Qa(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 Ja(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function el(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 si=7e3,tl=500,nl=1e4,ai=50,Be=100,rl=3,We=6e4,xt="application/json",ol="application/json; encoding=gzip",j=[],B=null,li="",Dn=si,ci=ai,_=null,At={domMode:"off",compression:"auto"},Cn=!1,kn=null,Rn=!1,ui=!0;function In(e){ui=e}var oi=new WeakMap;function On(e){kn=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function il(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function sl(e){if(!kn||e.t!=="sig")return;let t=An(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{kn(t.slice(0,128),e.ts)}catch{}}function Nn(e){Rn=e}var al=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),ll=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),cl=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ul(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>cl.has(n))}var dl=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Mn=f(pl),xn=y(()=>J());function di(e,t,n,r,o){li=e,_=Object.assign(Object.create(null),t),At={domMode:_l(o?.domMode),compression:Tl(o?.compression)},Dn=Math.max(tl,Math.min(n??si,nl)),ci=Math.max(1,Math.min(r??ai,Be)),document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),document.addEventListener("visibilitychange",Mn),window.addEventListener("pagehide",xn)}function u(e){Rn||j.length>=Be||(il(e),sl(e),ui&&(j.push(e),j.length>=ci?J():B||(B=setTimeout(J,Dn))))}function J(){fl()}async function fl(){if(Cn||!j.length||!_)return;Cn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=El(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)ml({...t,events:o.events}).then(i=>{i||ii(o.source)}).catch(()=>ii(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Cn=!1}}function ii(e){let t=e.filter(r=>{let o=oi.get(r)??0;return o>=rl?!1:(oi.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,Dn))}function Pn(e){if(_)for(let t of Object.keys(e))al.has(t)&&(_[t]=e[t])}function fi(){J(),Rn=!1,document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),B&&(clearTimeout(B),B=null)}function pl(){document.visibilityState==="hidden"&&J()}async function ml(e){let t=JSON.stringify(e),n=await gl(t,At.compression);return n?wl(n):!0}async function gl(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await hl(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:ol}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function hl(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=vl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function vl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function wl(e,t=li){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function El(e,t,n){let r=e.d??{},o=bl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=An(r.el,r.element,r.target);if(o==="signal"){i.signal_type=An(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?Sl(s,n):null;c&&(i.dom=c)}let a=yl(r);return Object.keys(a).length&&(i.metadata=a),i}function bl(e){return e==="pv"?"pageview":e==="sig"?"signal":ll.has(e)?e:"custom_signal"}function yl(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!ul(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 dl.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function Sl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ri(n,t):null}catch{return null}}function An(...e){for(let t of e)if(typeof t=="string"&&t)return t}function _l(e){return e==="metadata"||e==="snapshot"?e:"off"}function Tl(e){return e==="off"?"off":"auto"}function pi(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function Hn(e,t){for(let n of t){let r=Cl(n.pattern);if(r&&r.test(e))return n.label}return kl(e)}var Ll=/^[a-zA-Z0-9/:._*\-]+$/;function Cl(e){if(e.length>200||!Ll.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function kl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id")}var Ml=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],W=[],mi=3,gi=2e3,hi=24,It=hi,vi=[],pe=[],wi=0,Ot=new Map,Nt=new Map,xl=1e4,Pt=!1,Ei=f(Al);function Fn(e,t){Pt||(Pt=!0,mi=e?.threshold??3,gi=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:hi,vi=[...Ml,...t??[]],wi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",Ei,{capture:!0,passive:!0}))}function Bn(){Pt&&(Pt=!1,document.removeEventListener("click",Ei,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function Al(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,vi)||Ol(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>gi;)W.shift();W.push({t:n,x:r,y:o});let i=Dl();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=Il(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=Rl(n),Go=Ot.get(b)??0,yn=Go+1,Zo=Nt.get(b)??0,Ha=Zo>0&&n-Zo<xl;Ot.set(b,yn),Nt.set(b,n);let Qo=Go>=1,Fa=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,Sn)=>de+Sn.x,0)/s.length,Ct=s.reduce((de,Sn)=>de+Sn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Qo,hot_repeat:Ha,...Fa??{}}}),Qo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:yn,burst_count:yn,burst_seq:Y}}),W=W.slice(-(i-1))}function Dl(){return pe.length>=3?2:mi}function Rl(e){let t=(e-wi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function Il(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function Ol(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Nl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Pl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Hl=/^(A|BUTTON|LABEL)$/,Fl=20,bi=[],me=null,Bl=5,Ht=new Map,yi=f(Wl),Si=f(ql);function Wl(e){me={x:e.clientX,y:e.clientY}}function Wn(e){bi=e??[],document.addEventListener("mousedown",yi,{capture:!0,passive:!0}),document.addEventListener("click",Si,{capture:!0,passive:!0})}function Un(){document.removeEventListener("mousedown",yi,{capture:!0}),document.removeEventListener("click",Si,{capture:!0}),me=null,Ht.clear()}function Vn(){Ht.clear()}function Ul(e){try{return window.getComputedStyle(e).cursor.slice(0,Fl)}catch{return""}}function Vl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function ql(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,bi)||Yl())return;let n=jl(e);if(me=null,n||zl(t))return;let r=$l(t,e.clientX,e.clientY),o=r?_i(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Ul(t),l=Vl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function zl(e){if(Nl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Pl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Hl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function $l(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Xl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function _i(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Xl(e,t,n){return _i(e,t,n).dist}function Yl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function jl(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Bl}var T=null,qn=3e3,Ti=[],Ft="click",Bt=0,Kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Gl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Li=f(Jl),Ci=f(Zl),ki=f(Ql);function zn(e,t){qn=e?.delayMs??3e3,Ti=t??[],document.addEventListener("click",Li,{capture:!0,passive:!0}),document.addEventListener("keydown",Ci,{capture:!0,passive:!0}),document.addEventListener("touchstart",ki,{capture:!0,passive:!0})}function $n(){document.removeEventListener("click",Li,{capture:!0}),document.removeEventListener("keydown",Ci,{capture:!0}),document.removeEventListener("touchstart",ki,{capture:!0}),ge()}function Xn(){ge()}function Zl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Ql(){Ft="touch",Bt=Date.now()}function Jl(e){let t=e.target;if(!t||v(t,Ti))return;let n=t.getAttribute("role");if(!Kl.test(t.tagName)&&!(n&&Gl.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=qn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},qn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var ec=100,tc=5,Mi=800,xi=2e3,nc=3,jn=0,rc=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,Yn=0,oe=[],Kn=0,he=null,Ai=f(oc);function Gn(e){Mi=e?.velocityThreshold??800,xi=e?.windowMs??2e3,document.addEventListener("mousemove",Ai,{passive:!0})}function Zn(){document.removeEventListener("mousemove",Ai),he&&clearTimeout(he),Qn()}function oc(e){let t=Date.now();t-jn<rc||(jn=t,he&&clearTimeout(he),he=setTimeout(()=>Qn(),150),ic(e.clientX,e.clientY,t))}function ic(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,Yn=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=ec&&(oe=oe.slice(-50)),oe.push(a),Kn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=tc&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-Yn>xi){if(Vt>=nc){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Mi&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(Kn)}})}Qn(),Yn=n}}function Qn(){Vt=0,oe=[],Kn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,jn=0,he=null}var Di=100,Ri=5,sc=3,L=[],M=[],Jn=3e4;function er(e){Jn=e?.windowMs??3e4}function tr(){L=[],M=[]}function nr(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Jn;)L.shift();for(;M.length&&t-M[0].ts>Jn;)M.shift();if(L.length>=Di&&(L=L.slice(-50)),M.length>=Di&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=sc&&a.length>c.size){let d=a.slice(-Ri).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ri).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var ac=100,Ii=1e4,or=.5,C=[],qt=0,ir=0,ze=!1,rr=0,Oi=f(lc);function sr(e){Ii=e?.windowMs??1e4,or=e?.depthThreshold??.5,window.addEventListener("scroll",Oi,{passive:!0})}function ar(){window.removeEventListener("scroll",Oi),C=[],ze=!1}function lr(){C=[],qt=0,ir=0,ze=!1}function lc(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,cc()}))}function cc(){let e=Date.now(),t=window.scrollY;if(rr=document.documentElement.scrollHeight-window.innerHeight,rr<=0)return;let n=t/rr,r=t>qt?"down":"up";if(e-ir<100){qt=t;return}for(;C.length&&e-C[0].ts>Ii;)C.shift();C.length>=ac&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,ir=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=or&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=or){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var uc=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,cr=0,Ni=5e3,Pi=[],dc=50,Hi=f(fc),Fi=f(pc),Bi=f(mc),Wi=y(pr),$e=null;function ur(e,t){Ni=e?.pauseMs??5e3,Pi=t??[],document.addEventListener("focusin",Hi,{capture:!0,passive:!0}),document.addEventListener("focusout",Fi,{capture:!0,passive:!0}),document.addEventListener("submit",Bi,{capture:!0,passive:!0}),window.addEventListener("pagehide",Wi),$e=y(()=>{document.visibilityState==="hidden"&&pr()}),document.addEventListener("visibilitychange",$e)}function dr(){document.removeEventListener("focusin",Hi,{capture:!0}),document.removeEventListener("focusout",Fi,{capture:!0}),document.removeEventListener("submit",Bi,{capture:!0}),window.removeEventListener("pagehide",Wi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function fr(){pr(),Xe.clear(),Ye.clear(),K.clear(),ie=null,cr=0}function fc(e){let t=e.target;if(!t||!Ui(t)||v(t,Pi)||gc(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,cr=r.querySelectorAll("input, select, textarea").length)}function pc(e){let t=e.target;if(!t||!Ui(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<dc)&&n!==void 0){let a=o-n;if(a>=Ni){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);hc(t)&&K.add(s)}function mc(){K.clear(),ie=null}function pr(){if(K.size>0&&ie){let e=cr||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Ui(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function gc(e){if(e.tagName==="TEXTAREA")return!0;for(let t of uc)try{if(e.matches(t))return!0}catch{return!1}return!1}function hc(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Vi=/flusterduck\.com|\/v1\/ingest/,zi=f(Ec),$i=f(bc);function gr(){window.addEventListener("error",zi),window.addEventListener("unhandledrejection",$i),yc()}function hr(){window.removeEventListener("error",zi),window.removeEventListener("unhandledrejection",$i),Sc()}var mr=/fetch|network|cors|timeout/i;function vc(e){return mr.test(e)?"network":"script"}function wc(e){if(e instanceof TypeError&&mr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return mr.test(t)?"network":"unhandled_promise"}function Ec(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:vr(t,200),ep:"",status:0,error_category:vc(t),url:location.pathname}})}function bc(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:vr(t,200),ep:"",status:0,error_category:wc(e.reason),url:location.pathname}})}function yc(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Vi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:qi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Vi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:vr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?qi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function Sc(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function qi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function vr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var Xi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],_c=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,wr=0,Er=null,Yi=[],ji=f(Tc),Ki=f(Lc),Gi=f(Mc),Zi=f(Dc),Qi=f(xc);function br(e){Yi=e??[],document.addEventListener("touchstart",ji,{passive:!0}),document.addEventListener("touchend",Ki,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Gi,{passive:!0}),window.addEventListener("orientationchange",Zi,{passive:!0})),window.visualViewport?.addEventListener("resize",Qi)}function yr(){document.removeEventListener("touchstart",ji),document.removeEventListener("touchend",Ki),document.removeEventListener("gesturechange",Gi),window.removeEventListener("orientationchange",Zi),window.visualViewport?.removeEventListener("resize",Qi),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,wr=0,Er=null}function Ji(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function Tc(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Ji(e.touches),ee=null)}function Lc(e){if(Ee>0){let s=e.touches.length>=2?Ji(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&Cc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&kc(i,n,r),ee=null}function Cc(e,t,n){if(v(e,Yi))return;let r=Rc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function kc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Xi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Xi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Mc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!_c.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function xc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function Ac(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Dc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-wr>3e4&&(we=0,wr=e),t!==Er&&(we++,Er=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:Ac()}}),we=0)}function Rc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],Sr=[],Ic=10,Oc=5e3,es=5,ts=3e3,Nc=15,Pc=5e3,ns=f(Hc);function _r(e){Sr=e??[],document.addEventListener("keydown",ns,{capture:!0,passive:!0})}function Tr(){document.removeEventListener("keydown",ns,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",Sr=[]}function Hc(e){let t=Date.now(),n=e.target;n&&v(n,Sr)||(e.key==="Tab"?Bc(t,n,e.shiftKey):e.key==="Escape"?Wc(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Uc(t,e.target))}function Fc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Bc(e,t,n){for(;x.length&&e-x[0].ts>Oc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=Ic){let i=x.map(a=>a.el).filter(Boolean),s=Fc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=ts?(A++,V=i,A>=es&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function Wc(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>ts){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=es&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Uc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>Pc;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=Nc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,Lr=0,Xt=!1,Yt=0,Cr=0,Vc=1e4,qc=2,zc=4,$c=3e3,Qe=null,jt=0,Xc=2e3,rs=f(Kc),os=f(Yc),is=f(jc);function kr(){window.addEventListener("wheel",os,{passive:!0}),window.addEventListener("touchmove",is,{passive:!0}),window.addEventListener("scroll",rs,{passive:!0})}function Mr(){window.removeEventListener("wheel",os),window.removeEventListener("touchmove",is),window.removeEventListener("scroll",rs),Kt()}function Kt(){Se=0,zt=0,$t=null,Lr=0,Xt=!1,Yt=0,Cr=0,Qe=null,jt=0}function Yc(){Qe="wheel",jt=Date.now()}function jc(){Qe="touch",jt=Date.now()}function Kc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,Gc()}))}function Gc(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-Lr>$c&&(Se=0,Lr=e),Se++,Se>=zc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=Xc?Qe:"wheel";e-Cr>Vc&&(Yt=0,Cr=e),Yt++;let a=Yt>=qc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,as=f(Zc),et=null,tt=null;function xr(){window.addEventListener("scroll",as,{passive:!0}),tt=y(ss),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&ss()}),document.addEventListener("visibilitychange",et)}function Ar(){window.removeEventListener("scroll",as),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function Dr(){se=0,_e=0,Je=!1}function Zc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function ss(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var ls=1500,cs=15e3,Qc=5e3,Jc=.15,Rr="",Te=0,Gt=0,nt=0,Le=0,Ir=0,Zt=null,Qt=0,Jt=!1,en=f(tu),us=f(nu),Ce=f(eu);function Or(){Jt||(Jt=!0,Ir=ds(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",us,{passive:!0}))}function Nr(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",us),fs(),Rr="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){fs(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:cs,cycle:e}})},cs)}function Pr(){Qt=0}function eu(){rt()}function tu(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Rr||r-Gt>ls)&&(Rr=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:ls}}),Te=0,Gt=r)}function nu(){let e=Date.now(),t=ds(),n=Ir||t,r=Math.abs(t-n)/Math.max(n,1);Ir=t,!(r<Jc)&&((!nt||e-nt>Qc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function ds(){return Math.max(1,window.innerWidth*window.innerHeight)}function fs(){Zt&&(clearTimeout(Zt),Zt=null)}var ps=6e4,ru=3,ou=["[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"]'],iu=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],ms=[],gs=f(su);function Hr(e){ms=e??[],document.addEventListener("click",gs,{capture:!0,passive:!0})}function Fr(){document.removeEventListener("click",gs,{capture:!0}),q=[]}function Br(){q=[]}function su(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ms)||!au(t))return;let n=Date.now();for(;q.length&&n-q[0].t>ps;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<ru)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ps}}),q=[]}function au(e){let t=e;for(let n=0;n<3&&t;n++){if(lu(t)||cu(t))return!0;t=t.parentElement}return!1}function lu(e){for(let t of ou)try{if(e.matches(t))return!0}catch{}return!1}function cu(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return iu.test(r)}var hs=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,vs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,ws=[],Es=f(uu);function Wr(e){ws=e??[],document.addEventListener("click",Es,{capture:!0,passive:!0})}function Ur(){document.removeEventListener("click",Es,{capture:!0}),tn=[],nn.clear()}function Vr(){tn=[],nn.clear()}function uu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ws)||!du(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:pu(t),...c??{}}})}function du(e){let t=e;for(let n=0;n<4&&t;n++){if(fu(t))return!0;t=t.parentElement}return!1}function fu(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&vs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(hs.test(o)||hs.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&vs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function pu(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var mu=1500,O=null,bs=[],ys=f(gu),Ss=f(hu),_s=f(vu);function qr(e){bs=e??[],document.addEventListener("click",ys,{capture:!0,passive:!0}),document.addEventListener("keydown",Ss,{capture:!0,passive:!0}),window.addEventListener("popstate",_s)}function zr(){document.removeEventListener("click",ys,{capture:!0}),document.removeEventListener("keydown",Ss,{capture:!0}),window.removeEventListener("popstate",_s),O=null}function $r(){O=null}function gu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,bs)){if(wu(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function hu(e){e.key==="Escape"&&Ts("escape")}function vu(){Ts("back_nav")}function Ts(e){if(!O)return;let t=Date.now()-O.t;if(t>mu){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function wu(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var Ls=1e4,Eu=3,bu=/^(checkbox|radio)$/,Cs=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,Xr=[],ks=f(yu),Ms=f(Su);function Yr(e){Xr=e??[],document.addEventListener("change",ks,{capture:!0,passive:!0}),document.addEventListener("click",Ms,{capture:!0,passive:!0})}function jr(){document.removeEventListener("change",ks,{capture:!0}),document.removeEventListener("click",Ms,{capture:!0}),ot.clear()}function Kr(){ot.clear()}function yu(e){let t=e.target;t&&(v(t,Xr)||_u(t)&&xs(t))}function Su(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Xr))return;let n=t.getAttribute("role")??"";Cs.test(n)&&t.tagName!=="INPUT"&&xs(t)}function xs(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>Ls;)r.shift();if(r.push({t:n}),r.length<Eu)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:Ls}}),ot.delete(t)}function _u(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?bu.test(e.type??""):Cs.test(e.getAttribute("role")??"")}var As=15e3,Tu=3,G=[],Ds=f(Lu);function Gr(){document.addEventListener("copy",Ds,{capture:!0,passive:!0})}function Zr(){document.removeEventListener("copy",Ds,{capture:!0}),G=[]}function Qr(){G=[]}function Lu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>As;)G.shift();G.push({t:r}),!(G.length<Tu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:As}}),G=[])}var Rs=15e3,Cu=4,ku=5,Mu=500,xu=2e3,D=[],rn=0,it=null,ae=null;function Jr(){it=y(Du),ae=y(Au),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function eo(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function to(){D=[],rn=0}function Au(){rn=Date.now(),D=[]}function Du(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<ku)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<xu)return;for(;D.length&&r-D[0].t>Rs;)D.shift();let o=D[D.length-1];o&&r-o.t<Mu||(D.push({t:r}),!(D.length<Cu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:Rs}}),D=[]))}var no=6e4,Ru=20,Os="_fd_sess",Iu={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},Ou=10,Is={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},ro="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Ns(e,Date.now())}function Nu(){try{let e=sessionStorage.getItem(Os);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Pu(){try{sessionStorage.setItem(Os,JSON.stringify(Me))}catch{}}function Hu(){let e=[],n=Date.now()-no,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Ns(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>Ru&&n.shift()}function Fu(e){let t=e-no,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Bu(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=Iu[n.type]??Ou;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Ps(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Wu(e,t,n){return Ps(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Uu(e,t,n,r){let o=Ps(r),i=Hu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:ro||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:no,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,Pu()}function Vu(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();Fu(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Ns(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Bu(),s=Wu(r.size,o,i);s&&(ke!==null&&Is[s]<=Is[ke]||(ke=s,Uu(s,r,o,i)))}function oo(e){ro=e}function io(e){z=[],ke=null,sn=!0,xe=new Map,ro=e??"",Nu(),On(Vu),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function so(){sn=!1,z=[],ke=null,xe=new Map,On(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var qu=8,ao=3e4,lo=5,zu=5e3,N=[],te="",ut=!1,Hs=f(Xu),Fs=f(Yu);function co(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Hs),window.addEventListener("hashchange",Fs)}function uo(){window.removeEventListener("popstate",Hs),window.removeEventListener("hashchange",Fs),N=[],ut=!1,te=""}function fo(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>ao;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<lo)&&(ut||$u(t))}function $u(e){let t=N.filter(l=>e-l.ts<=ao),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<lo||n.length===0||n.some(l=>l.leftAt-l.ts>=zu)||new Set(n.map(l=>l.path)).size<lo)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-qu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:ao,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Xu(){let e=location.pathname+location.search+location.hash;dt(e)}function Yu(){let e=location.pathname+location.search+location.hash;dt(e)}var ju=.3,Bs=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Ws=f(Ku),Us=f(Zu);function po(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Ws,{passive:!0}),window.addEventListener("click",Us,{capture:!0})}function mo(){window.removeEventListener("scroll",Ws),window.removeEventListener("click",Us,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Ku(){ft||(ft=!0,requestAnimationFrame(Gu))}function Gu(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Bs&&(P=!1),le==="down"){let s=ce-t,a=n*ju;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Zu(e){if(!P)return;let t=Date.now();if(t-mt>Bs){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Qu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ju=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,ed=/^(A|BUTTON|LABEL)$/,td=3,Vs=9e4,nd=5,gt=new Map,qs=[],ht=null,rd=5,zs=f(od),$s=f(ud);function od(e){ht={x:e.clientX,y:e.clientY}}function go(e){qs=e??[],document.addEventListener("mousedown",zs,{capture:!0,passive:!0}),document.addEventListener("click",$s,{capture:!0,passive:!0})}function ho(){document.removeEventListener("mousedown",zs,{capture:!0}),document.removeEventListener("click",$s,{capture:!0}),ht=null,gt.clear()}function vo(){gt.clear()}function id(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 sd(e,t){return e*4+t}function ad(e){if(Qu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ju.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&&ed.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ld(){let e=window.getSelection();return e!==null&&e.toString().length>0}function cd(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>rd}function ud(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,qs)||ld()||cd(e)||ad(t))return;let{row:n,col:r}=id(e.clientX,e.clientY),o=sd(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Vs);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=td){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=nd))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Vs}}),gt.set(o,[])}}var wo=3,Ae=12e4,S=new Map,cn=[],vt=null,Xs=f(gd),ln=f(hd);function bo(e){cn=e??[],document.addEventListener("invalid",Xs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(vd),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function yo(){document.removeEventListener("invalid",Xs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function So(){for(let e of S.values())ne(e);S.clear()}function Eo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function _o(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function dd(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function fd(e){return f(t=>{Ks(e)})}function pd(e){return f(t=>{Ks(e)})}function Ys(e,t){let n=fd(t),r=pd(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function js(e){if(!un(e)||v(e,cn))return;let t=Date.now();dd(t);let n=p(e),r=S.get(n);if(!r){Ys(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:Eo(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:Eo(e)}}),ne(r),S.delete(n)))}function md(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function Ks(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,_o(n.el)){n.cycles+=1,n.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:Eo(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function gd(e){let t=e.target;t&&js(t)}function hd(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||_o(t)&&Ys(t,n)}function vd(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=_o(n);i&&!o?js(n):!i&&o&&md(n)}}var De=null,wt=null,Lo=[],Gs=0,Et=new Map;function Co(e){Lo=e?.length?e:["[data-fd-impression]"],Gs=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(Ed),{threshold:[0,.5,1]}),Zs(),wt=new MutationObserver(y(wd)),wt.observe(document.body,{childList:!0,subtree:!0}))}function ko(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function Mo(){Et.clear(),De&&Zs()}function Zs(){for(let e of Lo)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)To(t[n])}catch{}}function To(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function wd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of Lo)try{r.matches(o)&&To(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)To(i[s])}catch{}}}function Ed(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Gs),viewport_position:s}})}}}var bd=2,yd=3,Sd=6e4,bt=new Map,Qs=[],Js=f(_d);function xo(e){Qs=e??[],document.addEventListener("input",Js,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("input",Js,{capture:!0}),bt.clear()}function Do(){bt.clear()}function _d(e){let t=e.target;if(!t||!Td(t)||v(t,Qs))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Sd){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=yd)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=bd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:Ld(t)}}),bt.delete(o);return}i.lastValue=r}function Td(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 Ld(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var ea=2e3,Cd=3e4,$=null,ta=ea,na=[],dn=new Map,ra=f(kd),oa=f(Md),ia=f(yt);function Ro(e,t){ta=e?.dwellMs??ea,na=t??[],document.addEventListener("mouseover",ra,{passive:!0}),document.addEventListener("mouseout",oa,{passive:!0}),document.addEventListener("click",ia,{capture:!0,passive:!0})}function Io(){document.removeEventListener("mouseover",ra),document.removeEventListener("mouseout",oa),document.removeEventListener("click",ia,{capture:!0}),yt(),dn.clear()}function Oo(){yt(),dn.clear()}function kd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,na)||!xd(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<Cd)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},ta);$={el:t,selector:n,startTs:o,timer:i}}function Md(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function xd(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var Ad=20,Dd=500,Rd=3e3,Id=6e4,fn=0,pn=0,X=null,sa=y(Od);function No(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",sa)}function Po(){document.removeEventListener("mouseleave",sa),X&&(clearTimeout(X),X=null)}function Ho(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function Od(e){if(e.clientY>Ad)return;let t=Date.now();t-fn<Rd||t-pn<Id||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),Dd))}var Nd=2500,Pd=4e3,aa=200,Hd=500,Fd=.1,Bd=.25,Ie=null,Oe=null,Q=null,Re=0;function Fo(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Bo(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Fo(r,Nd,Pd)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<aa||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Fo(r,aa,Hd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function la(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Fo(Re,Fd,Bd)}})}Re=0}}function Wo(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),la()}function Uo(){if(la(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var ca=[],ua=f(Wd);function Vo(e){ca=e??[],document.addEventListener("paste",ua,{capture:!0,passive:!0})}function qo(){document.removeEventListener("paste",ua,{capture:!0})}function Wd(e){let t=e.target;if(!t||!Ud(t)||v(t,ca))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:Vd(t)}})},100)}function Ud(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 Vd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var qd="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",zo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function zd(){let e=window;return e[St]&&e[St]!==zo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=zo,!0)}function $d(){let e=window;e[St]===zo&&delete e[St]}var _t=[];function Xd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Fn(e.signals?.rageClick,t),stop:Bn},{when:()=>r("deadClick"),start:()=>Wn(t),stop:Un,reset:Vn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;zn(i?{delayMs:i.windowMs}:void 0,t)},stop:$n,reset:Xn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Gn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Zn},{when:()=>r("loopNav"),start:()=>er(e.signals?.loopNav),stop:tr},{when:()=>r("scrollBounce"),start:sr,stop:ar,reset:lr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;ur(i?{pauseMs:i.threshold}:void 0,t)},stop:dr,reset:fr},{when:()=>o&&r("formValidationLoop"),start:()=>bo(t),stop:yo,reset:So},{when:()=>r("errorEncounter"),start:gr,stop:hr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>br(t),stop:yr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>_r(t),stop:Tr},{when:()=>r("scrollHijack"),start:kr,stop:Mr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:xr,stop:Ar,reset:Dr},{when:()=>r("advancedHeuristics"),start:Or,stop:Nr,reset:()=>{rt(),Pr()}},{when:()=>r("helpHunt"),start:()=>Hr(t),stop:Fr,reset:Br},{when:()=>r("closeClick"),start:()=>Wr(t),stop:Ur,reset:Vr},{when:()=>r("closeClickReversal"),start:()=>qr(t),stop:zr,reset:$r},{when:()=>r("filterSpiral"),start:()=>Yr(t),stop:jr,reset:Kr},{when:()=>r("copyFrustration"),start:Gr,stop:Zr,reset:Qr},{when:()=>r("textSelectFrustration"),start:Jr,stop:eo,reset:to},{when:()=>r("deadClickTrapZone"),start:()=>go(t),stop:ho,reset:vo},{when:()=>!0,start:()=>io(n),stop:so},{when:()=>r("navigationConfusion"),start:co,stop:uo,reset:fo},{when:()=>r("scrollToClickConfusion"),start:po,stop:mo,reset:an},{when:()=>r("elementImpression"),start:()=>Co(e.elementImpressionSelectors),stop:ko,reset:Mo},{when:()=>o&&r("inputCorrection"),start:()=>xo(t),stop:Ao,reset:Do},{when:()=>o&&r("pasteBlocked"),start:()=>Vo(t),stop:qo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;Ro(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Io,reset:Oo},{when:()=>r("exitIntent"),start:No,stop:Po,reset:Ho},{when:()=>r("performanceVitals"),start:Bo,stop:Wo,reset:Uo}]}function Yd(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 $o(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Kd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!zd()){Ne=e;return}Ne=e,re=!0,In(e.transport!=="none"),typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(jd));let t=ei(e.cookieless??!1),n=Yd(e.endpoint)??qd,r=Hn(location.pathname,e.pageRules??[]),o=Gd(e.domMode);di(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=da(location.pathname,e.ignorePages??[]);i&&Nn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of Xd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=pi(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),oo(l);let g=Hn(l,e.pageRules??[]),w=da(l,e.ignorePages??[]);Nn(w),Pn({page:g,url:d}),nr(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function fa(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function pa(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function ma(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let o=e[r];typeof o!="string"&&typeof o!="number"&&typeof o!="boolean"||(t[r.slice(0,64)]=String(o).slice(0,256),n++)}Pn({segment:t})}function ga(e){e&&Ne&&!re?$o(Ne):e||(gn(),Ln())}function ha(){gn(),Ln()}function va(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function jd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function gn(){if(re){for(let e of ue)e();ue=[],In(!0);for(let e of _t)e.stop();_t=[],fi(),mn&&(mn(),mn=null),$d(),re=!1}}function Kd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Gd(e){return e==="metadata"||e==="snapshot"?e:"off"}function da(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var ya=.1,Sa=.01,_a=3e4,Ta=50,La=1e4,Zd=500,Qd=3e4,Jd=6e4,wa=10,ef=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),tf=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,nf=/^\$\$?(heatmap|scroll)/,Ca=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],En=!1,hn=null,vn=null,Tt=null,H=null,wn=null,ka=ya,Ma=Sa,xa=new Set,Aa=new Set(Ca),Da=_a,jo=Ta,Ra=La,R=[],bn=0,F=[];function Ea(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Ia(e){En||(En=!0,ka=Ea(e?.baselineSampleRate,ya),Ma=Ea(e?.scrollSampleRate,Sa),xa=new Set(e?.conversionEvents??[]),Aa=new Set(e?.criticalSignals?.length?e.criticalSignals:Ca),Da=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:_a,jo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:Ta,Ra=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:La,R=[],bn=0,F=[],vn=fe(uf),ba()||(hn=setInterval(()=>{ba()&&Ko()},Zd),setTimeout(()=>Ko(),Qd)))}function Oa(){En&&(En=!1,Ko(),vn&&(vn(),vn=null),Tt&&wn&&Tt.capture.__fd_wrapped&&(Tt.capture=wn),Tt=null,H=null,wn=null,R=[],F=[],bn=0)}function Ko(){hn&&(clearInterval(hn),hn=null)}function ba(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;wn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return of(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function rf(e){return ef.has(e)?"critical":xa.has(e)||tf.test(e)?"conversion":nf.test(e)?"scroll":"baseline"}function of(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=rf(e);if(o==="critical"||o==="conversion")return H(e,Yo(t,r),n);if(r<bn)return H(e,{...Yo(t,r),fd_boosted:!0},n);if(sf(o==="scroll"?Ma:ka))return H(e,Yo(t,r),n);cf({name:e,properties:t,ts:r})}function sf(e){if(e>=1)return!0;if(e<=0)return!1;let t=af();return t?lf(t)%1e4/1e4<e:Math.random()<e}var Xo="";function af(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return Xo||(Xo=Math.random().toString(36).slice(2)),Xo}function lf(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Yo(e,t){return Pa(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function cf(e){R.push(e),Na(e.ts)}function Na(e){let t=e-Da;for(;R.length&&R[0].ts<t;)R.shift();R.length>jo&&(R=R.slice(-jo))}function Pa(e){let t=e-Jd;F=F.filter(n=>n.ts>=t),F.length>wa&&(F=F.slice(-wa))}function uf({name:e,ts:t}){if(F.push({name:e,ts:t}),Pa(t),!Aa.has(e)||(bn=t+Ra,!H||!R.length))return;Na(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Sn="_fd_s";var Ma=/^[0-9a-f]{32}$/;function Zo(e){if(e)return Go();let t=xa(Sn);if(t&&Ma.test(t))return t;let n=Go();return Qo(Sn,n,30),n}function _n(){Qo(Sn,"",-1)}function Go(){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 xa(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Qo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var Aa=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!Aa.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,Da=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ra=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Ra.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!Da.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ei(e,t){if(t==="off")return null;if(t==="metadata")return Ia(e);let n=Oa(e);return n?{mode:"snapshot",...n}:null}function Ia(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:Jo(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Jo(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Na(e)}}}function Oa(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Ha(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Pa(t),animations:i,siblings:o}}catch{return null}}function Jo(e,t){return e&&t.includes(e)?e:null}function Na(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 Pa(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Ha(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 ri=7e3,Fa=500,Ba=1e4,oi=50,Be=100,Wa=3,We=6e4,xt="application/json",Ua="application/json; encoding=gzip",j=[],B=null,ii="",xn=ri,si=oi,_=null,At={domMode:"off",compression:"auto"},Tn=!1,Ln=null,An=!1,ti=new WeakMap;function Dn(e){Ln=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function Va(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function qa(e){if(!Ln||e.t!=="sig")return;let t=Mn(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{Ln(t.slice(0,128),e.ts)}catch{}}function Rn(e){An=e}var za=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"]),Xa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function Ya(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>Xa.has(n))}var ja=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Cn=f(Ga),kn=y(()=>J());function ai(e,t,n,r,o){ii=e,_=Object.assign(Object.create(null),t),At={domMode:sl(o?.domMode),compression:al(o?.compression)},xn=Math.max(Fa,Math.min(n??ri,Ba)),si=Math.max(1,Math.min(r??oi,Be)),document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),document.addEventListener("visibilitychange",Cn),window.addEventListener("pagehide",kn)}function u(e){An||j.length>=Be||(Va(e),qa(e),j.push(e),j.length>=si?J():B||(B=setTimeout(J,xn)))}function J(){Ka()}async function Ka(){if(Tn||!j.length||!_)return;Tn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=nl(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)Za({...t,events:o.events}).then(i=>{i||ni(o.source)}).catch(()=>ni(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Tn=!1}}function ni(e){let t=e.filter(r=>{let o=ti.get(r)??0;return o>=Wa?!1:(ti.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,xn))}function In(e){if(_)for(let t of Object.keys(e))za.has(t)&&(_[t]=e[t])}function li(){J(),An=!1,document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),B&&(clearTimeout(B),B=null)}function Ga(){document.visibilityState==="hidden"&&J()}async function Za(e){let t=JSON.stringify(e),n=await Qa(t,At.compression);return n?tl(n):!0}async function Qa(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await Ja(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:Ua}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function Ja(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=el(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function el(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function tl(e,t=ii){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function nl(e,t,n){let r=e.d??{},o=rl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=Mn(r.el,r.element,r.target);if(o==="signal"){i.signal_type=Mn(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?il(s,n):null;c&&(i.dom=c)}let a=ol(r);return Object.keys(a).length&&(i.metadata=a),i}function rl(e){return e==="pv"?"pageview":e==="sig"?"signal":$a.has(e)?e:"custom_signal"}function ol(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!Ya(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 ja.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function il(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ei(n,t):null}catch{return null}}function Mn(...e){for(let t of e)if(typeof t=="string"&&t)return t}function sl(e){return e==="metadata"||e==="snapshot"?e:"off"}function al(e){return e==="off"?"off":"auto"}function ci(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function On(e,t){for(let n of t){let r=cl(n.pattern);if(r&&r.test(e))return n.label}return ul(e)}var ll=/^[a-zA-Z0-9/:._*\-]+$/;function cl(e){if(e.length>200||!ll.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function ul(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id")}var dl=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],W=[],ui=3,di=2e3,fi=24,It=fi,pi=[],pe=[],mi=0,Ot=new Map,Nt=new Map,fl=1e4,Pt=!1,gi=f(pl);function Nn(e,t){Pt||(Pt=!0,ui=e?.threshold??3,di=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:fi,pi=[...dl,...t??[]],mi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",gi,{capture:!0,passive:!0}))}function Pn(){Pt&&(Pt=!1,document.removeEventListener("click",gi,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function pl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,pi)||vl(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>di;)W.shift();W.push({t:n,x:r,y:o});let i=ml();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=hl(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=gl(n),Yo=Ot.get(b)??0,bn=Yo+1,jo=Nt.get(b)??0,Ca=jo>0&&n-jo<fl;Ot.set(b,bn),Nt.set(b,n);let Ko=Yo>=1,ka=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,yn)=>de+yn.x,0)/s.length,Ct=s.reduce((de,yn)=>de+yn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Ko,hot_repeat:Ca,...ka??{}}}),Ko&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:bn,burst_count:bn,burst_seq:Y}}),W=W.slice(-(i-1))}function ml(){return pe.length>=3?2:ui}function gl(e){let t=(e-mi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function hl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function vl(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var wl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,El=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,bl=/^(A|BUTTON|LABEL)$/,yl=20,hi=[],me=null,Sl=5,Ht=new Map,vi=f(_l),wi=f(Cl);function _l(e){me={x:e.clientX,y:e.clientY}}function Hn(e){hi=e??[],document.addEventListener("mousedown",vi,{capture:!0,passive:!0}),document.addEventListener("click",wi,{capture:!0,passive:!0})}function Fn(){document.removeEventListener("mousedown",vi,{capture:!0}),document.removeEventListener("click",wi,{capture:!0}),me=null,Ht.clear()}function Bn(){Ht.clear()}function Tl(e){try{return window.getComputedStyle(e).cursor.slice(0,yl)}catch{return""}}function Ll(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Cl(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hi)||Al())return;let n=Dl(e);if(me=null,n||kl(t))return;let r=Ml(t,e.clientX,e.clientY),o=r?Ei(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Tl(t),l=Ll(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function kl(e){if(wl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&El.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&&bl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Ml(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=xl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function Ei(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function xl(e,t,n){return Ei(e,t,n).dist}function Al(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Dl(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Sl}var T=null,Wn=3e3,bi=[],Ft="click",Bt=0,Rl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Il=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,yi=f(Pl),Si=f(Ol),_i=f(Nl);function Un(e,t){Wn=e?.delayMs??3e3,bi=t??[],document.addEventListener("click",yi,{capture:!0,passive:!0}),document.addEventListener("keydown",Si,{capture:!0,passive:!0}),document.addEventListener("touchstart",_i,{capture:!0,passive:!0})}function Vn(){document.removeEventListener("click",yi,{capture:!0}),document.removeEventListener("keydown",Si,{capture:!0}),document.removeEventListener("touchstart",_i,{capture:!0}),ge()}function qn(){ge()}function Ol(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Nl(){Ft="touch",Bt=Date.now()}function Pl(e){let t=e.target;if(!t||v(t,bi))return;let n=t.getAttribute("role");if(!Rl.test(t.tagName)&&!(n&&Il.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Wn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Wn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Hl=100,Fl=5,Ti=800,Li=2e3,Bl=3,$n=0,Wl=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,zn=0,oe=[],Xn=0,he=null,Ci=f(Ul);function Yn(e){Ti=e?.velocityThreshold??800,Li=e?.windowMs??2e3,document.addEventListener("mousemove",Ci,{passive:!0})}function jn(){document.removeEventListener("mousemove",Ci),he&&clearTimeout(he),Kn()}function Ul(e){let t=Date.now();t-$n<Wl||($n=t,he&&clearTimeout(he),he=setTimeout(()=>Kn(),150),Vl(e.clientX,e.clientY,t))}function Vl(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,zn=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=Hl&&(oe=oe.slice(-50)),oe.push(a),Xn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Fl&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-zn>Li){if(Vt>=Bl){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Ti&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(Xn)}})}Kn(),zn=n}}function Kn(){Vt=0,oe=[],Xn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,$n=0,he=null}var ki=100,Mi=5,ql=3,L=[],M=[],Gn=3e4;function Zn(e){Gn=e?.windowMs??3e4}function Qn(){L=[],M=[]}function Jn(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Gn;)L.shift();for(;M.length&&t-M[0].ts>Gn;)M.shift();if(L.length>=ki&&(L=L.slice(-50)),M.length>=ki&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=ql&&a.length>c.size){let d=a.slice(-Mi).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Mi).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var zl=100,xi=1e4,tr=.5,C=[],qt=0,nr=0,ze=!1,er=0,Ai=f($l);function rr(e){xi=e?.windowMs??1e4,tr=e?.depthThreshold??.5,window.addEventListener("scroll",Ai,{passive:!0})}function or(){window.removeEventListener("scroll",Ai),C=[],ze=!1}function ir(){C=[],qt=0,nr=0,ze=!1}function $l(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,Xl()}))}function Xl(){let e=Date.now(),t=window.scrollY;if(er=document.documentElement.scrollHeight-window.innerHeight,er<=0)return;let n=t/er,r=t>qt?"down":"up";if(e-nr<100){qt=t;return}for(;C.length&&e-C[0].ts>xi;)C.shift();C.length>=zl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,nr=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=tr&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=tr){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var Yl=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,sr=0,Di=5e3,Ri=[],jl=50,Ii=f(Kl),Oi=f(Gl),Ni=f(Zl),Pi=y(ur),$e=null;function ar(e,t){Di=e?.pauseMs??5e3,Ri=t??[],document.addEventListener("focusin",Ii,{capture:!0,passive:!0}),document.addEventListener("focusout",Oi,{capture:!0,passive:!0}),document.addEventListener("submit",Ni,{capture:!0,passive:!0}),window.addEventListener("pagehide",Pi),$e=y(()=>{document.visibilityState==="hidden"&&ur()}),document.addEventListener("visibilitychange",$e)}function lr(){document.removeEventListener("focusin",Ii,{capture:!0}),document.removeEventListener("focusout",Oi,{capture:!0}),document.removeEventListener("submit",Ni,{capture:!0}),window.removeEventListener("pagehide",Pi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function cr(){ur(),Xe.clear(),Ye.clear(),K.clear(),ie=null,sr=0}function Kl(e){let t=e.target;if(!t||!Hi(t)||v(t,Ri)||Ql(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,sr=r.querySelectorAll("input, select, textarea").length)}function Gl(e){let t=e.target;if(!t||!Hi(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<jl)&&n!==void 0){let a=o-n;if(a>=Di){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Jl(t)&&K.add(s)}function Zl(){K.clear(),ie=null}function ur(){if(K.size>0&&ie){let e=sr||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Hi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function Ql(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Yl)try{if(e.matches(t))return!0}catch{return!1}return!1}function Jl(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Fi=/flusterduck\.com|\/v1\/ingest/,Wi=f(nc),Ui=f(rc);function fr(){window.addEventListener("error",Wi),window.addEventListener("unhandledrejection",Ui),oc()}function pr(){window.removeEventListener("error",Wi),window.removeEventListener("unhandledrejection",Ui),ic()}var dr=/fetch|network|cors|timeout/i;function ec(e){return dr.test(e)?"network":"script"}function tc(e){if(e instanceof TypeError&&dr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return dr.test(t)?"network":"unhandled_promise"}function nc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:mr(t,200),ep:"",status:0,error_category:ec(t),url:location.pathname}})}function rc(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:mr(t,200),ep:"",status:0,error_category:tc(e.reason),url:location.pathname}})}function oc(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Fi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Bi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Fi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:mr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Bi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function ic(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function Bi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function mr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var Vi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],sc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,gr=0,hr=null,qi=[],zi=f(ac),$i=f(lc),Xi=f(dc),Yi=f(mc),ji=f(fc);function vr(e){qi=e??[],document.addEventListener("touchstart",zi,{passive:!0}),document.addEventListener("touchend",$i,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Xi,{passive:!0}),window.addEventListener("orientationchange",Yi,{passive:!0})),window.visualViewport?.addEventListener("resize",ji)}function wr(){document.removeEventListener("touchstart",zi),document.removeEventListener("touchend",$i),document.removeEventListener("gesturechange",Xi),window.removeEventListener("orientationchange",Yi),window.visualViewport?.removeEventListener("resize",ji),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,gr=0,hr=null}function Ki(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function ac(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Ki(e.touches),ee=null)}function lc(e){if(Ee>0){let s=e.touches.length>=2?Ki(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&cc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&uc(i,n,r),ee=null}function cc(e,t,n){if(v(e,qi))return;let r=gc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function uc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Vi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Vi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function dc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!sc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function fc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function pc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function mc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-gr>3e4&&(we=0,gr=e),t!==hr&&(we++,hr=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:pc()}}),we=0)}function gc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],Er=[],hc=10,vc=5e3,Gi=5,Zi=3e3,wc=15,Ec=5e3,Qi=f(bc);function br(e){Er=e??[],document.addEventListener("keydown",Qi,{capture:!0,passive:!0})}function yr(){document.removeEventListener("keydown",Qi,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",Er=[]}function bc(e){let t=Date.now(),n=e.target;n&&v(n,Er)||(e.key==="Tab"?Sc(t,n,e.shiftKey):e.key==="Escape"?_c(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Tc(t,e.target))}function yc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Sc(e,t,n){for(;x.length&&e-x[0].ts>vc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=hc){let i=x.map(a=>a.el).filter(Boolean),s=yc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=Zi?(A++,V=i,A>=Gi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function _c(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>Zi){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=Gi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Tc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>Ec;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=wc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,Sr=0,Xt=!1,Yt=0,_r=0,Lc=1e4,Cc=2,kc=4,Mc=3e3,Qe=null,jt=0,xc=2e3,Ji=f(Rc),es=f(Ac),ts=f(Dc);function Tr(){window.addEventListener("wheel",es,{passive:!0}),window.addEventListener("touchmove",ts,{passive:!0}),window.addEventListener("scroll",Ji,{passive:!0})}function Lr(){window.removeEventListener("wheel",es),window.removeEventListener("touchmove",ts),window.removeEventListener("scroll",Ji),Kt()}function Kt(){Se=0,zt=0,$t=null,Sr=0,Xt=!1,Yt=0,_r=0,Qe=null,jt=0}function Ac(){Qe="wheel",jt=Date.now()}function Dc(){Qe="touch",jt=Date.now()}function Rc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,Ic()}))}function Ic(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-Sr>Mc&&(Se=0,Sr=e),Se++,Se>=kc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=xc?Qe:"wheel";e-_r>Lc&&(Yt=0,_r=e),Yt++;let a=Yt>=Cc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,rs=f(Oc),et=null,tt=null;function Cr(){window.addEventListener("scroll",rs,{passive:!0}),tt=y(ns),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&ns()}),document.addEventListener("visibilitychange",et)}function kr(){window.removeEventListener("scroll",rs),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function Mr(){se=0,_e=0,Je=!1}function Oc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function ns(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var os=1500,is=15e3,Nc=5e3,Pc=.15,xr="",Te=0,Gt=0,nt=0,Le=0,Ar=0,Zt=null,Qt=0,Jt=!1,en=f(Fc),ss=f(Bc),Ce=f(Hc);function Dr(){Jt||(Jt=!0,Ar=as(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",ss,{passive:!0}))}function Rr(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",ss),ls(),xr="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){ls(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:is,cycle:e}})},is)}function Ir(){Qt=0}function Hc(){rt()}function Fc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==xr||r-Gt>os)&&(xr=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:os}}),Te=0,Gt=r)}function Bc(){let e=Date.now(),t=as(),n=Ar||t,r=Math.abs(t-n)/Math.max(n,1);Ar=t,!(r<Pc)&&((!nt||e-nt>Nc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function as(){return Math.max(1,window.innerWidth*window.innerHeight)}function ls(){Zt&&(clearTimeout(Zt),Zt=null)}var cs=6e4,Wc=3,Uc=["[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"]'],Vc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],us=[],ds=f(qc);function Or(e){us=e??[],document.addEventListener("click",ds,{capture:!0,passive:!0})}function Nr(){document.removeEventListener("click",ds,{capture:!0}),q=[]}function Pr(){q=[]}function qc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,us)||!zc(t))return;let n=Date.now();for(;q.length&&n-q[0].t>cs;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<Wc)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:cs}}),q=[]}function zc(e){let t=e;for(let n=0;n<3&&t;n++){if($c(t)||Xc(t))return!0;t=t.parentElement}return!1}function $c(e){for(let t of Uc)try{if(e.matches(t))return!0}catch{}return!1}function Xc(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return Vc.test(r)}var fs=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ps=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,ms=[],gs=f(Yc);function Hr(e){ms=e??[],document.addEventListener("click",gs,{capture:!0,passive:!0})}function Fr(){document.removeEventListener("click",gs,{capture:!0}),tn=[],nn.clear()}function Br(){tn=[],nn.clear()}function Yc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ms)||!jc(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:Gc(t),...c??{}}})}function jc(e){let t=e;for(let n=0;n<4&&t;n++){if(Kc(t))return!0;t=t.parentElement}return!1}function Kc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&ps.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(fs.test(o)||fs.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ps.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function Gc(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var Zc=1500,O=null,hs=[],vs=f(Qc),ws=f(Jc),Es=f(eu);function Wr(e){hs=e??[],document.addEventListener("click",vs,{capture:!0,passive:!0}),document.addEventListener("keydown",ws,{capture:!0,passive:!0}),window.addEventListener("popstate",Es)}function Ur(){document.removeEventListener("click",vs,{capture:!0}),document.removeEventListener("keydown",ws,{capture:!0}),window.removeEventListener("popstate",Es),O=null}function Vr(){O=null}function Qc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,hs)){if(tu(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function Jc(e){e.key==="Escape"&&bs("escape")}function eu(){bs("back_nav")}function bs(e){if(!O)return;let t=Date.now()-O.t;if(t>Zc){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function tu(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var ys=1e4,nu=3,ru=/^(checkbox|radio)$/,Ss=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,qr=[],_s=f(ou),Ts=f(iu);function zr(e){qr=e??[],document.addEventListener("change",_s,{capture:!0,passive:!0}),document.addEventListener("click",Ts,{capture:!0,passive:!0})}function $r(){document.removeEventListener("change",_s,{capture:!0}),document.removeEventListener("click",Ts,{capture:!0}),ot.clear()}function Xr(){ot.clear()}function ou(e){let t=e.target;t&&(v(t,qr)||su(t)&&Ls(t))}function iu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,qr))return;let n=t.getAttribute("role")??"";Ss.test(n)&&t.tagName!=="INPUT"&&Ls(t)}function Ls(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>ys;)r.shift();if(r.push({t:n}),r.length<nu)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:ys}}),ot.delete(t)}function su(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?ru.test(e.type??""):Ss.test(e.getAttribute("role")??"")}var Cs=15e3,au=3,G=[],ks=f(lu);function Yr(){document.addEventListener("copy",ks,{capture:!0,passive:!0})}function jr(){document.removeEventListener("copy",ks,{capture:!0}),G=[]}function Kr(){G=[]}function lu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>Cs;)G.shift();G.push({t:r}),!(G.length<au)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:Cs}}),G=[])}var Ms=15e3,cu=4,uu=5,du=500,fu=2e3,D=[],rn=0,it=null,ae=null;function Gr(){it=y(mu),ae=y(pu),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function Zr(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function Qr(){D=[],rn=0}function pu(){rn=Date.now(),D=[]}function mu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<uu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<fu)return;for(;D.length&&r-D[0].t>Ms;)D.shift();let o=D[D.length-1];o&&r-o.t<du||(D.push({t:r}),!(D.length<cu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:Ms}}),D=[]))}var Jr=6e4,gu=20,As="_fd_sess",hu={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},vu=10,xs={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},eo="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Ds(e,Date.now())}function wu(){try{let e=sessionStorage.getItem(As);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Eu(){try{sessionStorage.setItem(As,JSON.stringify(Me))}catch{}}function bu(){let e=[],n=Date.now()-Jr,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Ds(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>gu&&n.shift()}function yu(e){let t=e-Jr,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Su(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=hu[n.type]??vu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Rs(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function _u(e,t,n){return Rs(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Tu(e,t,n,r){let o=Rs(r),i=bu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:eo||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:Jr,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,Eu()}function Lu(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();yu(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Ds(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Su(),s=_u(r.size,o,i);s&&(ke!==null&&xs[s]<=xs[ke]||(ke=s,Tu(s,r,o,i)))}function to(e){eo=e}function no(e){z=[],ke=null,sn=!0,xe=new Map,eo=e??"",wu(),Dn(Lu),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function ro(){sn=!1,z=[],ke=null,xe=new Map,Dn(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var Cu=8,oo=3e4,io=5,ku=5e3,N=[],te="",ut=!1,Is=f(xu),Os=f(Au);function so(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Is),window.addEventListener("hashchange",Os)}function ao(){window.removeEventListener("popstate",Is),window.removeEventListener("hashchange",Os),N=[],ut=!1,te=""}function lo(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>oo;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<io)&&(ut||Mu(t))}function Mu(e){let t=N.filter(l=>e-l.ts<=oo),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<io||n.length===0||n.some(l=>l.leftAt-l.ts>=ku)||new Set(n.map(l=>l.path)).size<io)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-Cu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:oo,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function xu(){let e=location.pathname+location.search+location.hash;dt(e)}function Au(){let e=location.pathname+location.search+location.hash;dt(e)}var Du=.3,Ns=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Ps=f(Ru),Hs=f(Ou);function co(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Ps,{passive:!0}),window.addEventListener("click",Hs,{capture:!0})}function uo(){window.removeEventListener("scroll",Ps),window.removeEventListener("click",Hs,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Ru(){ft||(ft=!0,requestAnimationFrame(Iu))}function Iu(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Ns&&(P=!1),le==="down"){let s=ce-t,a=n*Du;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Ou(e){if(!P)return;let t=Date.now();if(t-mt>Ns){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Nu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Pu=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Hu=/^(A|BUTTON|LABEL)$/,Fu=3,Fs=9e4,Bu=5,gt=new Map,Bs=[],ht=null,Wu=5,Ws=f(Uu),Us=f(Yu);function Uu(e){ht={x:e.clientX,y:e.clientY}}function fo(e){Bs=e??[],document.addEventListener("mousedown",Ws,{capture:!0,passive:!0}),document.addEventListener("click",Us,{capture:!0,passive:!0})}function po(){document.removeEventListener("mousedown",Ws,{capture:!0}),document.removeEventListener("click",Us,{capture:!0}),ht=null,gt.clear()}function mo(){gt.clear()}function Vu(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 qu(e,t){return e*4+t}function zu(e){if(Nu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Pu.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&&Hu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function $u(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Xu(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>Wu}function Yu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Bs)||$u()||Xu(e)||zu(t))return;let{row:n,col:r}=Vu(e.clientX,e.clientY),o=qu(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Fs);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=Fu){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Bu))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Fs}}),gt.set(o,[])}}var go=3,Ae=12e4,S=new Map,cn=[],vt=null,Vs=f(Qu),ln=f(Ju);function vo(e){cn=e??[],document.addEventListener("invalid",Vs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(ed),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function wo(){document.removeEventListener("invalid",Vs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function Eo(){for(let e of S.values())ne(e);S.clear()}function ho(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function bo(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function ju(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function Ku(e){return f(t=>{$s(e)})}function Gu(e){return f(t=>{$s(e)})}function qs(e,t){let n=Ku(t),r=Gu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function zs(e){if(!un(e)||v(e,cn))return;let t=Date.now();ju(t);let n=p(e),r=S.get(n);if(!r){qs(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=go&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:ho(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=go&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:ho(e)}}),ne(r),S.delete(n)))}function Zu(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function $s(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,bo(n.el)){n.cycles+=1,n.cycles>=go&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:ho(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function Qu(e){let t=e.target;t&&zs(t)}function Ju(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||bo(t)&&qs(t,n)}function ed(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=bo(n);i&&!o?zs(n):!i&&o&&Zu(n)}}var De=null,wt=null,So=[],Xs=0,Et=new Map;function _o(e){So=e?.length?e:["[data-fd-impression]"],Xs=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(nd),{threshold:[0,.5,1]}),Ys(),wt=new MutationObserver(y(td)),wt.observe(document.body,{childList:!0,subtree:!0}))}function To(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function Lo(){Et.clear(),De&&Ys()}function Ys(){for(let e of So)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)yo(t[n])}catch{}}function yo(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function td(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of So)try{r.matches(o)&&yo(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)yo(i[s])}catch{}}}function nd(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Xs),viewport_position:s}})}}}var rd=2,od=3,id=6e4,bt=new Map,js=[],Ks=f(sd);function Co(e){js=e??[],document.addEventListener("input",Ks,{capture:!0,passive:!0})}function ko(){document.removeEventListener("input",Ks,{capture:!0}),bt.clear()}function Mo(){bt.clear()}function sd(e){let t=e.target;if(!t||!ad(t)||v(t,js))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>id){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=od)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=rd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:ld(t)}}),bt.delete(o);return}i.lastValue=r}function ad(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 ld(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Gs=2e3,cd=3e4,$=null,Zs=Gs,Qs=[],dn=new Map,Js=f(ud),ea=f(dd),ta=f(yt);function xo(e,t){Zs=e?.dwellMs??Gs,Qs=t??[],document.addEventListener("mouseover",Js,{passive:!0}),document.addEventListener("mouseout",ea,{passive:!0}),document.addEventListener("click",ta,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("mouseover",Js),document.removeEventListener("mouseout",ea),document.removeEventListener("click",ta,{capture:!0}),yt(),dn.clear()}function Do(){yt(),dn.clear()}function ud(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Qs)||!fd(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<cd)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Zs);$={el:t,selector:n,startTs:o,timer:i}}function dd(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function fd(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var pd=20,md=500,gd=3e3,hd=6e4,fn=0,pn=0,X=null,na=y(vd);function Ro(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",na)}function Io(){document.removeEventListener("mouseleave",na),X&&(clearTimeout(X),X=null)}function Oo(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function vd(e){if(e.clientY>pd)return;let t=Date.now();t-fn<gd||t-pn<hd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),md))}var wd=2500,Ed=4e3,ra=200,bd=500,yd=.1,Sd=.25,Ie=null,Oe=null,Q=null,Re=0;function No(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Po(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:No(r,wd,Ed)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<ra||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:No(r,ra,bd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function oa(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:No(Re,yd,Sd)}})}Re=0}}function Ho(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),oa()}function Fo(){if(oa(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var ia=[],sa=f(_d);function Bo(e){ia=e??[],document.addEventListener("paste",sa,{capture:!0,passive:!0})}function Wo(){document.removeEventListener("paste",sa,{capture:!0})}function _d(e){let t=e.target;if(!t||!Td(t)||v(t,ia))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:Ld(t)}})},100)}function Td(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 Ld(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Cd="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",Uo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function kd(){let e=window;return e[St]&&e[St]!==Uo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=Uo,!0)}function Md(){let e=window;e[St]===Uo&&delete e[St]}var _t=[];function xd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Nn(e.signals?.rageClick,t),stop:Pn},{when:()=>r("deadClick"),start:()=>Hn(t),stop:Fn,reset:Bn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Un(i?{delayMs:i.windowMs}:void 0,t)},stop:Vn,reset:qn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Yn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:jn},{when:()=>r("loopNav"),start:()=>Zn(e.signals?.loopNav),stop:Qn},{when:()=>r("scrollBounce"),start:rr,stop:or,reset:ir},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;ar(i?{pauseMs:i.threshold}:void 0,t)},stop:lr,reset:cr},{when:()=>o&&r("formValidationLoop"),start:()=>vo(t),stop:wo,reset:Eo},{when:()=>r("errorEncounter"),start:fr,stop:pr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>vr(t),stop:wr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>br(t),stop:yr},{when:()=>r("scrollHijack"),start:Tr,stop:Lr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:Cr,stop:kr,reset:Mr},{when:()=>r("advancedHeuristics"),start:Dr,stop:Rr,reset:()=>{rt(),Ir()}},{when:()=>r("helpHunt"),start:()=>Or(t),stop:Nr,reset:Pr},{when:()=>r("closeClick"),start:()=>Hr(t),stop:Fr,reset:Br},{when:()=>r("closeClickReversal"),start:()=>Wr(t),stop:Ur,reset:Vr},{when:()=>r("filterSpiral"),start:()=>zr(t),stop:$r,reset:Xr},{when:()=>r("copyFrustration"),start:Yr,stop:jr,reset:Kr},{when:()=>r("textSelectFrustration"),start:Gr,stop:Zr,reset:Qr},{when:()=>r("deadClickTrapZone"),start:()=>fo(t),stop:po,reset:mo},{when:()=>!0,start:()=>no(n),stop:ro},{when:()=>r("navigationConfusion"),start:so,stop:ao,reset:lo},{when:()=>r("scrollToClickConfusion"),start:co,stop:uo,reset:an},{when:()=>r("elementImpression"),start:()=>_o(e.elementImpressionSelectors),stop:To,reset:Lo},{when:()=>o&&r("inputCorrection"),start:()=>Co(t),stop:ko,reset:Mo},{when:()=>o&&r("pasteBlocked"),start:()=>Bo(t),stop:Wo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;xo(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Ao,reset:Do},{when:()=>r("exitIntent"),start:Ro,stop:Io,reset:Oo},{when:()=>r("performanceVitals"),start:Po,stop:Ho,reset:Fo}]}function Ad(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 la(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Fd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!kd()){Ne=e;return}Ne=e,re=!0,typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(Hd));let t=Zo(e.cookieless??!1),n=Ad(e.endpoint)??Cd,r=On(location.pathname,e.pageRules??[]),o=Bd(e.domMode);ai(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=aa(location.pathname,e.ignorePages??[]);i&&Rn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of xd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=ci(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),to(l);let g=On(l,e.pageRules??[]),w=aa(l,e.ignorePages??[]);Rn(w),In({page:g,url:d}),Jn(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function Dd(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Rd(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Id(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}In({segment:t})}function Od(e){e&&Ne&&!re?la(Ne):e||(Vo(),_n())}function Nd(){Vo(),_n()}function Pd(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function Hd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function Vo(){if(re){for(let e of ue)e();ue=[];for(let e of _t)e.stop();_t=[],li(),mn&&(mn(),mn=null),Md(),re=!1}}function Fd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Bd(e){return e==="metadata"||e==="snapshot"?e:"off"}function aa(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var fa=.1,pa=.01,ma=3e4,ga=50,ha=1e4,Wd=500,Ud=3e4,Vd=6e4,ca=10,qd=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),zd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,$d=/^\$\$?(heatmap|scroll)/,va=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],wn=!1,gn=null,hn=null,Tt=null,H=null,vn=null,wa=fa,Ea=pa,ba=new Set,ya=new Set(va),Sa=ma,$o=ga,_a=ha,R=[],En=0,F=[];function ua(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Xd(e){wn||(wn=!0,wa=ua(e?.baselineSampleRate,fa),Ea=ua(e?.scrollSampleRate,pa),ba=new Set(e?.conversionEvents??[]),ya=new Set(e?.criticalSignals?.length?e.criticalSignals:va),Sa=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:ma,$o=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:ga,_a=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:ha,R=[],En=0,F=[],hn=fe(ef),da()||(gn=setInterval(()=>{da()&&Xo()},Wd),setTimeout(()=>Xo(),Ud)))}function Yd(){wn&&(wn=!1,Xo(),hn&&(hn(),hn=null),Tt&&vn&&Tt.capture.__fd_wrapped&&(Tt.capture=vn),Tt=null,H=null,vn=null,R=[],F=[],En=0)}function Xo(){gn&&(clearInterval(gn),gn=null)}function da(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;vn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return Kd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function jd(e){return qd.has(e)?"critical":ba.has(e)||zd.test(e)?"conversion":$d.test(e)?"scroll":"baseline"}function Kd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=jd(e);if(o==="critical"||o==="conversion")return H(e,zo(t,r),n);if(r<En)return H(e,{...zo(t,r),fd_boosted:!0},n);if(Gd(o==="scroll"?Ea:wa))return H(e,zo(t,r),n);Jd({name:e,properties:t,ts:r})}function Gd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Zd();return t?Qd(t)%1e4/1e4<e:Math.random()<e}var qo="";function Zd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return qo||(qo=Math.random().toString(36).slice(2)),qo}function Qd(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function zo(e,t){return La(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function Jd(e){R.push(e),Ta(e.ts)}function Ta(e){let t=e-Sa;for(;R.length&&R[0].ts<t;)R.shift();R.length>$o&&(R=R.slice(-$o))}function La(e){let t=e-Vd;F=F.filter(n=>n.ts>=t),F.length>ca&&(F=F.slice(-ca))}function ef({name:e,ts:t}){if(F.push({name:e,ts:t}),La(t),!ya.has(e)||(En=t+_a,!H||!R.length))return;Ta(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}export{Vo as destroy,Yd as destroyPostHogTrigger,Id as identify,la as init,Xd as initPostHogTrigger,Pd as onSignal,Nd as optOut,Od as setConsent,Dd as signal,Rd as track};
1
+ function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Sn="_fd_s";var Aa=/^[0-9a-f]{32}$/;function Qo(e){if(e)return Zo();let t=Da(Sn);if(t&&Aa.test(t))return t;let n=Zo();return Jo(Sn,n,30),n}function _n(){Jo(Sn,"",-1)}function Zo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Da(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Jo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var Ra=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!Ra.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,Ia=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Oa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Oa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!Ia.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ti(e,t){if(t==="off")return null;if(t==="metadata")return Na(e);let n=Pa(e);return n?{mode:"snapshot",...n}:null}function Na(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:ei(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:ei(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Ha(e)}}}function Pa(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Ba(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Fa(t),animations:i,siblings:o}}catch{return null}}function ei(e,t){return e&&t.includes(e)?e:null}function Ha(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Fa(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Ba(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var oi=7e3,Wa=500,Ua=1e4,ii=50,Be=100,Va=3,We=6e4,xt="application/json",qa="application/json; encoding=gzip",j=[],B=null,si="",xn=oi,ai=ii,_=null,At={domMode:"off",compression:"auto"},Tn=!1,Ln=null,An=!1,li=!0;function Dn(e){li=e}var ni=new WeakMap;function Rn(e){Ln=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function za(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function $a(e){if(!Ln||e.t!=="sig")return;let t=Mn(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{Ln(t.slice(0,128),e.ts)}catch{}}function In(e){An=e}var Xa=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Ya=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),ja=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function Ka(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>ja.has(n))}var Ga=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Cn=f(Qa),kn=y(()=>J());function ci(e,t,n,r,o){si=e,_=Object.assign(Object.create(null),t),At={domMode:ll(o?.domMode),compression:cl(o?.compression)},xn=Math.max(Wa,Math.min(n??oi,Ua)),ai=Math.max(1,Math.min(r??ii,Be)),document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),document.addEventListener("visibilitychange",Cn),window.addEventListener("pagehide",kn)}function u(e){An||j.length>=Be||(za(e),$a(e),li&&(j.push(e),j.length>=ai?J():B||(B=setTimeout(J,xn))))}function J(){Za()}async function Za(){if(Tn||!j.length||!_)return;Tn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=ol(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)Ja({...t,events:o.events}).then(i=>{i||ri(o.source)}).catch(()=>ri(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Tn=!1}}function ri(e){let t=e.filter(r=>{let o=ni.get(r)??0;return o>=Va?!1:(ni.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,xn))}function On(e){if(_)for(let t of Object.keys(e))Xa.has(t)&&(_[t]=e[t])}function ui(){J(),An=!1,document.removeEventListener("visibilitychange",Cn),window.removeEventListener("pagehide",kn),B&&(clearTimeout(B),B=null)}function Qa(){document.visibilityState==="hidden"&&J()}async function Ja(e){let t=JSON.stringify(e),n=await el(t,At.compression);return n?rl(n):!0}async function el(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await tl(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:qa}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function tl(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=nl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function nl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function rl(e,t=si){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function ol(e,t,n){let r=e.d??{},o=il(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=Mn(r.el,r.element,r.target);if(o==="signal"){i.signal_type=Mn(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?al(s,n):null;c&&(i.dom=c)}let a=sl(r);return Object.keys(a).length&&(i.metadata=a),i}function il(e){return e==="pv"?"pageview":e==="sig"?"signal":Ya.has(e)?e:"custom_signal"}function sl(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!Ka(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return Ga.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function al(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ti(n,t):null}catch{return null}}function Mn(...e){for(let t of e)if(typeof t=="string"&&t)return t}function ll(e){return e==="metadata"||e==="snapshot"?e:"off"}function cl(e){return e==="off"?"off":"auto"}function di(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function Nn(e,t){for(let n of t){let r=dl(n.pattern);if(r&&r.test(e))return n.label}return fl(e)}var ul=/^[a-zA-Z0-9/:._*\-]+$/;function dl(e){if(e.length>200||!ul.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function fl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id")}var pl=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],W=[],fi=3,pi=2e3,mi=24,It=mi,gi=[],pe=[],hi=0,Ot=new Map,Nt=new Map,ml=1e4,Pt=!1,vi=f(gl);function Pn(e,t){Pt||(Pt=!0,fi=e?.threshold??3,pi=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:mi,gi=[...pl,...t??[]],hi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",vi,{capture:!0,passive:!0}))}function Hn(){Pt&&(Pt=!1,document.removeEventListener("click",vi,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function gl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,gi)||El(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>pi;)W.shift();W.push({t:n,x:r,y:o});let i=hl();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=wl(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=vl(n),jo=Ot.get(b)??0,bn=jo+1,Ko=Nt.get(b)??0,Ma=Ko>0&&n-Ko<ml;Ot.set(b,bn),Nt.set(b,n);let Go=jo>=1,xa=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,yn)=>de+yn.x,0)/s.length,Ct=s.reduce((de,yn)=>de+yn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Go,hot_repeat:Ma,...xa??{}}}),Go&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:bn,burst_count:bn,burst_seq:Y}}),W=W.slice(-(i-1))}function hl(){return pe.length>=3?2:fi}function vl(e){let t=(e-hi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function wl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function El(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var bl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,yl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Sl=/^(A|BUTTON|LABEL)$/,_l=20,wi=[],me=null,Tl=5,Ht=new Map,Ei=f(Ll),bi=f(Ml);function Ll(e){me={x:e.clientX,y:e.clientY}}function Fn(e){wi=e??[],document.addEventListener("mousedown",Ei,{capture:!0,passive:!0}),document.addEventListener("click",bi,{capture:!0,passive:!0})}function Bn(){document.removeEventListener("mousedown",Ei,{capture:!0}),document.removeEventListener("click",bi,{capture:!0}),me=null,Ht.clear()}function Wn(){Ht.clear()}function Cl(e){try{return window.getComputedStyle(e).cursor.slice(0,_l)}catch{return""}}function kl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ml(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,wi)||Rl())return;let n=Il(e);if(me=null,n||xl(t))return;let r=Al(t,e.clientX,e.clientY),o=r?yi(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Cl(t),l=kl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function xl(e){if(bl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&yl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Sl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Al(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Dl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function yi(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Dl(e,t,n){return yi(e,t,n).dist}function Rl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Il(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Tl}var T=null,Un=3e3,Si=[],Ft="click",Bt=0,Ol=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Nl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,_i=f(Fl),Ti=f(Pl),Li=f(Hl);function Vn(e,t){Un=e?.delayMs??3e3,Si=t??[],document.addEventListener("click",_i,{capture:!0,passive:!0}),document.addEventListener("keydown",Ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",Li,{capture:!0,passive:!0})}function qn(){document.removeEventListener("click",_i,{capture:!0}),document.removeEventListener("keydown",Ti,{capture:!0}),document.removeEventListener("touchstart",Li,{capture:!0}),ge()}function zn(){ge()}function Pl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Hl(){Ft="touch",Bt=Date.now()}function Fl(e){let t=e.target;if(!t||v(t,Si))return;let n=t.getAttribute("role");if(!Ol.test(t.tagName)&&!(n&&Nl.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Un&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Un+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Bl=100,Wl=5,Ci=800,ki=2e3,Ul=3,Xn=0,Vl=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,$n=0,oe=[],Yn=0,he=null,Mi=f(ql);function jn(e){Ci=e?.velocityThreshold??800,ki=e?.windowMs??2e3,document.addEventListener("mousemove",Mi,{passive:!0})}function Kn(){document.removeEventListener("mousemove",Mi),he&&clearTimeout(he),Gn()}function ql(e){let t=Date.now();t-Xn<Vl||(Xn=t,he&&clearTimeout(he),he=setTimeout(()=>Gn(),150),zl(e.clientX,e.clientY,t))}function zl(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,$n=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=Bl&&(oe=oe.slice(-50)),oe.push(a),Yn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Wl&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-$n>ki){if(Vt>=Ul){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Ci&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(Yn)}})}Gn(),$n=n}}function Gn(){Vt=0,oe=[],Yn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,Xn=0,he=null}var xi=100,Ai=5,$l=3,L=[],M=[],Zn=3e4;function Qn(e){Zn=e?.windowMs??3e4}function Jn(){L=[],M=[]}function er(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Zn;)L.shift();for(;M.length&&t-M[0].ts>Zn;)M.shift();if(L.length>=xi&&(L=L.slice(-50)),M.length>=xi&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=$l&&a.length>c.size){let d=a.slice(-Ai).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ai).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var Xl=100,Di=1e4,nr=.5,C=[],qt=0,rr=0,ze=!1,tr=0,Ri=f(Yl);function or(e){Di=e?.windowMs??1e4,nr=e?.depthThreshold??.5,window.addEventListener("scroll",Ri,{passive:!0})}function ir(){window.removeEventListener("scroll",Ri),C=[],ze=!1}function sr(){C=[],qt=0,rr=0,ze=!1}function Yl(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,jl()}))}function jl(){let e=Date.now(),t=window.scrollY;if(tr=document.documentElement.scrollHeight-window.innerHeight,tr<=0)return;let n=t/tr,r=t>qt?"down":"up";if(e-rr<100){qt=t;return}for(;C.length&&e-C[0].ts>Di;)C.shift();C.length>=Xl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,rr=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=nr&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=nr){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var Kl=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,ar=0,Ii=5e3,Oi=[],Gl=50,Ni=f(Zl),Pi=f(Ql),Hi=f(Jl),Fi=y(dr),$e=null;function lr(e,t){Ii=e?.pauseMs??5e3,Oi=t??[],document.addEventListener("focusin",Ni,{capture:!0,passive:!0}),document.addEventListener("focusout",Pi,{capture:!0,passive:!0}),document.addEventListener("submit",Hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",Fi),$e=y(()=>{document.visibilityState==="hidden"&&dr()}),document.addEventListener("visibilitychange",$e)}function cr(){document.removeEventListener("focusin",Ni,{capture:!0}),document.removeEventListener("focusout",Pi,{capture:!0}),document.removeEventListener("submit",Hi,{capture:!0}),window.removeEventListener("pagehide",Fi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function ur(){dr(),Xe.clear(),Ye.clear(),K.clear(),ie=null,ar=0}function Zl(e){let t=e.target;if(!t||!Bi(t)||v(t,Oi)||ec(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,ar=r.querySelectorAll("input, select, textarea").length)}function Ql(e){let t=e.target;if(!t||!Bi(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<Gl)&&n!==void 0){let a=o-n;if(a>=Ii){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);tc(t)&&K.add(s)}function Jl(){K.clear(),ie=null}function dr(){if(K.size>0&&ie){let e=ar||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Bi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function ec(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Kl)try{if(e.matches(t))return!0}catch{return!1}return!1}function tc(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Wi=/flusterduck\.com|\/v1\/ingest/,Vi=f(oc),qi=f(ic);function pr(){window.addEventListener("error",Vi),window.addEventListener("unhandledrejection",qi),sc()}function mr(){window.removeEventListener("error",Vi),window.removeEventListener("unhandledrejection",qi),ac()}var fr=/fetch|network|cors|timeout/i;function nc(e){return fr.test(e)?"network":"script"}function rc(e){if(e instanceof TypeError&&fr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return fr.test(t)?"network":"unhandled_promise"}function oc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:gr(t,200),ep:"",status:0,error_category:nc(t),url:location.pathname}})}function ic(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:gr(t,200),ep:"",status:0,error_category:rc(e.reason),url:location.pathname}})}function sc(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Ui(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Wi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:gr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Ui(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function ac(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function Ui(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function gr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var zi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],lc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,hr=0,vr=null,$i=[],Xi=f(cc),Yi=f(uc),ji=f(pc),Ki=f(hc),Gi=f(mc);function wr(e){$i=e??[],document.addEventListener("touchstart",Xi,{passive:!0}),document.addEventListener("touchend",Yi,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",ji,{passive:!0}),window.addEventListener("orientationchange",Ki,{passive:!0})),window.visualViewport?.addEventListener("resize",Gi)}function Er(){document.removeEventListener("touchstart",Xi),document.removeEventListener("touchend",Yi),document.removeEventListener("gesturechange",ji),window.removeEventListener("orientationchange",Ki),window.visualViewport?.removeEventListener("resize",Gi),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,hr=0,vr=null}function Zi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function cc(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Zi(e.touches),ee=null)}function uc(e){if(Ee>0){let s=e.touches.length>=2?Zi(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&dc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&fc(i,n,r),ee=null}function dc(e,t,n){if(v(e,$i))return;let r=vc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function fc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||zi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!zi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function pc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!lc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function mc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function gc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function hc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-hr>3e4&&(we=0,hr=e),t!==vr&&(we++,vr=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:gc()}}),we=0)}function vc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],br=[],wc=10,Ec=5e3,Qi=5,Ji=3e3,bc=15,yc=5e3,es=f(Sc);function yr(e){br=e??[],document.addEventListener("keydown",es,{capture:!0,passive:!0})}function Sr(){document.removeEventListener("keydown",es,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",br=[]}function Sc(e){let t=Date.now(),n=e.target;n&&v(n,br)||(e.key==="Tab"?Tc(t,n,e.shiftKey):e.key==="Escape"?Lc(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Cc(t,e.target))}function _c(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Tc(e,t,n){for(;x.length&&e-x[0].ts>Ec;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=wc){let i=x.map(a=>a.el).filter(Boolean),s=_c(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=Ji?(A++,V=i,A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function Lc(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>Ji){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=Qi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Cc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>yc;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=bc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,_r=0,Xt=!1,Yt=0,Tr=0,kc=1e4,Mc=2,xc=4,Ac=3e3,Qe=null,jt=0,Dc=2e3,ts=f(Oc),ns=f(Rc),rs=f(Ic);function Lr(){window.addEventListener("wheel",ns,{passive:!0}),window.addEventListener("touchmove",rs,{passive:!0}),window.addEventListener("scroll",ts,{passive:!0})}function Cr(){window.removeEventListener("wheel",ns),window.removeEventListener("touchmove",rs),window.removeEventListener("scroll",ts),Kt()}function Kt(){Se=0,zt=0,$t=null,_r=0,Xt=!1,Yt=0,Tr=0,Qe=null,jt=0}function Rc(){Qe="wheel",jt=Date.now()}function Ic(){Qe="touch",jt=Date.now()}function Oc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,Nc()}))}function Nc(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-_r>Ac&&(Se=0,_r=e),Se++,Se>=xc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=Dc?Qe:"wheel";e-Tr>kc&&(Yt=0,Tr=e),Yt++;let a=Yt>=Mc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,is=f(Pc),et=null,tt=null;function kr(){window.addEventListener("scroll",is,{passive:!0}),tt=y(os),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&os()}),document.addEventListener("visibilitychange",et)}function Mr(){window.removeEventListener("scroll",is),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function xr(){se=0,_e=0,Je=!1}function Pc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function os(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var ss=1500,as=15e3,Hc=5e3,Fc=.15,Ar="",Te=0,Gt=0,nt=0,Le=0,Dr=0,Zt=null,Qt=0,Jt=!1,en=f(Wc),ls=f(Uc),Ce=f(Bc);function Rr(){Jt||(Jt=!0,Dr=cs(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",ls,{passive:!0}))}function Ir(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",ls),us(),Ar="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){us(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:as,cycle:e}})},as)}function Or(){Qt=0}function Bc(){rt()}function Wc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Ar||r-Gt>ss)&&(Ar=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:ss}}),Te=0,Gt=r)}function Uc(){let e=Date.now(),t=cs(),n=Dr||t,r=Math.abs(t-n)/Math.max(n,1);Dr=t,!(r<Fc)&&((!nt||e-nt>Hc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function cs(){return Math.max(1,window.innerWidth*window.innerHeight)}function us(){Zt&&(clearTimeout(Zt),Zt=null)}var ds=6e4,Vc=3,qc=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],zc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],fs=[],ps=f($c);function Nr(e){fs=e??[],document.addEventListener("click",ps,{capture:!0,passive:!0})}function Pr(){document.removeEventListener("click",ps,{capture:!0}),q=[]}function Hr(){q=[]}function $c(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,fs)||!Xc(t))return;let n=Date.now();for(;q.length&&n-q[0].t>ds;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<Vc)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ds}}),q=[]}function Xc(e){let t=e;for(let n=0;n<3&&t;n++){if(Yc(t)||jc(t))return!0;t=t.parentElement}return!1}function Yc(e){for(let t of qc)try{if(e.matches(t))return!0}catch{}return!1}function jc(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return zc.test(r)}var ms=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,gs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,hs=[],vs=f(Kc);function Fr(e){hs=e??[],document.addEventListener("click",vs,{capture:!0,passive:!0})}function Br(){document.removeEventListener("click",vs,{capture:!0}),tn=[],nn.clear()}function Wr(){tn=[],nn.clear()}function Kc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hs)||!Gc(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:Qc(t),...c??{}}})}function Gc(e){let t=e;for(let n=0;n<4&&t;n++){if(Zc(t))return!0;t=t.parentElement}return!1}function Zc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&gs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ms.test(o)||ms.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&gs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function Qc(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var Jc=1500,O=null,ws=[],Es=f(eu),bs=f(tu),ys=f(nu);function Ur(e){ws=e??[],document.addEventListener("click",Es,{capture:!0,passive:!0}),document.addEventListener("keydown",bs,{capture:!0,passive:!0}),window.addEventListener("popstate",ys)}function Vr(){document.removeEventListener("click",Es,{capture:!0}),document.removeEventListener("keydown",bs,{capture:!0}),window.removeEventListener("popstate",ys),O=null}function qr(){O=null}function eu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,ws)){if(ru(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function tu(e){e.key==="Escape"&&Ss("escape")}function nu(){Ss("back_nav")}function Ss(e){if(!O)return;let t=Date.now()-O.t;if(t>Jc){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function ru(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var _s=1e4,ou=3,iu=/^(checkbox|radio)$/,Ts=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,zr=[],Ls=f(su),Cs=f(au);function $r(e){zr=e??[],document.addEventListener("change",Ls,{capture:!0,passive:!0}),document.addEventListener("click",Cs,{capture:!0,passive:!0})}function Xr(){document.removeEventListener("change",Ls,{capture:!0}),document.removeEventListener("click",Cs,{capture:!0}),ot.clear()}function Yr(){ot.clear()}function su(e){let t=e.target;t&&(v(t,zr)||lu(t)&&ks(t))}function au(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,zr))return;let n=t.getAttribute("role")??"";Ts.test(n)&&t.tagName!=="INPUT"&&ks(t)}function ks(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>_s;)r.shift();if(r.push({t:n}),r.length<ou)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:_s}}),ot.delete(t)}function lu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?iu.test(e.type??""):Ts.test(e.getAttribute("role")??"")}var Ms=15e3,cu=3,G=[],xs=f(uu);function jr(){document.addEventListener("copy",xs,{capture:!0,passive:!0})}function Kr(){document.removeEventListener("copy",xs,{capture:!0}),G=[]}function Gr(){G=[]}function uu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>Ms;)G.shift();G.push({t:r}),!(G.length<cu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:Ms}}),G=[])}var As=15e3,du=4,fu=5,pu=500,mu=2e3,D=[],rn=0,it=null,ae=null;function Zr(){it=y(hu),ae=y(gu),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function Qr(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function Jr(){D=[],rn=0}function gu(){rn=Date.now(),D=[]}function hu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<fu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<mu)return;for(;D.length&&r-D[0].t>As;)D.shift();let o=D[D.length-1];o&&r-o.t<pu||(D.push({t:r}),!(D.length<du)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:As}}),D=[]))}var eo=6e4,vu=20,Rs="_fd_sess",wu={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},Eu=10,Ds={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},to="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Is(e,Date.now())}function bu(){try{let e=sessionStorage.getItem(Rs);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function yu(){try{sessionStorage.setItem(Rs,JSON.stringify(Me))}catch{}}function Su(){let e=[],n=Date.now()-eo,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Is(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>vu&&n.shift()}function _u(e){let t=e-eo,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Tu(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=wu[n.type]??Eu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Os(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Lu(e,t,n){return Os(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Cu(e,t,n,r){let o=Os(r),i=Su();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:to||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:eo,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,yu()}function ku(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();_u(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Is(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Tu(),s=Lu(r.size,o,i);s&&(ke!==null&&Ds[s]<=Ds[ke]||(ke=s,Cu(s,r,o,i)))}function no(e){to=e}function ro(e){z=[],ke=null,sn=!0,xe=new Map,to=e??"",bu(),Rn(ku),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function oo(){sn=!1,z=[],ke=null,xe=new Map,Rn(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var Mu=8,io=3e4,so=5,xu=5e3,N=[],te="",ut=!1,Ns=f(Du),Ps=f(Ru);function ao(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Ns),window.addEventListener("hashchange",Ps)}function lo(){window.removeEventListener("popstate",Ns),window.removeEventListener("hashchange",Ps),N=[],ut=!1,te=""}function co(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>io;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<so)&&(ut||Au(t))}function Au(e){let t=N.filter(l=>e-l.ts<=io),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<so||n.length===0||n.some(l=>l.leftAt-l.ts>=xu)||new Set(n.map(l=>l.path)).size<so)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-Mu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:io,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Du(){let e=location.pathname+location.search+location.hash;dt(e)}function Ru(){let e=location.pathname+location.search+location.hash;dt(e)}var Iu=.3,Hs=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Fs=f(Ou),Bs=f(Pu);function uo(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Fs,{passive:!0}),window.addEventListener("click",Bs,{capture:!0})}function fo(){window.removeEventListener("scroll",Fs),window.removeEventListener("click",Bs,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Ou(){ft||(ft=!0,requestAnimationFrame(Nu))}function Nu(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Hs&&(P=!1),le==="down"){let s=ce-t,a=n*Iu;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Pu(e){if(!P)return;let t=Date.now();if(t-mt>Hs){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Hu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Fu=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Bu=/^(A|BUTTON|LABEL)$/,Wu=3,Ws=9e4,Uu=5,gt=new Map,Us=[],ht=null,Vu=5,Vs=f(qu),qs=f(Ku);function qu(e){ht={x:e.clientX,y:e.clientY}}function po(e){Us=e??[],document.addEventListener("mousedown",Vs,{capture:!0,passive:!0}),document.addEventListener("click",qs,{capture:!0,passive:!0})}function mo(){document.removeEventListener("mousedown",Vs,{capture:!0}),document.removeEventListener("click",qs,{capture:!0}),ht=null,gt.clear()}function go(){gt.clear()}function zu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function $u(e,t){return e*4+t}function Xu(e){if(Hu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Fu.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Bu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Yu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function ju(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>Vu}function Ku(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Us)||Yu()||ju(e)||Xu(t))return;let{row:n,col:r}=zu(e.clientX,e.clientY),o=$u(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Ws);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=Wu){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Uu))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Ws}}),gt.set(o,[])}}var ho=3,Ae=12e4,S=new Map,cn=[],vt=null,zs=f(ed),ln=f(td);function wo(e){cn=e??[],document.addEventListener("invalid",zs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(nd),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function Eo(){document.removeEventListener("invalid",zs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function bo(){for(let e of S.values())ne(e);S.clear()}function vo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function yo(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function Gu(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function Zu(e){return f(t=>{Ys(e)})}function Qu(e){return f(t=>{Ys(e)})}function $s(e,t){let n=Zu(t),r=Qu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function Xs(e){if(!un(e)||v(e,cn))return;let t=Date.now();Gu(t);let n=p(e),r=S.get(n);if(!r){$s(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:vo(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:vo(e)}}),ne(r),S.delete(n)))}function Ju(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function Ys(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,yo(n.el)){n.cycles+=1,n.cycles>=ho&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:vo(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ed(e){let t=e.target;t&&Xs(t)}function td(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||yo(t)&&$s(t,n)}function nd(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=yo(n);i&&!o?Xs(n):!i&&o&&Ju(n)}}var De=null,wt=null,_o=[],js=0,Et=new Map;function To(e){_o=e?.length?e:["[data-fd-impression]"],js=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(od),{threshold:[0,.5,1]}),Ks(),wt=new MutationObserver(y(rd)),wt.observe(document.body,{childList:!0,subtree:!0}))}function Lo(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function Co(){Et.clear(),De&&Ks()}function Ks(){for(let e of _o)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)So(t[n])}catch{}}function So(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function rd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of _o)try{r.matches(o)&&So(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)So(i[s])}catch{}}}function od(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-js),viewport_position:s}})}}}var id=2,sd=3,ad=6e4,bt=new Map,Gs=[],Zs=f(ld);function ko(e){Gs=e??[],document.addEventListener("input",Zs,{capture:!0,passive:!0})}function Mo(){document.removeEventListener("input",Zs,{capture:!0}),bt.clear()}function xo(){bt.clear()}function ld(e){let t=e.target;if(!t||!cd(t)||v(t,Gs))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>ad){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=sd)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=id)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:ud(t)}}),bt.delete(o);return}i.lastValue=r}function cd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function ud(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Qs=2e3,dd=3e4,$=null,Js=Qs,ea=[],dn=new Map,ta=f(fd),na=f(pd),ra=f(yt);function Ao(e,t){Js=e?.dwellMs??Qs,ea=t??[],document.addEventListener("mouseover",ta,{passive:!0}),document.addEventListener("mouseout",na,{passive:!0}),document.addEventListener("click",ra,{capture:!0,passive:!0})}function Do(){document.removeEventListener("mouseover",ta),document.removeEventListener("mouseout",na),document.removeEventListener("click",ra,{capture:!0}),yt(),dn.clear()}function Ro(){yt(),dn.clear()}function fd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ea)||!md(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<dd)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Js);$={el:t,selector:n,startTs:o,timer:i}}function pd(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function md(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var gd=20,hd=500,vd=3e3,wd=6e4,fn=0,pn=0,X=null,oa=y(Ed);function Io(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",oa)}function Oo(){document.removeEventListener("mouseleave",oa),X&&(clearTimeout(X),X=null)}function No(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function Ed(e){if(e.clientY>gd)return;let t=Date.now();t-fn<vd||t-pn<wd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),hd))}var bd=2500,yd=4e3,ia=200,Sd=500,_d=.1,Td=.25,Ie=null,Oe=null,Q=null,Re=0;function Po(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Ho(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Po(r,bd,yd)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<ia||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Po(r,ia,Sd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function sa(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Po(Re,_d,Td)}})}Re=0}}function Fo(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),sa()}function Bo(){if(sa(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var aa=[],la=f(Ld);function Wo(e){aa=e??[],document.addEventListener("paste",la,{capture:!0,passive:!0})}function Uo(){document.removeEventListener("paste",la,{capture:!0})}function Ld(e){let t=e.target;if(!t||!Cd(t)||v(t,aa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:kd(t)}})},100)}function Cd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function kd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Md="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",Vo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function xd(){let e=window;return e[St]&&e[St]!==Vo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=Vo,!0)}function Ad(){let e=window;e[St]===Vo&&delete e[St]}var _t=[];function Dd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Pn(e.signals?.rageClick,t),stop:Hn},{when:()=>r("deadClick"),start:()=>Fn(t),stop:Bn,reset:Wn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Vn(i?{delayMs:i.windowMs}:void 0,t)},stop:qn,reset:zn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;jn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Kn},{when:()=>r("loopNav"),start:()=>Qn(e.signals?.loopNav),stop:Jn},{when:()=>r("scrollBounce"),start:or,stop:ir,reset:sr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;lr(i?{pauseMs:i.threshold}:void 0,t)},stop:cr,reset:ur},{when:()=>o&&r("formValidationLoop"),start:()=>wo(t),stop:Eo,reset:bo},{when:()=>r("errorEncounter"),start:pr,stop:mr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>wr(t),stop:Er},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>yr(t),stop:Sr},{when:()=>r("scrollHijack"),start:Lr,stop:Cr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:kr,stop:Mr,reset:xr},{when:()=>r("advancedHeuristics"),start:Rr,stop:Ir,reset:()=>{rt(),Or()}},{when:()=>r("helpHunt"),start:()=>Nr(t),stop:Pr,reset:Hr},{when:()=>r("closeClick"),start:()=>Fr(t),stop:Br,reset:Wr},{when:()=>r("closeClickReversal"),start:()=>Ur(t),stop:Vr,reset:qr},{when:()=>r("filterSpiral"),start:()=>$r(t),stop:Xr,reset:Yr},{when:()=>r("copyFrustration"),start:jr,stop:Kr,reset:Gr},{when:()=>r("textSelectFrustration"),start:Zr,stop:Qr,reset:Jr},{when:()=>r("deadClickTrapZone"),start:()=>po(t),stop:mo,reset:go},{when:()=>!0,start:()=>ro(n),stop:oo},{when:()=>r("navigationConfusion"),start:ao,stop:lo,reset:co},{when:()=>r("scrollToClickConfusion"),start:uo,stop:fo,reset:an},{when:()=>r("elementImpression"),start:()=>To(e.elementImpressionSelectors),stop:Lo,reset:Co},{when:()=>o&&r("inputCorrection"),start:()=>ko(t),stop:Mo,reset:xo},{when:()=>o&&r("pasteBlocked"),start:()=>Wo(t),stop:Uo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;Ao(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Do,reset:Ro},{when:()=>r("exitIntent"),start:Io,stop:Oo,reset:No},{when:()=>r("performanceVitals"),start:Ho,stop:Fo,reset:Bo}]}function Rd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function ua(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Wd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!xd()){Ne=e;return}Ne=e,re=!0,Dn(e.transport!=="none"),typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(Bd));let t=Qo(e.cookieless??!1),n=Rd(e.endpoint)??Md,r=Nn(location.pathname,e.pageRules??[]),o=Ud(e.domMode);ci(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=ca(location.pathname,e.ignorePages??[]);i&&In(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of Dd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=di(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),no(l);let g=Nn(l,e.pageRules??[]),w=ca(l,e.ignorePages??[]);In(w),On({page:g,url:d}),er(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function Id(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Od(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Nd(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let o=e[r];typeof o!="string"&&typeof o!="number"&&typeof o!="boolean"||(t[r.slice(0,64)]=String(o).slice(0,256),n++)}On({segment:t})}function Pd(e){e&&Ne&&!re?ua(Ne):e||(qo(),_n())}function Hd(){qo(),_n()}function Fd(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function Bd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function qo(){if(re){for(let e of ue)e();ue=[],Dn(!0);for(let e of _t)e.stop();_t=[],ui(),mn&&(mn(),mn=null),Ad(),re=!1}}function Wd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Ud(e){return e==="metadata"||e==="snapshot"?e:"off"}function ca(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var ma=.1,ga=.01,ha=3e4,va=50,wa=1e4,Vd=500,qd=3e4,zd=6e4,da=10,$d=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Xd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,Yd=/^\$\$?(heatmap|scroll)/,Ea=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],wn=!1,gn=null,hn=null,Tt=null,H=null,vn=null,ba=ma,ya=ga,Sa=new Set,_a=new Set(Ea),Ta=ha,Xo=va,La=wa,R=[],En=0,F=[];function fa(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function jd(e){wn||(wn=!0,ba=fa(e?.baselineSampleRate,ma),ya=fa(e?.scrollSampleRate,ga),Sa=new Set(e?.conversionEvents??[]),_a=new Set(e?.criticalSignals?.length?e.criticalSignals:Ea),Ta=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:ha,Xo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:va,La=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:wa,R=[],En=0,F=[],hn=fe(nf),pa()||(gn=setInterval(()=>{pa()&&Yo()},Vd),setTimeout(()=>Yo(),qd)))}function Kd(){wn&&(wn=!1,Yo(),hn&&(hn(),hn=null),Tt&&vn&&Tt.capture.__fd_wrapped&&(Tt.capture=vn),Tt=null,H=null,vn=null,R=[],F=[],En=0)}function Yo(){gn&&(clearInterval(gn),gn=null)}function pa(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;vn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return Zd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function Gd(e){return $d.has(e)?"critical":Sa.has(e)||Xd.test(e)?"conversion":Yd.test(e)?"scroll":"baseline"}function Zd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Gd(e);if(o==="critical"||o==="conversion")return H(e,$o(t,r),n);if(r<En)return H(e,{...$o(t,r),fd_boosted:!0},n);if(Qd(o==="scroll"?ya:ba))return H(e,$o(t,r),n);tf({name:e,properties:t,ts:r})}function Qd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Jd();return t?ef(t)%1e4/1e4<e:Math.random()<e}var zo="";function Jd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return zo||(zo=Math.random().toString(36).slice(2)),zo}function ef(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function $o(e,t){return ka(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function tf(e){R.push(e),Ca(e.ts)}function Ca(e){let t=e-Ta;for(;R.length&&R[0].ts<t;)R.shift();R.length>Xo&&(R=R.slice(-Xo))}function ka(e){let t=e-zd;F=F.filter(n=>n.ts>=t),F.length>da&&(F=F.slice(-da))}function nf({name:e,ts:t}){if(F.push({name:e,ts:t}),ka(t),!_a.has(e)||(En=t+La,!H||!R.length))return;Ca(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}export{qo as destroy,Kd as destroyPostHogTrigger,Nd as identify,ua as init,jd as initPostHogTrigger,Fd as onSignal,Hd as optOut,Pd as setConsent,Id as signal,Od as track};
package/dist/queue.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { SDKEvent, EmittedSignal, QueueMeta, QueueOptions } from './types';
2
+ export declare function setQueueSend(enabled: boolean): void;
2
3
  export declare function setCorrelatorHook(fn: ((signalType: string, ts?: number) => void) | null): void;
3
4
  type SignalListener = (signal: EmittedSignal) => void;
4
5
  export declare function subscribeSignals(fn: SignalListener): () => void;
package/dist/types.d.ts CHANGED
@@ -25,6 +25,12 @@ export interface Config {
25
25
  onSignal?: (signal: EmittedSignal) => void;
26
26
  /** Also dispatch a `flusterduck:signal` CustomEvent on window for each detected signal. Off by default. */
27
27
  emitSignalEvents?: boolean;
28
+ /**
29
+ * Where detected events go. `'auto'` (default) sends to the ingest endpoint.
30
+ * `'none'` runs detectors and fires onSignal but never queues or transmits
31
+ * anything, for local demos, tests, and dev. Pair with `onSignal`.
32
+ */
33
+ transport?: 'auto' | 'none';
28
34
  }
29
35
  /**
30
36
  * A friction signal at the moment it fires, surfaced to `onSignal` and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flusterduck",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Lightweight UX confusion monitoring SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",