flusterduck 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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(){c(n,"",-1)}function i(){const t=new Uint8Array(16);crypto.getRandomValues(t);let e="";for(const n of t)e+=n.toString(16).padStart(2,"0");return e}function c(t,e,n){const o=new Date;o.setTime(o.getTime()+864e5*n);const r="https:"===location.protocol?";Secure":"";document.cookie=`${t}=${encodeURIComponent(e)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var s=/^[:\d]|--|^(ember|react|ng-|__)/;function a(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!s.test(t.id)&&t.id.length<64)return"#"+u(t.id);const n=[];let o=t,r=0;for(;o&&o!==document.body&&r<5;){let t=o.tagName.toLowerCase();const e=o.getAttribute("name"),i=o.getAttribute("role"),c=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!c||"input"!==t&&"button"!==t||(t+=`[type="${u(c)}"]`);const s=o.parentElement;if(s){const e=s.children;let n=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];i&&i.tagName===o.tagName&&(n++,i===o&&(r=n))}n>1&&(t+=`:nth-of-type(${r})`)}n.unshift(t);const a=n.join(" > ");try{if(1===document.querySelectorAll(a).length)return a}catch(t){}o=s,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}var l=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,d=/^(INPUT|TEXTAREA|SELECT)$/;function f(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!d.test(t.tagName)){const e=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,60);if(e&&!l.test(e))return e}const n=t.getAttribute("placeholder");if(n)return n.trim().slice(0,60);const o=t.getAttribute("title");if(o)return o.trim().slice(0,60);const r=t.getAttribute("alt");return r?r.trim().slice(0,60):""}catch{return""}}function p(t,e){if(t.hasAttribute("data-fd-ignore"))return!0;if(t.closest("[data-fd-ignore]"))return!0;for(const n of e)try{if(t.matches(n)||t.closest(n))return!0}catch(t){}return!1}function h(t,e){return t&&e.includes(t)?t:null}function m(t){const e=t.tagName.toLowerCase();if("input"!==e&&"button"!==e)return null;const n=t.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function w(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function _(t){if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!/^(button|link|tab|menuitem|checkbox|radio)$/.test(e))}var v=6e4,g="application/json",b=[],y=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1;function O(t){E=t}function $(t){S=t}var U=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),N=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),R=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),C=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,L=e(()=>{"hidden"===document.visibilityState&&B()}),j=t(()=>B());function I(t){S||b.length>=100||(b.push(t),b.length>=T?B():y||(y=setTimeout(B,k)))}function B(){(async()=>{if(A)return;if(!b.length||!D)return;A=!0,y&&(clearTimeout(y),y=null);const t=b;b=[];const e={v:1,sid:D.sid,key:D.key,url:D.url,page:D.page,ts:Date.now(),ua:D.ua,vw:D.vw,vh:D.vh,environment:D.environment,...D.segment?{segment:D.segment}:{},dom_mode:x.domMode},n=t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":N.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},c=F(o.el,o.element,o.target);if("signal"===r){i.signal_type=F(o.s,o.signal_type,o.name)?.slice(0,128),c&&(i.element=c.slice(0,2048));const t=c?((t,e)=>{if("off"===e)return null;try{const n=document.querySelector(t);return n?((t,e)=>{if("off"===e)return null;if("metadata"===e)return(t=>({mode:"metadata",selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),attributes:{disabled:!0===t.disabled,required:!0===t.required,ariaDisabled:"true"===t.getAttribute("aria-disabled"),ariaExpanded:h(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:h(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:m(t)}}))(t);const n=(t=>{try{const e=t.getBoundingClientRect(),n=getComputedStyle(t),o=t.parentElement,r=[];if(o)for(let e=0;e<o.children.length&&r.length<6;e++){const n=o.children[e];if(!n||n===t)continue;const i=n.getBoundingClientRect();r.push({selector:a(n),tag:n.tagName.toLowerCase(),box:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)},interactive:_(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?a(o):"",box:{x:Math.round(e.x),y:Math.round(e.y),w:Math.round(e.width),h:Math.round(e.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:!0===t.disabled},inView:w(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(c,n):null;t&&(i.dom=t),i.signal_type&&E&&E(i.signal_type)}const s=(t=>{const e=Object.create(null);for(const n of Object.keys(t)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;const o=X(t[n],n);void 0!==o&&(e[n.slice(0,64)]=o)}if(t.meta&&"object"==typeof t.meta&&!Array.isArray(t.meta)){const n=X(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(s).length&&(i.metadata=s),i})(t,D.page,x.domMode));let o=[];try{for(const t of n){const n=[...o,t];if(JSON.stringify({...e,events:n}).length>v)if(o.length>0)await z({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=v&&await z(n),o=[]}else o=n}o.length>0&&await z({...e,events:o})}catch{}finally{A=!1}})()}function P(t){if(D)for(const e of Object.keys(t))U.has(e)&&(D[e]=t[e])}async function z(t){const e=JSON.stringify(t),n=await(async(t,e)=>{const n=(new TextEncoder).encode(t);if(n.byteLength>v)return null;if("off"!==e){const e=await(async t=>{const e=globalThis.CompressionStream;if("function"!=typeof e)return null;try{const n=(t=>{const e=(new TextEncoder).encode(t),n=new Blob([e],{type:g});if("function"==typeof n.stream)return n.stream();const o=globalThis.ReadableStream;return"function"!=typeof o?null:new o({start(t){t.enqueue(e),t.close()}})})(t);if(!n)return null;const o=new e("gzip"),r=n.pipeThrough(o).getReader(),i=[];let c=0;for(;;){const t=await r.read();if(t.done)break;if(c+=t.value.byteLength,c>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const s=new Uint8Array(c);let a=0;for(const t of i)s.set(t,a),a+=t.byteLength;return s.buffer}catch{return null}})(t);if(e&&e.byteLength<=v)return{beaconBody:new Blob([e],{type:"application/json; encoding=gzip"}),fetchBody:new Uint8Array(e),headers:{"Content-Type":g,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:g}),fetchBody:t,headers:{"Content-Type":g}}})(e,x.compression);n&&q(n,0)}function q(t,e,n=M){if(n){if(navigator.sendBeacon&&navigator.sendBeacon(n,t.beaconBody))return;try{fetch(n,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>q(t,e+1,n),1e3*(e+1))})}catch{}}}function X(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>R.has(t)))(e))){if(null===t||"boolean"==typeof t)return t;if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t){if(C.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>X(t,e,n+1)).filter(t=>void 0!==t);if("object"==typeof t){const e=Object.create(null);for(const o of Object.keys(t).slice(0,40)){if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=X(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function F(...t){for(const e of t)if("string"==typeof e&&e)return e}function J(t){return"off"===t?"off":"auto"}function Z(t,e){for(const n of e){const e=V(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id"))(t)}var H=/^[a-zA-Z0-9/:._*\-]+$/;function V(t){if(t.length>200)return null;if(!H.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var W=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],Y=[],G=3,K=2e3,Q=[],tt=[],et=0,nt=new Map,ot=new Map,rt=!1,it=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Q))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||(!!t.hasAttribute("ondblclick")||(!!t.hasAttribute("data-dbl")||"spinbutton"===t.getAttribute("role")))})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;Y.length&&n-Y[0].t>K;)Y.shift();Y.push({t:n,x:o,y:r});const i=tt.length>=3?2:G;if(Y.length<i)return;const c=Y.slice(-i);for(let t=0;t<c.length-1;t++)for(let e=t+1;e<c.length;e++){const n=c[t],o=c[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>64)return}const s=(c[c.length-1].t-c[0].t)/1e3,u=s>0?c.length/s:c.length,l=Math.round(100*Math.min(1,(c.length-i)/i+u/10))/100,d=((t,e,n)=>{const o=Math.min(4,(t.length-e)/5*4),r=Math.min(4,n/10*4);let i=2;if(t.length>=2){let e=0,n=0;for(let o=0;o<t.length-1;o++)for(let r=o+1;r<t.length;r++){const i=t[o],c=t[r],s=c.x-i.x,a=c.y-i.y;e+=Math.sqrt(s*s+a*a),n++}i=Math.max(0,2-e/n/8*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(c,i,u),h=a(e),m=f(e);tt.push({selector:h,ts:n});const w=tt.length,_=(t=>{const e=(t-et)/6e4;return e<=0?0:Math.round(tt.length/e*10)/10})(n),v=nt.get(h)??0,g=v+1,b=ot.get(h)??0,y=b>0&&n-b<1e4;nt.set(h,g),ot.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=c.reduce((t,e)=>t+e.x,0)/c.length,o=c.reduce((t,e)=>t+e.y,0)/c.length,r=t.top+t.height/2;return{click_dx:Math.round(n-(t.left+t.width/2)),click_dy:Math.round(o-r),el_w:Math.round(t.width),el_h:Math.round(t.height)}}catch{return null}})();I({t:"sig",ts:n,d:{s:"rage_click",el:h,...m?{el_label:m}:{},cnt:c.length,vel:Math.round(10*u)/10,intensity:l,quality:d,burst_seq:w,burst_rate_per_min:_,repeated_target:M,hot_repeat:y,...k??{}}}),M&&I({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...m?{el_label:m}:{},total_hits:g,burst_count:g,burst_seq:w}}),Y=Y.slice(-(i-1))}),ct=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,st=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,at=/^(A|BUTTON|LABEL)$/,ut=[],lt=null,dt=new Map,ft=e(t=>{lt={x:t.clientX,y:t.clientY}}),pt=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,ut))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!lt)return!1;const e=t.clientX-lt.x,n=t.clientY-lt.y;return Math.sqrt(e*e+n*n)>5})(t);if(lt=null,n)return;if((t=>{if(ct.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&st.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!at.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const o=((t,e,n)=>{let o=t;for(let r=0;r<5&&o;r++){const r=o.parentElement;if(!r)break;const i=r.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let c=null,s=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=mt(e,n,r);a<s&&(s=a,c=r)}if(c&&s<100)return c;o=r}return null})(e,t.clientX,t.clientY),r=o?ht(t.clientX,t.clientY,o):null,i=a(e),c=(dt.get(i)??0)+1;dt.set(i,c);const s=c>=2,u=(t=>{try{return window.getComputedStyle(t).cursor.slice(0,20)}catch{return""}})(e),l=(t=>{try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e),d=f(e),h=o?f(o):"";I({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...d?{el_label:d}:{},near:o?a(o):"",...h?{near_label:h}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:u,...l?{looks_interactive:!0}:{},...s?{repeated:!0,repeat_cnt:c}:{}}})});function ht(t,e,n){const o=n.getBoundingClientRect(),r=t-Math.max(o.left,Math.min(t,o.right)),i=e-Math.max(o.top,Math.min(e,o.bottom));return{dist:Math.sqrt(r*r+i*i),dx:r,dy:i}}function mt(t,e,n){return ht(t,e,n).dist}var wt=null,_t=3e3,vt=[],gt="click",bt=0,yt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Mt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,kt=e(t=>{const e=t.target;if(!e)return;if(p(e,vt))return;const n=e.getAttribute("role");if(!(yt.test(e.tagName)||n&&Mt.test(n)))return;const o=Date.now();if(o-bt>50&&(gt="click",bt=o),wt){if(wt.el===e||wt.el.contains(e)){const t=o-wt.ts;return t>=_t&&I({t:"sig",ts:o,d:{s:"speed_frustration",el:wt.selector,delay:t,interaction_type:gt,observed_delay_ms:t}}),void xt()}xt()}const r=a(e);let i=!1;const c=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void xt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void xt()}}),s=e.parentElement||document.body;c.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&wt&&(wt.observer.disconnect(),wt={...wt,timeout:null})},_t+500);wt={el:e,selector:r,ts:o,observer:c,timeout:u}}),Tt=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(gt="keydown",bt=Date.now()))}),Dt=e(()=>{gt="touch",bt=Date.now()});function xt(){wt&&(wt.observer.disconnect(),wt.timeout&&clearTimeout(wt.timeout),wt=null)}var At=800,Et=2e3,St=0,Ot=0,$t=0,Ut=0,Nt=0,Rt=0,Ct=0,Lt=0,jt=[],It=0,Bt=null,Pt=e(t=>{const e=Date.now();e-St<16||(St=e,Bt&&clearTimeout(Bt),Bt=setTimeout(()=>zt(),150),((t,e,n)=>{if(0===Ut)return Ot=t,$t=e,Ut=n,void(Lt=n);const o=(n-Ut)/1e3;if(0===o)return;const r=t-Ot,i=e-$t;if(Math.abs(r)<2&&Math.abs(i)<2)return;const c=Math.sqrt(r*r+i*i),s=c/o;jt.length>=100&&(jt=jt.slice(-50)),jt.push(s),It+=c;const a=Math.sign(r),u=Math.sign(i);if(c>=5&&(0!==Nt&&0!==a&&a!==Nt||0!==Rt&&0!==u&&u!==Rt)&&Ct++,Nt=a||Nt,Rt=u||Rt,Ot=t,$t=e,Ut=n,n-Lt>Et){if(Ct>=3){const t=jt.reduce((t,e)=>t+e,0)/jt.length;t>=At&&I({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Ct,distance_px:Math.round(It)}})}zt(),Lt=n}})(t.clientX,t.clientY,e))});function zt(){Ct=0,jt=[],It=0,Nt=0,Rt=0,Ut=0,Ot=0,$t=0,St=0,Bt=null}var qt=[],Xt=[],Ft=3e4,Jt=1e4,Zt=.5,Ht=[],Vt=0,Wt=0,Yt=!1,Gt=0,Kt=e(()=>{Yt||(Yt=!0,requestAnimationFrame(()=>{Yt=!1,(()=>{const t=Date.now(),e=window.scrollY;if((Gt=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/Gt,o=e>Vt?"down":"up";if(t-Wt<100)return void(Vt=e);for(;Ht.length&&t-Ht[0].ts>Jt;)Ht.shift();Ht.length>=100&&(Ht=Ht.slice(-50)),Ht.push({depth:n,ts:t,direction:o}),Vt=e,Wt=t;let r=0,i=1,c=0,s=!1,a=0,u=0,l=0,d=1,f=0;for(let t=1;t<Ht.length;t++)Ht[t].direction!==Ht[t-1].direction&&f++;for(let t=0;t<Ht.length;t++){const e=Ht[t],n=e.depth;if(n>r&&(r=n),n>=Zt&&(s||(a=e.ts,l=n),s=!0),s&&n<i&&(i=n,u=e.ts,d=n),s&&i<.25&&n>=Zt){if(u-a<200){s=!1,i=1,a=e.ts,l=n;continue}c++,s=!1,i=1}}if(c>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-d),o=Math.round(n/e*1e3);I({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:c+1,vel:o,dir_changes:f}}),Ht=[]}})()}))}),Qt=["textarea",'[role="textbox"]',"[contenteditable]"],te=new Map,ee=new Map,ne=new Set,oe=null,re=0,ie=5e3,ce=[],se=e(t=>{const e=t.target;if(!e||!pe(e))return;if(p(e,ce))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of Qt)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();te.set(e,n),ee.set(e,n);const o=e.closest("form");o&&o!==oe&&(oe=o,re=o.querySelectorAll("input, select, textarea").length)}),ae=e(t=>{const e=t.target;if(!e||!pe(e))return;const n=te.get(e),o=ee.get(e);te.delete(e),ee.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=ie){const n=f(e);I({t:"sig",ts:r,d:{s:"form_hesitation",el:a(e),...n?{el_label:n}:{},pause:t}})}}const i=e.getAttribute("name")||e.getAttribute("id")||a(e);(t=>"value"in t&&t.value.length>0)(e)&&ne.add(i)}),ue=e(()=>{ne.clear(),oe=null}),le=t(fe),de=null;function fe(){if(ne.size>0&&oe){const t=re||ne.size,e=Math.round(ne.size/t*100)/100;I({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:ne.size,total:t,field_count:t,completion_rate:e}}),ne.clear(),oe=null}}function pe(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var he=null,me=null,we=/flusterduck\.com|\/v1\/ingest/,_e=e(t=>{const e=t.message||"Unknown error";var n;I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Me(e,200),ep:"",status:0,error_category:(n=e,ge.test(n)?"network":"script"),url:location.pathname}})}),ve=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Me(e,200),ep:"",status:0,error_category:be(t.reason),url:location.pathname}})}),ge=/fetch|network|cors|timeout/i;function be(t){if(t instanceof TypeError&&ge.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return ge.test(e)?"network":"unhandled_promise"}function ye(t){try{return new URL(t,location.origin).pathname}catch{const e=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(e>=0?e:t.length,n>=0?n:t.length);return t.slice(0,o)||"/"}}function Me(t,e){let n=t.length>e?t.slice(0,e):t;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,t=>{try{return new URL(t).origin+new URL(t).pathname}catch{return"[URL]"}}),n}var ke=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Te=['[class*="map"]',"canvas",".gallery","[data-zoom]"],De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,Re=[],Ce=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(De={x:e.clientX,y:e.clientY,ts:Date.now()},xe=0):2===t.touches.length&&(xe=Pe(t.touches),De=null)}),Le=e(t=>{if(xe>0){const e=t.touches.length>=2?Pe(t.touches):(()=>{const e=t.changedTouches[0],n=t.changedTouches[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)})();e>0&&(Ae=Math.round(e/xe*100)/100),xe=0}if(!De)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-De.x,o=e.clientY-De.y,r=Date.now()-De.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(p(t,Re))return;const o=((t,e,n)=>{const o=(t.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])');let r=null,i=21;for(let t=0;t<o.length;t++){const c=o[t];if(!c)continue;const s=c.getBoundingClientRect(),a=Math.max(s.left,Math.min(e,s.right)),u=Math.max(s.top,Math.min(n,s.bottom)),l=Math.sqrt((e-a)**2+(n-u)**2);l<i&&l>0&&(i=l,r=c)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),c=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((e-i)**2+(n-c)**2);if(s>0&&s<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;I({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(s),size:t}})}})(i,e.clientX,e.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&((t,e,n)=>{if(Math.abs(n)>Math.abs(e))return;if(!t)return;if(ke.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!ke.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";I({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),De=null}),je=e(()=>{const t=Date.now();if(t-Se>3e4&&(Ee=0,Se=t),++Ee>=2){const e=document.activeElement||document.body;!Te.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Oe>200&&(Oe=t,I({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:Ae}})),Ee=0,Ae=1}}),Ie=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ue>3e4&&($e=0,Ue=t),e!==Ne&&($e++,Ne=e),$e>=3&&(I({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:$e,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),$e=0)}),Be=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Se>3e4&&(Ee=0,Se=e),++Ee>=2&&e-Oe>200){const n=Math.round(100*t.scale)/100;Oe=e,I({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:n}}),Ee=0,Ae=1}}});function Pe(t){const e=t[0],n=t[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)}var ze=[],qe=null,Xe=0,Fe=0,Je="",Ze=[],He=[],Ve=e(t=>{const e=Date.now(),n=t.target;n&&p(n,He)||("Tab"===t.key?((t,e,n)=>{for(;ze.length&&t-ze[0].ts>5e3;)ze.shift();ze.length>=50&&(ze=ze.slice(-25));const o=e?a(e):"";if(ze.push({ts:t,el:o,shift:n}),ze.length>=10){const e=ze.map(t=>t.el).filter(Boolean),n=(t=>{let e=0;for(let n=1;n<t.length;n++)t[n].shift!==t[n-1].shift&&e++;return e})(ze);I({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ze.length,els:e,direction_changes:n}}),ze=[]}if(!e)return;const r=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(r){const n=a(e);r===qe?t-Fe<=3e3?(Xe++,Je=n,Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=null)):(Fe=t,Xe=1,Je=n):(qe=r,Fe=t,Xe=1,Je=n)}})(e,n,t.shiftKey):"Escape"===t.key?((t,e)=>{if(!e)return;const n=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(n&&n===qe){if(t-Fe>3e3)return Fe=t,Xe=1,void(Je=a(e));Xe++,Je=a(e),Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=null)}})(e,t.target):"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||((t,e)=>{if(!e)return;const n=e.closest('[role="listbox"]')||e.closest('[role="menu"]')||e.closest('[role="tree"]')||e.closest("select");if(!n)return;for(;Ze.length&&t-Ze[0].ts>5e3;)Ze.shift();Ze.length>=50&&(Ze=Ze.slice(-25)),Ze.push({ts:t,container:n});const o=Ze.filter(t=>t.container===n);o.length>=15&&(I({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),Ze=[])})(e,t.target))}),We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0,rn=e(()=>{Qe||(Qe=!0,requestAnimationFrame(()=>{Qe=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-Ye;if(Math.abs(n)<2)return void(Ye=e);const o=n>0?"down":"up";Ge&&o!==Ge&&(t-Ke>3e3&&(We=0,Ke=t),++We>=4)&&Math.abs(n)>100&&(t-en>1e4&&(tn=0,en=t),tn++,I({t:"sig",ts:t,d:{s:"scroll_hijack",rev:We,source:null!==nn&&t-on<=2e3?nn:"wheel",repeated:tn>=2}}),We=0),Ge=o,Ye=e})()}))}),cn=e(()=>{nn="wheel",on=Date.now()}),sn=e(()=>{nn="touch",on=Date.now()});function an(){We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0}var un=0,ln=0,dn=!1,fn=e(()=>{dn||(dn=!0,requestAnimationFrame(()=>{dn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>un&&(un=e,0===ln&&(ln=Date.now()))}}))}),pn=null,hn=null;function mn(){if(un>.05){const t=Date.now(),e=ln>0?Math.max(0,t-ln):0;I({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*un)/100,max_depth:Math.round(100*un),dwell_ms:e}})}}var wn="",_n=0,vn=0,gn=0,bn=0,yn=0,Mn=null,kn=0,Tn=!1,Dn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==wn||o-vn>1500)&&(wn=n,vn=o,_n=0),(_n+=1)<4||(I({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:_n,window_ms:1500}}),_n=0,vn=o)}),xn=e(()=>{const t=Date.now(),e=Sn(),n=yn||e,o=Math.abs(e-n)/Math.max(n,1);yn=e,o<.15||((!gn||t-gn>5e3)&&(gn=t,bn=0),(bn+=1)<3||(I({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:bn,area_delta:Math.round(1e3*o)/1e3}}),bn=0,gn=t))}),An=e(()=>{En()});function En(){On();const t=kn+=1;Mn=setTimeout(()=>{I({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function Sn(){return Math.max(1,window.innerWidth*window.innerHeight)}function On(){Mn&&(clearTimeout(Mn),Mn=null)}var $n=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],Un=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,Nn=[],Rn=[],Cn=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rn))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(Ln(e))return!0;if(jn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;Nn.length&&n-Nn[0].t>6e4;)Nn.shift();const o=a(e);if(Nn.push({t:n,el:o}),Nn.length<3)return;const r=new Set(Nn.map(t=>t.el)).size,i=f(e);I({t:"sig",ts:n,d:{s:"help_hunt",cnt:Nn.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),Nn=[]});function Ln(t){for(const e of $n)try{if(t.matches(e))return!0}catch{}return!1}function jn(t){const e=t.id??"",n=t.className??"";return Un.test("string"==typeof n?`${e} ${n}`:e)}var In=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Bn=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Pn=[],zn=new Map,qn=[],Xn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,qn))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(Fn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=f(e);Pn.push({t:n,el:o});const i=(zn.get(o)??0)+1;zn.set(o,i);const c=Pn.length,s=(()=>{try{const n=e.getBoundingClientRect();return 0===n.width&&0===n.height?null:{click_dx:Math.round(t.clientX-(n.left+n.width/2)),click_dy:Math.round(t.clientY-(n.top+n.height/2)),el_w:Math.round(n.width),el_h:Math.round(n.height)}}catch{return null}})();I({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:c,element_cnt:i,repeated:i>1,container:Jn(e),...s??{}}})});function Fn(t){const e=t.getAttribute("data-dismiss")??"",n=t.getAttribute("data-close")??"";if(e||n)return!0;const o=t.getAttribute("aria-label")??t.getAttribute("title")??"";if(o&&Bn.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(In.test(t.id??"")||In.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&Bn.test(i))return!0;if("BUTTON"===t.tagName&&t.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){const e=(t.textContent??"").trim();if("×"===e||"✕"===e||"✗"===e||"X"===e||"x"===e)return!0}return!1}function Jn(t){const e=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(const[n,o]of e)try{if(t.closest(n))return o}catch{}return"unknown"}var Zn=null,Hn=[],Vn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,Hn)||(Zn=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:f(e),t:Date.now()}))}),Wn=e(t=>{"Escape"===t.key&&Gn("escape")}),Yn=e(()=>{Gn("back_nav")});function Gn(t){if(!Zn)return;const e=Date.now()-Zn.t;e>1500||I({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Zn.el,...Zn.label?{el_label:Zn.label}:{},elapsed_ms:e}}),Zn=null}var Kn=/^(checkbox|radio)$/,Qn=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,to=new Map,eo=[],no=e(t=>{const e=t.target;e&&(p(e,eo)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Kn.test(t.type??""):Qn.test(t.getAttribute("role")??"")))(e)&&ro(e))}),oo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,eo))return;const n=e.getAttribute("role")??"";Qn.test(n)&&"INPUT"!==e.tagName&&ro(e)});function ro(t){const e=a(t),n=Date.now();let o=to.get(e);for(o||(o=[],to.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=f(t);I({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),to.delete(e)}var io=[],co=e(t=>{const e=t.target;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t)return;if(e.isContentEditable)return}const n=window.getSelection();if(!n||n.toString().length<2)return;const o=Date.now();for(;io.length&&o-io[0].t>15e3;)io.shift();io.push({t:o}),io.length<3||(I({t:"sig",ts:o,d:{s:"copy_frustration",cnt:io.length,window_ms:15e3}}),io=[])}),so=[],ao=0,uo=null,lo=null;function fo(){ao=Date.now(),so=[]}function po(){const t=window.getSelection();if(!t||t.isCollapsed)return;if(t.toString().length<5)return;const e=t.anchorNode?.parentElement;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)return}const n=Date.now();if(n-ao<2e3)return;for(;so.length&&n-so[0].t>15e3;)so.shift();const o=so[so.length-1];o&&n-o.t<500||(so.push({t:n}),so.length<4||(I({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:so.length,window_ms:15e3}}),so=[]))}var ho=6e4,mo="_fd_sess",wo={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},_o={low:1,medium:2,high:3,critical:4},vo=[],go=null,bo=!1,yo=new Map,Mo={totalSignals:0,pagesWithFrustration:0},ko="",To=null,Do=null,xo=null,Ao=null;function Eo(t){bo&&So(t,Date.now())}function So(t,e){yo.has(t)||yo.set(t,[]);const n=yo.get(t);n.push(e),n.length>20&&n.shift()}function Oo(t){let e="",n=0;for(const[o,r]of t)(r>n||r===n&&o<e)&&(e=o,n=r);return{type:e,count:n}}function $o(t){if(!bo)return;if("frustration_burst"===t)return;const e=Date.now();(t=>{const e=t-ho;let n=0;for(;n<vo.length&&vo[n].ts<e;)n++;n>0&&(vo=vo.slice(n))})(e),0===vo.length&&(go=null),vo.push({type:t,ts:e}),So(t,e);const{distinctTypes:n,totalWeight:o,typeCounts:r}=(()=>{const t=new Map;let e=0;for(const n of vo)t.set(n.type,(t.get(n.type)??0)+1),e+=wo[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),i=((t,e,n)=>Oo(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(n.size,o,r);i&&(null!==go&&_o[i]<=_o[go]||(go=i,((t,e,n,o)=>{const r=Oo(o),i=(()=>{const t=[],e=Date.now()-ho,n=[];for(const[t,o]of yo.entries())for(const r of o)r>=e&&n.push({type:t,ts:r});n.sort((t,e)=>t.ts-e.ts);for(let e=0;e<n.length;e++)if("rage_click"===n[e].type)for(let o=e+1;o<n.length;o++)if("form_validation_loop"===n[o].type&&n[o].ts-n[e].ts<=3e4){t.push("rage_then_form_loop");break}for(let e=0;e<n.length;e++)if("dead_click"===n[e].type)for(let o=e+1;o<n.length;o++){const r=n[o].type;if(("popstate"===r||"hashchange"===r)&&n[o].ts-n[e].ts<=1e4){t.push("dead_then_bail");break}}for(let e=0;e<n.length;e++)if("form_validation_loop"===n[e].type)for(let o=e+1;o<n.length;o++)if(("visibilitychange"===n[o].type||"pagehide"===n[o].type)&&n[o].ts-n[e].ts<=2e4){t.push("form_loop_then_abandon");break}return t})();I({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:ko||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:Mo.totalSignals,session_pages_with_frustration:Mo.pagesWithFrustration}}),Mo.totalSignals+=vo.length,Mo.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(mo,JSON.stringify(Mo))}catch{}})()})(i,n,o,r)))}var Uo=3e4,No=[],Ro="",Co=!1,Lo=e(()=>{Io(location.pathname+location.search+location.hash)}),jo=e(()=>{Io(location.pathname+location.search+location.hash)});function Io(t){const e=Date.now();if(Ro&&Ro!==t){const t=No[No.length-1];t&&t.path===Ro&&null===t.leftAt&&(t.leftAt=e)}for(;No.length&&e-No[0].ts>Uo;)No.shift();t!==Ro&&(No.push({path:t,ts:e,leftAt:null}),Ro=t),No.length<5||Co||(t=>{const e=No.filter(e=>t-e.ts<=Uo),n=e.filter(t=>null!==t.leftAt),o=new Set(e.map(t=>t.path));if(o.size<5)return;if(0===n.length)return;if(n.some(t=>t.leftAt-t.ts>=5e3))return;if(new Set(n.map(t=>t.path)).size<5)return;const r=n.map(t=>t.leftAt-t.ts),i=Math.round(r.reduce((t,e)=>t+e,0)/r.length),c=Math.max(...r),s=e.map(t=>t.path).slice(-8);Co=!0,I({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:Uo,avg_dwell_ms:i,pages:s,max_dwell_ms:c}})})(e)}var Bo=[],Po=!1,zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Zo=e(()=>{Po||(Po=!0,requestAnimationFrame(Wo))}),Ho=e(t=>{if(!Jo)return;const e=Date.now();if(e-Fo>3e3)return void(Jo=!1);if(window.scrollY+t.clientY>Xo+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(qo-Xo),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,c=i?a(i):"",s=i?f(i):"";Jo=!1,qo=window.scrollY,zo="none",Bo=[],I({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:c,...s?{click_el_label:s}:{},scroll_back_pct:r}})});function Vo(){Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1}function Wo(){Po=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Bo[Bo.length-1];if(o&&t-o.ts<50)return;if(Bo.push({y:e,ts:t}),Bo.length>60&&(Bo=Bo.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==zo&&Jo&&(Jo=!1),e>qo&&(qo=e),void(zo="down");Jo&&t-Fo>3e3&&(Jo=!1),"down"===zo&&qo-e>=.3*n&&!Jo&&(Xo=e,Fo=t,Jo=!0),zo="up"}}var Yo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Go=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ko=/^(A|BUTTON|LABEL)$/,Qo=new Map,tr=[],er=null,nr=e(t=>{er={x:t.clientX,y:t.clientY}}),or=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,tr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!er)return!1;const e=t.clientX-er.x,n=t.clientY-er.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Yo.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Go.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!Ko.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const{row:n,col:o}=((t,e)=>{const n=Math.min(3,Math.floor(t/window.innerWidth*4));return{row:Math.min(3,Math.floor(e/window.innerHeight*4)),col:n}})(t.clientX,t.clientY),r=((t,e)=>4*t+e)(n,o),i=Date.now(),c=a(e),s=(Qo.get(r)??[]).filter(t=>i-t.ts<9e4);if(s.push({ts:i,selector:c}),Qo.set(r,s),s.length>=3){const t=new Map;for(const e of s)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",c=0;for(const[n,o]of t)o>c&&(c=o,e=n);const a=new Set,u=[];for(const t of s)if(!a.has(t.selector)&&(a.add(t.selector),u.push(t.selector),u.length>=5))break;const l=(()=>{try{const t=e?document.querySelector(e):null;return t?f(t):""}catch{return""}})();I({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:s.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Qo.set(r,[])}}),rr=12e4,ir=new Map,cr=[],sr=null,ar=e(t=>{const e=t.target;e&&mr(e)}),ur=e(t=>{const e=t.target;if(!e||!fr(e))return;if(p(e,cr))return;const n=a(e);ir.has(n)||dr(e)&&hr(e,n)});function lr(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function dr(t){const e=t.getAttribute("aria-invalid");if("true"===e||""===e)return!0;if("validity"in t&&t.validity&&!t.validity.valid)return!0;try{return t.matches(":invalid")}catch{return!1}}function fr(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function pr(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function hr(t,n){const o=(t=>e(e=>{_r(t)}))(n),r=(t=>e(e=>{_r(t)}))(n);t.addEventListener("input",o,{passive:!0}),t.addEventListener("change",r,{passive:!0});const i={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:o,changeHandler:r,el:t};return ir.set(n,i),i}function mr(t){if(!fr(t))return;if(p(t,cr))return;const e=Date.now();(t=>{for(const[e,n]of ir)t-n.lastTs>rr&&(pr(n),ir.delete(e))})(e);const n=a(t),o=ir.get(n);if(!o)return void hr(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n)))}function wr(t){if(!fr(t))return;const e=Date.now(),n=a(t),o=ir.get(n);return o?e-o.lastTs>rr?(pr(o),void ir.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function _r(t){const e=Date.now(),n=ir.get(t);if(n){if(e-n.lastTs>rr)return pr(n),void ir.delete(t);if(n.lastTs=e,dr(n.el))return n.cycles+=1,void(n.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...f(n.el)?{el_label:f(n.el)}:{},cycles:n.cycles,window_ms:rr,field_type:lr(n.el)}}),pr(n),ir.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function vr(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!fr(t))continue;if(p(t,cr))continue;const n=e.oldValue,o="true"===n||""===n,r=dr(t);r&&!o?mr(t):!r&&o&&wr(t)}}var gr=null,br=null,yr=[],Mr=0,kr=new Map;function Tr(){for(const t of yr)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}function Dr(t){kr.has(t)||(kr.set(t,{firstSeenTs:0,emitted:!1}),gr.observe(t))}function xr(t){for(const e of t)for(let t=0;t<e.addedNodes.length;t++){const n=e.addedNodes[t];if(n instanceof Element)for(const t of yr)try{n.matches(t)&&Dr(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}}function Ar(t){const e=Date.now();for(const n of t){const t=kr.get(n.target);if(t&&!t.emitted&&n.isIntersecting&&n.intersectionRatio>=.5){t.firstSeenTs||(t.firstSeenTs=e),t.emitted=!0;const o=n.boundingClientRect,r=n.rootBounds?.height??window.innerHeight,i=o.top<.5*r?"above_fold":"below_fold",c=a(n.target),s=f(n.target);I({t:"sig",ts:e,d:{s:"element_impression",el:c,...s?{el_label:s}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-Mr),viewport_position:i}})}}}var Er=new Map,Sr=[],Or=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,Sr))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Er.get(r);if(i){if(n-i.lastTs>6e4)return i.lastValue=o,i.cycles=0,i.phase="typing",void(i.lastTs=n);if(i.lastTs=n,"typing"===i.phase&&i.lastValue.length-o.length>=3)i.phase="deleted";else if("deleted"===i.phase&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=2)){const t=f(e);return I({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:$r(e)}}),void Er.delete(r)}i.lastValue=o}else Er.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function $r(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Ur=null,Nr=2e3,Rr=[],Cr=new Map,Lr=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rr))return;if(!(t=>{if(/^(A|BUTTON|SELECT)$/.test(t.tagName))return!0;const e=t.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(e))return!0;try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e))return;const n=a(e);if(Ur?.selector===n)return;Br();const o=Date.now();if(o-(Cr.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=f(e);Cr.set(n,t),Ur=null,I({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Nr);Ur={el:e,selector:n,startTs:r,timer:i}}),jr=e(t=>{if(!Ur)return;const e=t.target;if(e!==Ur.el&&!Ur.el.contains(e))return;const n=t.relatedTarget;n&&Ur.el.contains(n)||Br()}),Ir=e(Br);function Br(){Ur&&(clearTimeout(Ur.timer),Ur=null)}var Pr=0,zr=0,qr=null,Xr=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Pr<3e3||n-zr<6e4||(qr&&clearTimeout(qr),qr=setTimeout(t(()=>{const t=Date.now();zr=t,qr=null,I({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Pr)}})}),500))}),Fr=null,Jr=null,Zr=null,Hr=0;function Vr(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function Wr(){if(Zr){if(Zr.disconnect(),Zr=null,Hr>0){const t=Math.round(1e3*Hr)/1e3;I({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:Vr(Hr,.1,.25)}})}Hr=0}}var Yr=[],Gr=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,Yr))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=f(e);I({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:Kr(e)}})},100)});function Kr(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Qr=!1,ti=null,ei=null;function ni(e){if(Qr)return;if(!e.key)return;if(e.key.startsWith("fd_sec_"))return;if(!e.key.startsWith("fd_pub_"))return;if(!1!==e.respectDoNotTrack&&("1"===navigator.doNotTrack||navigator.globalPrivacyControl))return void(ei=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(ei=e);ei=e,Qr=!0;const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return c(n,r,30),r})(e.cookieless??!1),s=(t=>{if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}})(e.endpoint)??"https://api.flusterduck.com/v1/ingest",a=Z(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;M=t,D=Object.assign(Object.create(null),e),x={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off"),compression:J(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.addEventListener("visibilitychange",L),window.addEventListener("pagehide",j)})(s,{sid:r,key:e.key,url:location.origin+location.pathname,page:a,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u,compression:e.compression});const d=ui(location.pathname,e.ignorePages??[]);d&&$(!0);const f=document.referrer;let p="";if(f)try{p=new URL(f).origin+new URL(f).pathname}catch{p=""}d||I({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[],m=t=>{const n=e.signals?.[t];return!1!==n?.enabled};if(m("rageClick")&&((t,e)=>{rt||(rt=!0,G=t?.threshold??3,K=t?.windowMs??2e3,Q=[...W,...e??[]],et=Date.now(),Y=[],tt=[],nt.clear(),ot.clear(),document.addEventListener("click",it,{capture:!0,passive:!0}))})(e.signals?.rageClick,h),m("deadClick")&&(t=>{ut=t??[],document.addEventListener("mousedown",ft,{capture:!0,passive:!0}),document.addEventListener("click",pt,{capture:!0,passive:!0})})(h),m("speedFrustration")){const t=e.signals?.speedFrustration;((t,e)=>{_t=t?.delayMs??3e3,vt=e??[],document.addEventListener("click",kt,{capture:!0,passive:!0}),document.addEventListener("keydown",Tt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Dt,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,h)}if(!1!==e.trackMouse&&m("thrashCursor")){const t=e.signals?.thrashCursor;w=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,At=w?.velocityThreshold??800,Et=w?.windowMs??2e3,document.addEventListener("mousemove",Pt,{passive:!0})}var w,_;if(m("loopNav")&&(t=>{Ft=t?.windowMs??3e4})(e.signals?.loopNav),m("scrollBounce")&&(Jt=1e4,Zt=.5,window.addEventListener("scroll",Kt,{passive:!0})),!1!==e.trackForms){if(m("formHesitation")||m("formAbandon")){const n=e.signals?.formHesitation;((e,n)=>{ie=e?.pauseMs??5e3,ce=n??[],document.addEventListener("focusin",se,{capture:!0,passive:!0}),document.addEventListener("focusout",ae,{capture:!0,passive:!0}),document.addEventListener("submit",ue,{capture:!0,passive:!0}),window.addEventListener("pagehide",le),de=t(()=>{"hidden"===document.visibilityState&&fe()}),document.addEventListener("visibilitychange",de)})(n?{pauseMs:n.threshold}:void 0,h)}m("formValidationLoop")&&(t=>{cr=t??[],document.addEventListener("invalid",ar,{capture:!0,passive:!0}),document.addEventListener("input",ur,{capture:!0,passive:!0}),document.addEventListener("change",ur,{capture:!0,passive:!0}),(sr=new MutationObserver(vr)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(h)}if(m("errorEncounter")&&(window.addEventListener("error",_e),window.addEventListener("unhandledrejection",ve),he||(he=window.fetch,me=function(t,e){let n;try{n=he.call(this,t,e)}catch(t){throw t}return n.then(e=>{try{if(e.status>=400){const n="string"==typeof t?t:t instanceof URL?t.pathname:t.url;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:ye(n),status:e.status,error_category:"network",url:location.pathname}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Me(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?ye(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=me)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&(t=>{Re=t??[],document.addEventListener("touchstart",Ce,{passive:!0}),document.addEventListener("touchend",Le,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",je,{passive:!0}),window.addEventListener("orientationchange",Ie,{passive:!0})),window.visualViewport?.addEventListener("resize",Be)})(h),(m("tabThrash")||m("focusTrap")||m("keyboardNavFrustration"))&&(t=>{He=t??[],document.addEventListener("keydown",Ve,{capture:!0,passive:!0})})(h),m("scrollHijack")&&(window.addEventListener("wheel",cn,{passive:!0}),window.addEventListener("touchmove",sn,{passive:!0}),window.addEventListener("scroll",rn,{passive:!0})),m("scrollDepthAbandon")&&(window.addEventListener("scroll",fn,{passive:!0}),hn=t(mn),window.addEventListener("pagehide",hn),pn=t(()=>{"hidden"===document.visibilityState&&mn()}),document.addEventListener("visibilitychange",pn)),m("advancedHeuristics")&&(Tn||(Tn=!0,yn=Sn(),En(),document.addEventListener("mouseenter",Dn,!0),document.addEventListener("mouseleave",Dn,!0),document.addEventListener("click",An,{capture:!0,passive:!0}),document.addEventListener("keydown",An,{capture:!0,passive:!0}),document.addEventListener("scroll",An,{passive:!0}),window.addEventListener("resize",xn,{passive:!0}))),m("helpHunt")&&(t=>{Rn=t??[],document.addEventListener("click",Cn,{capture:!0,passive:!0})})(h),m("closeClick")&&(t=>{qn=t??[],document.addEventListener("click",Xn,{capture:!0,passive:!0})})(h),m("closeClickReversal")&&(t=>{Hn=t??[],document.addEventListener("click",Vn,{capture:!0,passive:!0}),document.addEventListener("keydown",Wn,{capture:!0,passive:!0}),window.addEventListener("popstate",Yn)})(h),m("filterSpiral")&&(t=>{eo=t??[],document.addEventListener("change",no,{capture:!0,passive:!0}),document.addEventListener("click",oo,{capture:!0,passive:!0})})(h),m("copyFrustration")&&document.addEventListener("copy",co,{capture:!0,passive:!0}),m("textSelectFrustration")&&(uo=t(po),lo=t(fo),document.addEventListener("selectionchange",uo),document.addEventListener("copy",lo,{capture:!0,passive:!0}),document.addEventListener("cut",lo,{capture:!0,passive:!0})),m("deadClickTrapZone")&&(t=>{tr=t??[],document.addEventListener("mousedown",nr,{capture:!0,passive:!0}),document.addEventListener("click",or,{capture:!0,passive:!0})})(h),(t=>{vo=[],go=null,bo=!0,yo=new Map,ko=t??"",(()=>{try{const t=sessionStorage.getItem(mo);if(t){const e=JSON.parse(t);Mo={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),O($o),To=()=>Eo("popstate"),Do=()=>Eo("hashchange"),xo=()=>{"hidden"===document.visibilityState&&Eo("visibilitychange")},Ao=()=>Eo("pagehide"),window.addEventListener("popstate",To),window.addEventListener("hashchange",Do),document.addEventListener("visibilitychange",xo),window.addEventListener("pagehide",Ao)})(a),m("navigationConfusion")&&(No=[],Co=!1,Ro=location.pathname+location.search+location.hash,window.addEventListener("popstate",Lo),window.addEventListener("hashchange",jo)),m("scrollToClickConfusion")&&(Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1,window.addEventListener("scroll",Zo,{passive:!0}),window.addEventListener("click",Ho,{capture:!0})),m("elementImpression")&&(_=e.elementImpressionSelectors,yr=_?.length?_:["[data-fd-impression]"],Mr=Date.now(),"undefined"!=typeof IntersectionObserver&&(gr=new IntersectionObserver(t(Ar),{threshold:[0,.5,1]}),Tr(),(br=new MutationObserver(t(xr))).observe(document.body,{childList:!0,subtree:!0}))),!1!==e.trackForms&&m("inputCorrection")&&(t=>{Sr=t??[],document.addEventListener("input",Or,{capture:!0,passive:!0})})(h),!1!==e.trackForms&&m("pasteBlocked")&&(t=>{Yr=t??[],document.addEventListener("paste",Gr,{capture:!0,passive:!0})})(h),m("hoverDwell")){const t=e.signals?.hoverDwell;((t,e)=>{Nr=t?.dwellMs??2e3,Rr=e??[],document.addEventListener("mouseover",Lr,{passive:!0}),document.addEventListener("mouseout",jr,{passive:!0}),document.addEventListener("click",Ir,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,h)}m("exitIntent")&&(Pr=Date.now(),zr=0,document.addEventListener("mouseleave",Xr)),m("performanceVitals")&&(()=>{if("undefined"!=typeof PerformanceObserver){try{(Fr=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);I({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Vr(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Fr=null}try{(Jr=new PerformanceObserver(t(t=>{for(const e of t.getEntries()){const t=e;if(!t.interactionId)continue;const n=Math.round(t.duration);n<200||I({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:Vr(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Jr=null}try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Zr=null}}})(),ti=function(t){let e=location.href;function n(){const n=location.href;n!==e&&(e=n,t(n,location.pathname))}const o=history.pushState,r=history.replaceState,i=function(...t){o.apply(this,t),n()},c=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=c,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===c&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((n,o)=>{B(),Ht=[],Vt=0,Wt=0,Yt=!1,te.clear(),ee.clear(),ne.clear(),oe=null,re=0,un=0,ln=0,dn=!1,xt(),En(),kn=0,Nn=[],Pn=[],zn.clear(),Zn=null,to.clear(),io=[],so=[],ao=0,Qo.clear(),(()=>{for(const t of ir.values())pr(t);ir.clear()})(),dt.clear(),an(),Vo(),No=[],Co=!1,Ro=location.pathname+location.search+location.hash,kr.clear(),gr&&Tr(),Er.clear(),Br(),Cr.clear(),Pr=Date.now(),zr=0,qr&&(clearTimeout(qr),qr=null),(()=>{if(Wr(),"undefined"!=typeof PerformanceObserver)try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Zr=null}})(),Io(o),(t=>{ko=t})(o);const r=Z(o,e.pageRules??[]),i=ui(o,e.ignorePages??[]);$(i),P({page:r,url:n}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;qt.length&&e-qt[0].ts>Ft;)qt.shift();for(;Xt.length&&e-Xt[0].ts>Ft;)Xt.shift();if(qt.length>=100&&(qt=qt.slice(-50)),Xt.length>=100&&(Xt=Xt.slice(-50)),qt.push({path:t,ts:e}),r){Xt.push({path:t,ts:e});const n=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))===o}),r=new Set(n.map(t=>{const e=t.path.indexOf("#");return-1===e?"":t.path.slice(e)}));if(r.size>=3&&n.length>r.size){const t=n.slice(-5).map(t=>t.path);return I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(qt.length<4)return;let i=!1;const c=[];for(let e=0;e<qt.length-1;e++)if(qt[e].path===t){const t=qt.slice(e,qt.length),n=new Set(t.map(t=>t.path));if(n.size>=2){c.push(...Array.from(n)),i=!0;break}}i&&(I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:c,path_sequence:qt.slice(-5).map(t=>t.path)}}),qt=[{path:t,ts:e}],Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(o),i||I({t:"pv",ts:Date.now(),d:{ref:""}})}))}function oi(t,e){if(!Qr)return;if("string"!=typeof t||!t||t.length>128)return;let n;try{n=JSON.stringify(e?.metadata??{})}catch{return}if(n.length>2048)return;const o=JSON.parse(n);I({t:"sig",ts:Date.now(),d:{s:t.slice(0,128),el:"string"==typeof e?.element?e.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(e?.weight??15,100))}})}function ri(t,e={}){if(!Qr)return;if("string"!=typeof t||!/^[a-z0-9_.-]{1,120}$/i.test(t))return;let n;try{n=JSON.stringify(e??{})}catch{return}n.length>2048||I({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ii(t){if(!Qr)return;if(!t||"object"!=typeof t)return;const e=Object.create(null);let n=0;for(const o of Object.keys(t)){if(n>=20)break;"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&(e[o.slice(0,64)]=String(t[o]).slice(0,256),n++)}P({segment:e})}function ci(t){t&&ei&&!Qr?ni(ei):t||(ai(),r())}function si(){ai(),r()}function ai(){Qr&&(rt&&(rt=!1,document.removeEventListener("click",it,{capture:!0,passive:!0}),Y=[],tt=[],nt.clear(),ot.clear()),document.removeEventListener("mousedown",ft,{capture:!0}),document.removeEventListener("click",pt,{capture:!0}),lt=null,dt.clear(),document.removeEventListener("click",kt,{capture:!0}),document.removeEventListener("keydown",Tt,{capture:!0}),document.removeEventListener("touchstart",Dt,{capture:!0}),xt(),document.removeEventListener("mousemove",Pt),Bt&&clearTimeout(Bt),zt(),qt=[],Xt=[],window.removeEventListener("scroll",Kt),Ht=[],Yt=!1,document.removeEventListener("focusin",se,{capture:!0}),document.removeEventListener("focusout",ae,{capture:!0}),document.removeEventListener("submit",ue,{capture:!0}),window.removeEventListener("pagehide",le),de&&(document.removeEventListener("visibilitychange",de),de=null),te.clear(),ee.clear(),ne.clear(),oe=null,window.removeEventListener("error",_e),window.removeEventListener("unhandledrejection",ve),he&&me&&window.fetch===me&&(window.fetch=he),he=null,me=null,document.removeEventListener("touchstart",Ce),document.removeEventListener("touchend",Le),document.removeEventListener("gesturechange",je),window.removeEventListener("orientationchange",Ie),window.visualViewport?.removeEventListener("resize",Be),De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,document.removeEventListener("keydown",Ve,{capture:!0}),ze=[],Ze=[],qe=null,Xe=0,Fe=0,Je="",He=[],window.removeEventListener("wheel",cn),window.removeEventListener("touchmove",sn),window.removeEventListener("scroll",rn),an(),window.removeEventListener("scroll",fn),hn&&(window.removeEventListener("pagehide",hn),hn=null),pn&&(document.removeEventListener("visibilitychange",pn),pn=null),un=0,ln=0,dn=!1,Tn&&(Tn=!1,document.removeEventListener("mouseenter",Dn,!0),document.removeEventListener("mouseleave",Dn,!0),document.removeEventListener("click",An,{capture:!0}),document.removeEventListener("keydown",An,{capture:!0}),document.removeEventListener("scroll",An),window.removeEventListener("resize",xn),On(),wn="",_n=0,vn=0,bn=0,gn=0,kn=0),document.removeEventListener("click",Cn,{capture:!0}),Nn=[],document.removeEventListener("click",Xn,{capture:!0}),Pn=[],zn.clear(),document.removeEventListener("click",Vn,{capture:!0}),document.removeEventListener("keydown",Wn,{capture:!0}),window.removeEventListener("popstate",Yn),Zn=null,document.removeEventListener("change",no,{capture:!0}),document.removeEventListener("click",oo,{capture:!0}),to.clear(),document.removeEventListener("copy",co,{capture:!0}),io=[],uo&&(document.removeEventListener("selectionchange",uo),uo=null),lo&&(document.removeEventListener("copy",lo,{capture:!0}),document.removeEventListener("cut",lo,{capture:!0}),lo=null),so=[],ao=0,document.removeEventListener("mousedown",nr,{capture:!0}),document.removeEventListener("click",or,{capture:!0}),er=null,Qo.clear(),(()=>{document.removeEventListener("invalid",ar,{capture:!0}),document.removeEventListener("input",ur,{capture:!0}),document.removeEventListener("change",ur,{capture:!0}),sr&&(sr.disconnect(),sr=null);for(const t of ir.values())pr(t);ir.clear()})(),bo=!1,vo=[],go=null,yo=new Map,O(null),To&&(window.removeEventListener("popstate",To),To=null),Do&&(window.removeEventListener("hashchange",Do),Do=null),xo&&(document.removeEventListener("visibilitychange",xo),xo=null),Ao&&(window.removeEventListener("pagehide",Ao),Ao=null),window.removeEventListener("popstate",Lo),window.removeEventListener("hashchange",jo),No=[],Co=!1,Ro="",window.removeEventListener("scroll",Zo),window.removeEventListener("click",Ho,{capture:!0}),Vo(),gr&&(gr.disconnect(),gr=null),br&&(br.disconnect(),br=null),kr.clear(),document.removeEventListener("input",Or,{capture:!0}),Er.clear(),document.removeEventListener("mouseover",Lr),document.removeEventListener("mouseout",jr),document.removeEventListener("click",Ir,{capture:!0}),Br(),Cr.clear(),document.removeEventListener("mouseleave",Xr),qr&&(clearTimeout(qr),qr=null),Fr&&(Fr.disconnect(),Fr=null),Jr&&(Jr.disconnect(),Jr=null),Wr(),document.removeEventListener("paste",Gr,{capture:!0}),B(),S=!1,document.removeEventListener("visibilitychange",L),window.removeEventListener("pagehide",j),y&&(clearTimeout(y),y=null),ti&&(ti(),ti=null),Qr=!1)}function ui(t,e){for(const n of e)if(n)if(n.endsWith("*")){if(t.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(t.endsWith(n.slice(1)))return!0}else if(t===n)return!0;return!1}function li(t){if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}}(()=>{try{const t=window;if(t.flusterduck)return;const e=document.currentScript;if(!e)return;const n=e.getAttribute("data-key");if(!n)return;const o={key:n,environment:e.getAttribute("data-env")||void 0,endpoint:li(e.getAttribute("data-endpoint")),debug:"true"===e.getAttribute("data-debug"),cookieless:"true"===e.getAttribute("data-cookieless"),respectDoNotTrack:"false"!==e.getAttribute("data-dnt")},r=e.getAttribute("data-dom-mode");"metadata"!==r&&"snapshot"!==r||(o.domMode=r),"off"===e.getAttribute("data-compression")&&(o.compression="off");const i=e.getAttribute("data-sample");if(i){const t=parseFloat(i);isNaN(t)||(o.sampleRate=Math.max(0,Math.min(t,1)))}const c=e.getAttribute("data-segment");if(c&&c.length<2048)try{const t=JSON.parse(c);if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.create(null);for(const n of Object.keys(t))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=String(t[n]));o.segment=e}}catch{}ni(o),t.flusterduck=Object.freeze({init:ni,signal:oi,track:ri,identify:ii,setConsent:ci,optOut:si,destroy:ai})}catch{}})()})();
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",b=[],y=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1;function O(t){E=t}var $=new Set;function U(t){S=t}var N=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),R=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),C=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),L=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,j=e(()=>{"hidden"===document.visibilityState&&P()}),I=t(()=>P());function B(t){S||b.length>=100||((t=>{if("sig"!==t.t||!$.size)return;const e="string"==typeof t.d?.s?t.d.s:"";if(e)for(const n of $)try{n(e,t.ts)}catch{}})(t),b.push(t),b.length>=T?P():y||(y=setTimeout(P,k)))}function P(){(async()=>{if(A)return;if(!b.length||!D)return;A=!0,y&&(clearTimeout(y),y=null);const t=b;b=[];const e={v:1,sid:D.sid,key:D.key,url:D.url,page:D.page,ts:Date.now(),ua:D.ua,vw:D.vw,vh:D.vh,environment:D.environment,...D.segment?{segment:D.segment}:{},dom_mode:x.domMode},n=t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":R.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=J(o.el,o.element,o.target);if("signal"===r){i.signal_type=J(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),i.signal_type&&E&&E(i.signal_type)}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=F(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=F(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})(t,D.page,x.domMode));let o=[];try{for(const t of n){const n=[...o,t];if(JSON.stringify({...e,events:n}).length>v)if(o.length>0)await q({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=v&&await q(n),o=[]}else o=n}o.length>0&&await q({...e,events:o})}catch{}finally{A=!1}})()}function z(t){if(D)for(const e of Object.keys(t))N.has(e)&&(D[e]=t[e])}async function q(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);n&&X(n,0)}function X(t,e,n=M){if(n){if(navigator.sendBeacon&&navigator.sendBeacon(n,t.beaconBody))return;try{fetch(n,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>X(t,e+1,n),1e3*(e+1))})}catch{}}}function F(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>C.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(L.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>F(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=F(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function J(...t){for(const e of t)if("string"==typeof e&&e)return e}function Z(t){return"off"===t?"off":"auto"}function H(t,e){for(const n of e){const e=W(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id"))(t)}var V=/^[a-zA-Z0-9/:._*\-]+$/;function W(t){if(t.length>200)return null;if(!V.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var Y=[".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"]'],G=[],K=3,Q=2e3,tt=24,et=[],nt=[],ot=0,rt=new Map,it=new Map,st=!1,ct=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,et))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(;G.length&&n-G[0].t>Q;)G.shift();G.push({t:n,x:o,y:r});const i=nt.length>=3?2:K;if(G.length<i)return;const s=G.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>tt*tt)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/tt*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(s,i,u),h=a(e),w=d(e);nt.push({selector:h,ts:n});const m=nt.length,_=(t=>{const e=(t-ot)/6e4;return e<=0?0:Math.round(nt.length/e*10)/10})(n),v=rt.get(h)??0,g=v+1,b=it.get(h)??0,y=b>0&&n-b<1e4;rt.set(h,g),it.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}})();B({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:y,...k??{}}}),M&&B({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}}),G=G.slice(-(i-1))});function at(){st&&(st=!1,document.removeEventListener("click",ct,{capture:!0,passive:!0}),G=[],nt=[],rt.clear(),it.clear())}var ut=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,lt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,ft=/^(A|BUTTON|LABEL)$/,dt=[],pt=null,ht=new Map,wt=e(t=>{pt={x:t.clientX,y:t.clientY}}),mt=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,dt))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!pt)return!1;const e=t.clientX-pt.x,n=t.clientY-pt.y;return Math.sqrt(e*e+n*n)>5})(t);if(pt=null,n)return;if((t=>{if(ut.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&lt.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||!ft.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=bt(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?gt(t.clientX,t.clientY,o):null,i=a(e),s=(ht.get(i)??0)+1;ht.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):"";B({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 _t(){document.removeEventListener("mousedown",wt,{capture:!0}),document.removeEventListener("click",mt,{capture:!0}),pt=null,ht.clear()}function vt(){ht.clear()}function gt(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 bt(t,e,n){return gt(t,e,n).dist}var yt=null,Mt=3e3,kt=[],Tt="click",Dt=0,xt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,At=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Et=e(t=>{const e=t.target;if(!e)return;if(p(e,kt))return;const n=e.getAttribute("role");if(!(xt.test(e.tagName)||n&&At.test(n)))return;const o=Date.now();if(o-Dt>50&&(Tt="click",Dt=o),yt){if(yt.el===e||yt.el.contains(e)){const t=o-yt.ts;return t>=Mt&&B({t:"sig",ts:o,d:{s:"speed_frustration",el:yt.selector,delay:t,interaction_type:Tt,observed_delay_ms:t}}),void Nt()}Nt()}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 Nt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void Nt()}}),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&&yt&&(yt.observer.disconnect(),yt={...yt,timeout:null})},Mt+500);yt={el:e,selector:r,ts:o,observer:s,timeout:u}}),St=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(Tt="keydown",Dt=Date.now()))}),Ot=e(()=>{Tt="touch",Dt=Date.now()});function $t(){document.removeEventListener("click",Et,{capture:!0}),document.removeEventListener("keydown",St,{capture:!0}),document.removeEventListener("touchstart",Ot,{capture:!0}),Nt()}function Ut(){Nt()}function Nt(){yt&&(yt.observer.disconnect(),yt.timeout&&clearTimeout(yt.timeout),yt=null)}var Rt=800,Ct=2e3,Lt=0,jt=0,It=0,Bt=0,Pt=0,zt=0,qt=0,Xt=0,Ft=[],Jt=0,Zt=null,Ht=e(t=>{const e=Date.now();e-Lt<16||(Lt=e,Zt&&clearTimeout(Zt),Zt=setTimeout(()=>Wt(),150),((t,e,n)=>{if(0===Bt)return jt=t,It=e,Bt=n,void(Xt=n);const o=(n-Bt)/1e3;if(0===o)return;const r=t-jt,i=e-It;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i),c=s/o;Ft.length>=100&&(Ft=Ft.slice(-50)),Ft.push(c),Jt+=s;const a=Math.sign(r),u=Math.sign(i);if(s>=5&&(0!==Pt&&0!==a&&a!==Pt||0!==zt&&0!==u&&u!==zt)&&qt++,Pt=a||Pt,zt=u||zt,jt=t,It=e,Bt=n,n-Xt>Ct){if(qt>=3){const t=Ft.reduce((t,e)=>t+e,0)/Ft.length;t>=Rt&&B({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:qt,distance_px:Math.round(Jt)}})}Wt(),Xt=n}})(t.clientX,t.clientY,e))});function Vt(){document.removeEventListener("mousemove",Ht),Zt&&clearTimeout(Zt),Wt()}function Wt(){qt=0,Ft=[],Jt=0,Pt=0,zt=0,Bt=0,jt=0,It=0,Lt=0,Zt=null}var Yt=[],Gt=[],Kt=3e4;function Qt(){Yt=[],Gt=[]}var te=1e4,ee=.5,ne=[],oe=0,re=0,ie=!1,se=0,ce=e(()=>{ie||(ie=!0,requestAnimationFrame(()=>{ie=!1,(()=>{const t=Date.now(),e=window.scrollY;if((se=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/se,o=e>oe?"down":"up";if(t-re<100)return void(oe=e);for(;ne.length&&t-ne[0].ts>te;)ne.shift();ne.length>=100&&(ne=ne.slice(-50)),ne.push({depth:n,ts:t,direction:o}),oe=e,re=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<ne.length;t++)ne[t].direction!==ne[t-1].direction&&d++;for(let t=0;t<ne.length;t++){const e=ne[t],n=e.depth;if(n>r&&(r=n),n>=ee&&(c||(a=e.ts,l=n),c=!0),c&&n<i&&(i=n,u=e.ts,f=n),c&&i<.25&&n>=ee){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);B({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1,vel:o,dir_changes:d}}),ne=[]}})()}))});function ae(t){te=t?.windowMs??1e4,ee=t?.depthThreshold??.5,window.addEventListener("scroll",ce,{passive:!0})}function ue(){window.removeEventListener("scroll",ce),ne=[],ie=!1}function le(){ne=[],oe=0,re=0,ie=!1}var fe=["textarea",'[role="textbox"]',"[contenteditable]"],de=new Map,pe=new Map,he=new Set,we=null,me=0,_e=5e3,ve=[],ge=e(t=>{const e=t.target;if(!e||!Ae(e))return;if(p(e,ve))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of fe)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();de.set(e,n),pe.set(e,n);const o=e.closest("form");o&&o!==we&&(we=o,me=o.querySelectorAll("input, select, textarea").length)}),be=e(t=>{const e=t.target;if(!e||!Ae(e))return;const n=de.get(e),o=pe.get(e);de.delete(e),pe.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=_e){const n=d(e);B({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)&&he.add(i)}),ye=e(()=>{he.clear(),we=null}),Me=t(xe),ke=null;function Te(){document.removeEventListener("focusin",ge,{capture:!0}),document.removeEventListener("focusout",be,{capture:!0}),document.removeEventListener("submit",ye,{capture:!0}),window.removeEventListener("pagehide",Me),ke&&(document.removeEventListener("visibilitychange",ke),ke=null),de.clear(),pe.clear(),he.clear(),we=null}function De(){de.clear(),pe.clear(),he.clear(),we=null,me=0}function xe(){if(he.size>0&&we){const t=me||he.size,e=Math.round(he.size/t*100)/100;B({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:he.size,total:t,field_count:t,completion_rate:e}}),he.clear(),we=null}}function Ae(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var Ee=null,Se=null,Oe=/flusterduck\.com|\/v1\/ingest/,$e=e(t=>{const e=t.message||"Unknown error";var n;B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Ie(e,200),ep:"",status:0,error_category:(n=e,Ce.test(n)?"network":"script"),url:location.pathname}})}),Ue=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Ie(e,200),ep:"",status:0,error_category:Le(t.reason),url:location.pathname}})});function Ne(){window.addEventListener("error",$e),window.addEventListener("unhandledrejection",Ue),Ee||(Ee=window.fetch,Se=function(t,e){let n;try{n=Ee.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;Oe.test(n)||B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:je(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;Oe.test(n)||B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Ie(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?je(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=Se)}function Re(){window.removeEventListener("error",$e),window.removeEventListener("unhandledrejection",Ue),Ee&&Se&&window.fetch===Se&&(window.fetch=Ee),Ee=null,Se=null}var Ce=/fetch|network|cors|timeout/i;function Le(t){if(t instanceof TypeError&&Ce.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return Ce.test(e)?"network":"unhandled_promise"}function je(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 Ie(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 Be=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Pe=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ze=null,qe=0,Xe=1,Fe=0,Je=0,Ze=0,He=0,Ve=0,We=null,Ye=[],Ge=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(ze={x:e.clientX,y:e.clientY,ts:Date.now()},qe=0):2===t.touches.length&&(qe=on(t.touches),ze=null)}),Ke=e(t=>{if(qe>0){const e=t.touches.length>=2?on(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&&(Xe=Math.round(e/qe*100)/100),qe=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,Ye))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)}`;B({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(Be.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!Be.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";B({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),ze=null}),Qe=e(()=>{const t=Date.now();if(t-Je>3e4&&(Fe=0,Je=t),++Fe>=2){const e=document.activeElement||document.body;!Pe.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Ze>200&&(Ze=t,B({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Fe,pinch_scale:Xe}})),Fe=0,Xe=1}}),tn=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ve>3e4&&(He=0,Ve=t),e!==We&&(He++,We=e),He>=3&&(B({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:He,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),He=0)}),en=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Je>3e4&&(Fe=0,Je=e),++Fe>=2&&e-Ze>200){const n=Math.round(100*t.scale)/100;Ze=e,B({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:Fe,pinch_scale:n}}),Fe=0,Xe=1}}});function nn(){document.removeEventListener("touchstart",Ge),document.removeEventListener("touchend",Ke),document.removeEventListener("gesturechange",Qe),window.removeEventListener("orientationchange",tn),window.visualViewport?.removeEventListener("resize",en),ze=null,qe=0,Xe=1,Fe=0,Je=0,Ze=0,He=0,Ve=0,We=null}function on(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 rn=[],sn=null,cn=0,an=0,un="",ln=[],fn=[],dn=e(t=>{const e=Date.now(),n=t.target;n&&p(n,fn)||("Tab"===t.key?((t,e,n)=>{for(;rn.length&&t-rn[0].ts>5e3;)rn.shift();rn.length>=50&&(rn=rn.slice(-25));const o=e?a(e):"";if(rn.push({ts:t,el:o,shift:n}),rn.length>=10){const e=rn.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})(rn);B({t:"sig",ts:t,d:{s:"tab_thrash",cnt:rn.length,els:e,direction_changes:n}}),rn=[]}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===sn?t-an<=3e3?(cn++,un=n,cn>=5&&(B({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:cn,trapped_element:un}}),cn=0,un="",sn=null)):(an=t,cn=1,un=n):(sn=r,an=t,cn=1,un=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===sn){if(t-an>3e3)return an=t,cn=1,void(un=a(e));cn++,un=a(e),cn>=5&&(B({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:cn,trapped_element:un}}),cn=0,un="",sn=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(;ln.length&&t-ln[0].ts>5e3;)ln.shift();ln.length>=50&&(ln=ln.slice(-25)),ln.push({ts:t,container:n});const o=ln.filter(t=>t.container===n);o.length>=15&&(B({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),ln=[])})(e,t.target))});function pn(){document.removeEventListener("keydown",dn,{capture:!0}),rn=[],ln=[],sn=null,cn=0,an=0,un="",fn=[]}var hn=0,wn=0,mn=null,_n=0,vn=!1,gn=0,bn=0,yn=null,Mn=0,kn=e(()=>{vn||(vn=!0,requestAnimationFrame(()=>{vn=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-wn;if(Math.abs(n)<2)return void(wn=e);const o=n>0?"down":"up";mn&&o!==mn&&(t-_n>3e3&&(hn=0,_n=t),++hn>=4)&&Math.abs(n)>100&&(t-bn>1e4&&(gn=0,bn=t),gn++,B({t:"sig",ts:t,d:{s:"scroll_hijack",rev:hn,source:null!==yn&&t-Mn<=2e3?yn:"wheel",repeated:gn>=2}}),hn=0),mn=o,wn=e})()}))}),Tn=e(()=>{yn="wheel",Mn=Date.now()}),Dn=e(()=>{yn="touch",Mn=Date.now()});function xn(){window.addEventListener("wheel",Tn,{passive:!0}),window.addEventListener("touchmove",Dn,{passive:!0}),window.addEventListener("scroll",kn,{passive:!0})}function An(){window.removeEventListener("wheel",Tn),window.removeEventListener("touchmove",Dn),window.removeEventListener("scroll",kn),En()}function En(){hn=0,wn=0,mn=null,_n=0,vn=!1,gn=0,bn=0,yn=null,Mn=0}var Sn=0,On=0,$n=!1,Un=e(()=>{$n||($n=!0,requestAnimationFrame(()=>{$n=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Sn&&(Sn=e,0===On&&(On=Date.now()))}}))}),Nn=null,Rn=null;function Cn(){window.addEventListener("scroll",Un,{passive:!0}),Rn=t(In),window.addEventListener("pagehide",Rn),Nn=t(()=>{"hidden"===document.visibilityState&&In()}),document.addEventListener("visibilitychange",Nn)}function Ln(){window.removeEventListener("scroll",Un),Rn&&(window.removeEventListener("pagehide",Rn),Rn=null),Nn&&(document.removeEventListener("visibilitychange",Nn),Nn=null),Sn=0,On=0,$n=!1}function jn(){Sn=0,On=0,$n=!1}function In(){if(Sn>.05){const t=Date.now(),e=On>0?Math.max(0,t-On):0;B({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*Sn)/100,max_depth:Math.round(100*Sn),dwell_ms:e}})}}var Bn="",Pn=0,zn=0,qn=0,Xn=0,Fn=0,Jn=null,Zn=0,Hn=!1,Vn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==Bn||o-zn>1500)&&(Bn=n,zn=o,Pn=0),(Pn+=1)<4||(B({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Pn,window_ms:1500}}),Pn=0,zn=o)}),Wn=e(()=>{const t=Date.now(),e=to(),n=Fn||e,o=Math.abs(e-n)/Math.max(n,1);Fn=e,o<.15||((!qn||t-qn>5e3)&&(qn=t,Xn=0),(Xn+=1)<3||(B({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Xn,area_delta:Math.round(1e3*o)/1e3}}),Xn=0,qn=t))}),Yn=e(()=>{Qn()});function Gn(){Hn||(Hn=!0,Fn=to(),Qn(),document.addEventListener("mouseenter",Vn,!0),document.addEventListener("mouseleave",Vn,!0),document.addEventListener("click",Yn,{capture:!0,passive:!0}),document.addEventListener("keydown",Yn,{capture:!0,passive:!0}),document.addEventListener("scroll",Yn,{passive:!0}),window.addEventListener("resize",Wn,{passive:!0}))}function Kn(){Hn&&(Hn=!1,document.removeEventListener("mouseenter",Vn,!0),document.removeEventListener("mouseleave",Vn,!0),document.removeEventListener("click",Yn,{capture:!0}),document.removeEventListener("keydown",Yn,{capture:!0}),document.removeEventListener("scroll",Yn),window.removeEventListener("resize",Wn),eo(),Bn="",Pn=0,zn=0,Xn=0,qn=0,Zn=0)}function Qn(){eo();const t=Zn+=1;Jn=setTimeout(()=>{B({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function to(){return Math.max(1,window.innerWidth*window.innerHeight)}function eo(){Jn&&(clearTimeout(Jn),Jn=null)}var no=["[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"]'],oo=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,ro=[],io=[],so=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,io))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(uo(e))return!0;if(lo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;ro.length&&n-ro[0].t>6e4;)ro.shift();const o=a(e);if(ro.push({t:n,el:o}),ro.length<3)return;const r=new Set(ro.map(t=>t.el)).size,i=d(e);B({t:"sig",ts:n,d:{s:"help_hunt",cnt:ro.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),ro=[]});function co(){document.removeEventListener("click",so,{capture:!0}),ro=[]}function ao(){ro=[]}function uo(t){for(const e of no)try{if(t.matches(e))return!0}catch{}return!1}function lo(t){const e=t.id??"",n=t.className??"";return oo.test("string"==typeof n?`${e} ${n}`:e)}var fo=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,po=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,ho=[],wo=new Map,mo=[],_o=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,mo))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(bo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=d(e);ho.push({t:n,el:o});const i=(wo.get(o)??0)+1;wo.set(o,i);const s=ho.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}})();B({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:s,element_cnt:i,repeated:i>1,container:yo(e),...c??{}}})});function vo(){document.removeEventListener("click",_o,{capture:!0}),ho=[],wo.clear()}function go(){ho=[],wo.clear()}function bo(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&&po.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(fo.test(t.id??"")||fo.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&po.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 yo(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 Mo=null,ko=[],To=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,ko)||(Mo=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:d(e),t:Date.now()}))}),Do=e(t=>{"Escape"===t.key&&So("escape")}),xo=e(()=>{So("back_nav")});function Ao(){document.removeEventListener("click",To,{capture:!0}),document.removeEventListener("keydown",Do,{capture:!0}),window.removeEventListener("popstate",xo),Mo=null}function Eo(){Mo=null}function So(t){if(!Mo)return;const e=Date.now()-Mo.t;e>1500||B({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Mo.el,...Mo.label?{el_label:Mo.label}:{},elapsed_ms:e}}),Mo=null}var Oo=/^(checkbox|radio)$/,$o=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Uo=new Map,No=[],Ro=e(t=>{const e=t.target;e&&(p(e,No)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Oo.test(t.type??""):$o.test(t.getAttribute("role")??"")))(e)&&Io(e))}),Co=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,No))return;const n=e.getAttribute("role")??"";$o.test(n)&&"INPUT"!==e.tagName&&Io(e)});function Lo(){document.removeEventListener("change",Ro,{capture:!0}),document.removeEventListener("click",Co,{capture:!0}),Uo.clear()}function jo(){Uo.clear()}function Io(t){const e=a(t),n=Date.now();let o=Uo.get(e);for(o||(o=[],Uo.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);B({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),Uo.delete(e)}var Bo=[],Po=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(;Bo.length&&o-Bo[0].t>15e3;)Bo.shift();Bo.push({t:o}),Bo.length<3||(B({t:"sig",ts:o,d:{s:"copy_frustration",cnt:Bo.length,window_ms:15e3}}),Bo=[])});function zo(){document.addEventListener("copy",Po,{capture:!0,passive:!0})}function qo(){document.removeEventListener("copy",Po,{capture:!0}),Bo=[]}function Xo(){Bo=[]}var Fo=[],Jo=0,Zo=null,Ho=null;function Vo(){Zo=t(Ko),Ho=t(Go),document.addEventListener("selectionchange",Zo),document.addEventListener("copy",Ho,{capture:!0,passive:!0}),document.addEventListener("cut",Ho,{capture:!0,passive:!0})}function Wo(){Zo&&(document.removeEventListener("selectionchange",Zo),Zo=null),Ho&&(document.removeEventListener("copy",Ho,{capture:!0}),document.removeEventListener("cut",Ho,{capture:!0}),Ho=null),Fo=[],Jo=0}function Yo(){Fo=[],Jo=0}function Go(){Jo=Date.now(),Fo=[]}function Ko(){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-Jo<2e3)return;for(;Fo.length&&n-Fo[0].t>15e3;)Fo.shift();const o=Fo[Fo.length-1];o&&n-o.t<500||(Fo.push({t:n}),Fo.length<4||(B({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:Fo.length,window_ms:15e3}}),Fo=[]))}var Qo=6e4,tr="_fd_sess",er={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},nr={low:1,medium:2,high:3,critical:4},or=[],rr=null,ir=!1,sr=new Map,cr={totalSignals:0,pagesWithFrustration:0},ar="",ur=null,lr=null,fr=null,dr=null;function pr(t){ir&&hr(t,Date.now())}function hr(t,e){sr.has(t)||sr.set(t,[]);const n=sr.get(t);n.push(e),n.length>20&&n.shift()}function wr(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 mr(t){if(!ir)return;if("frustration_burst"===t)return;const e=Date.now();(t=>{const e=t-Qo;let n=0;for(;n<or.length&&or[n].ts<e;)n++;n>0&&(or=or.slice(n))})(e),0===or.length&&(rr=null),or.push({type:t,ts:e}),hr(t,e);const{distinctTypes:n,totalWeight:o,typeCounts:r}=(()=>{const t=new Map;let e=0;for(const n of or)t.set(n.type,(t.get(n.type)??0)+1),e+=er[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),i=((t,e,n)=>wr(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(n.size,o,r);i&&(null!==rr&&nr[i]<=nr[rr]||(rr=i,((t,e,n,o)=>{const r=wr(o),i=(()=>{const t=[],e=Date.now()-Qo,n=[];for(const[t,o]of sr.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})();B({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:ar||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:Qo,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:cr.totalSignals,session_pages_with_frustration:cr.pagesWithFrustration}}),cr.totalSignals+=or.length,cr.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(tr,JSON.stringify(cr))}catch{}})()})(i,n,o,r)))}function _r(){ir=!1,or=[],rr=null,sr=new Map,O(null),ur&&(window.removeEventListener("popstate",ur),ur=null),lr&&(window.removeEventListener("hashchange",lr),lr=null),fr&&(document.removeEventListener("visibilitychange",fr),fr=null),dr&&(window.removeEventListener("pagehide",dr),dr=null)}var vr=3e4,gr=[],br="",yr=!1,Mr=e(()=>{Ar(location.pathname+location.search+location.hash)}),kr=e(()=>{Ar(location.pathname+location.search+location.hash)});function Tr(){gr=[],yr=!1,br=location.pathname+location.search+location.hash,window.addEventListener("popstate",Mr),window.addEventListener("hashchange",kr)}function Dr(){window.removeEventListener("popstate",Mr),window.removeEventListener("hashchange",kr),gr=[],yr=!1,br=""}function xr(){gr=[],yr=!1,br=location.pathname+location.search+location.hash}function Ar(t){const e=Date.now();if(br&&br!==t){const t=gr[gr.length-1];t&&t.path===br&&null===t.leftAt&&(t.leftAt=e)}for(;gr.length&&e-gr[0].ts>vr;)gr.shift();t!==br&&(gr.push({path:t,ts:e,leftAt:null}),br=t),gr.length<5||yr||(t=>{const e=gr.filter(e=>t-e.ts<=vr),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);yr=!0,B({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:vr,avg_dwell_ms:i,pages:c,max_dwell_ms:s}})})(e)}var Er=[],Sr=!1,Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Cr=e(()=>{Sr||(Sr=!0,requestAnimationFrame(Pr))}),Lr=e(t=>{if(!Rr)return;const e=Date.now();if(e-Nr>3e3)return void(Rr=!1);if(window.scrollY+t.clientY>Ur+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round($r-Ur),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,s=i?a(i):"",c=i?d(i):"";Rr=!1,$r=window.scrollY,Or="none",Er=[],B({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 jr(){Er=[],Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Sr=!1,window.addEventListener("scroll",Cr,{passive:!0}),window.addEventListener("click",Lr,{capture:!0})}function Ir(){window.removeEventListener("scroll",Cr),window.removeEventListener("click",Lr,{capture:!0}),Br()}function Br(){Er=[],Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Sr=!1}function Pr(){Sr=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Er[Er.length-1];if(o&&t-o.ts<50)return;if(Er.push({y:e,ts:t}),Er.length>60&&(Er=Er.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==Or&&Rr&&(Rr=!1),e>$r&&($r=e),void(Or="down");Rr&&t-Nr>3e3&&(Rr=!1),"down"===Or&&$r-e>=.3*n&&!Rr&&(Ur=e,Nr=t,Rr=!0),Or="up"}}var zr=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,qr=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Xr=/^(A|BUTTON|LABEL)$/,Fr=new Map,Jr=[],Zr=null,Hr=e(t=>{Zr={x:t.clientX,y:t.clientY}}),Vr=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,Jr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Zr)return!1;const e=t.clientX-Zr.x,n=t.clientY-Zr.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&&qr.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||!Xr.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=(Fr.get(r)??[]).filter(t=>i-t.ts<9e4);if(c.push({ts:i,selector:s}),Fr.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""}})();B({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}}),Fr.set(r,[])}});function Wr(){document.removeEventListener("mousedown",Hr,{capture:!0}),document.removeEventListener("click",Vr,{capture:!0}),Zr=null,Fr.clear()}function Yr(){Fr.clear()}var Gr=12e4,Kr=new Map,Qr=[],ti=null,ei=e(t=>{const e=t.target;e&&li(e)}),ni=e(t=>{const e=t.target;if(!e||!ci(e))return;if(p(e,Qr))return;const n=a(e);Kr.has(n)||si(e)&&ui(e,n)});function oi(){document.removeEventListener("invalid",ei,{capture:!0}),document.removeEventListener("input",ni,{capture:!0}),document.removeEventListener("change",ni,{capture:!0}),ti&&(ti.disconnect(),ti=null);for(const t of Kr.values())ai(t);Kr.clear()}function ri(){for(const t of Kr.values())ai(t);Kr.clear()}function ii(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function si(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 ci(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function ai(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function ui(t,n){const o=(t=>e(e=>{di(t)}))(n),r=(t=>e(e=>{di(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 Kr.set(n,i),i}function li(t){if(!ci(t))return;if(p(t,Qr))return;const e=Date.now();(t=>{for(const[e,n]of Kr)t-n.lastTs>Gr&&(ai(n),Kr.delete(e))})(e);const n=a(t),o=Kr.get(n);if(!o)return void ui(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:Gr,field_type:ii(t)}}),ai(o),Kr.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:Gr,field_type:ii(t)}}),ai(o),Kr.delete(n)))}function fi(t){if(!ci(t))return;const e=Date.now(),n=a(t),o=Kr.get(n);return o?e-o.lastTs>Gr?(ai(o),void Kr.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function di(t){const e=Date.now(),n=Kr.get(t);if(n){if(e-n.lastTs>Gr)return ai(n),void Kr.delete(t);if(n.lastTs=e,si(n.el))return n.cycles+=1,void(n.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...d(n.el)?{el_label:d(n.el)}:{},cycles:n.cycles,window_ms:Gr,field_type:ii(n.el)}}),ai(n),Kr.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function pi(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!ci(t))continue;if(p(t,Qr))continue;const n=e.oldValue,o="true"===n||""===n,r=si(t);r&&!o?li(t):!r&&o&&fi(t)}}var hi=null,wi=null,mi=[],_i=0,vi=new Map;function gi(){hi&&(hi.disconnect(),hi=null),wi&&(wi.disconnect(),wi=null),vi.clear()}function bi(){vi.clear(),hi&&yi()}function yi(){for(const t of mi)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Mi(e[t])}catch{}}function Mi(t){vi.has(t)||(vi.set(t,{firstSeenTs:0,emitted:!1}),hi.observe(t))}function ki(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 mi)try{n.matches(t)&&Mi(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Mi(e[t])}catch{}}}function Ti(t){const e=Date.now();for(const n of t){const t=vi.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);B({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-_i),viewport_position:i}})}}}var Di=new Map,xi=[],Ai=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,xi))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Di.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 B({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:Oi(e)}}),void Di.delete(r)}i.lastValue=o}else Di.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function Ei(){document.removeEventListener("input",Ai,{capture:!0}),Di.clear()}function Si(){Di.clear()}function Oi(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var $i=null,Ui=2e3,Ni=[],Ri=new Map,Ci=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Ni))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($i?.selector===n)return;Pi();const o=Date.now();if(o-(Ri.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=d(e);Ri.set(n,t),$i=null,B({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Ui);$i={el:e,selector:n,startTs:r,timer:i}}),Li=e(t=>{if(!$i)return;const e=t.target;if(e!==$i.el&&!$i.el.contains(e))return;const n=t.relatedTarget;n&&$i.el.contains(n)||Pi()}),ji=e(Pi);function Ii(){document.removeEventListener("mouseover",Ci),document.removeEventListener("mouseout",Li),document.removeEventListener("click",ji,{capture:!0}),Pi(),Ri.clear()}function Bi(){Pi(),Ri.clear()}function Pi(){$i&&(clearTimeout($i.timer),$i=null)}var zi=0,qi=0,Xi=null,Fi=t(e=>{if(e.clientY>20)return;const n=Date.now();n-zi<3e3||n-qi<6e4||(Xi&&clearTimeout(Xi),Xi=setTimeout(t(()=>{const t=Date.now();qi=t,Xi=null,B({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-zi)}})}),500))});function Ji(){zi=Date.now(),qi=0,document.addEventListener("mouseleave",Fi)}function Zi(){document.removeEventListener("mouseleave",Fi),Xi&&(clearTimeout(Xi),Xi=null)}function Hi(){zi=Date.now(),qi=0,Xi&&(clearTimeout(Xi),Xi=null)}var Vi=null,Wi=null,Yi=null,Gi=0;function Ki(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function Qi(){if("undefined"!=typeof PerformanceObserver){try{(Vi=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);B({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Ki(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Vi=null}try{(Wi=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||B({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:Ki(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Wi=null}try{(Yi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Gi+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Yi=null}}}function ts(){if(Yi){if(Yi.disconnect(),Yi=null,Gi>0){const t=Math.round(1e3*Gi)/1e3;B({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:Ki(Gi,.1,.25)}})}Gi=0}}function es(){Vi&&(Vi.disconnect(),Vi=null),Wi&&(Wi.disconnect(),Wi=null),ts()}function ns(){if(ts(),"undefined"!=typeof PerformanceObserver)try{(Yi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Gi+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Yi=null}}var os=[],rs=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,os))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=d(e);B({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:ss(e)}})},100)});function is(){document.removeEventListener("paste",rs,{capture:!0})}function ss(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var cs=!1,as=null,us=null,ls="__flusterduck_instance__",fs=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,ds=[];function ps(e){if(cs)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(us=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(us=e);if(!(()=>{const t=window;return!(t[ls]&&t[ls]!==fs||(t[ls]=fs,0))})())return void(us=e);us=e,cs=!0;const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return s(n,r,30),r})(e.cookieless??!1),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=H(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:Z(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.addEventListener("visibilitychange",j),window.addEventListener("pagehide",I)})(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=bs(location.pathname,e.ignorePages??[]);f&&U(!0);const d=document.referrer;let p="";if(d)try{p=new URL(d).origin+new URL(d).pathname}catch{p=""}f||B({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[];ds=[];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)=>{st||(st=!0,K=t?.threshold??3,Q=t?.windowMs??2e3,tt=t?.radius&&t.radius>0?t.radius:24,et=[...Y,...e??[]],ot=Date.now(),G=[],nt=[],rt.clear(),it.clear(),document.addEventListener("click",ct,{capture:!0,passive:!0}))})(e.signals?.rageClick,n),stop:at},{when:()=>r("deadClick"),start:()=>(t=>{dt=t??[],document.addEventListener("mousedown",wt,{capture:!0,passive:!0}),document.addEventListener("click",mt,{capture:!0,passive:!0})})(n),stop:_t,reset:vt},{when:()=>r("speedFrustration"),start:()=>{const t=e.signals?.speedFrustration;((t,e)=>{Mt=t?.delayMs??3e3,kt=e??[],document.addEventListener("click",Et,{capture:!0,passive:!0}),document.addEventListener("keydown",St,{capture:!0,passive:!0}),document.addEventListener("touchstart",Ot,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,n)},stop:$t,reset:Ut},{when:()=>!1!==e.trackMouse&&r("thrashCursor"),start:()=>{const t=e.signals?.thrashCursor;var n;n=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,Rt=n?.velocityThreshold??800,Ct=n?.windowMs??2e3,document.addEventListener("mousemove",Ht,{passive:!0})},stop:Vt},{when:()=>r("loopNav"),start:()=>{return t=e.signals?.loopNav,void(Kt=t?.windowMs??3e4);var t},stop:Qt},{when:()=>r("scrollBounce"),start:ae,stop:ue,reset:le},{when:()=>i&&(r("formHesitation")||r("formAbandon")),start:()=>{const o=e.signals?.formHesitation;((e,n)=>{_e=e?.pauseMs??5e3,ve=n??[],document.addEventListener("focusin",ge,{capture:!0,passive:!0}),document.addEventListener("focusout",be,{capture:!0,passive:!0}),document.addEventListener("submit",ye,{capture:!0,passive:!0}),window.addEventListener("pagehide",Me),ke=t(()=>{"hidden"===document.visibilityState&&xe()}),document.addEventListener("visibilitychange",ke)})(o?{pauseMs:o.threshold}:void 0,n)},stop:Te,reset:De},{when:()=>i&&r("formValidationLoop"),start:()=>(t=>{Qr=t??[],document.addEventListener("invalid",ei,{capture:!0,passive:!0}),document.addEventListener("input",ni,{capture:!0,passive:!0}),document.addEventListener("change",ni,{capture:!0,passive:!0}),(ti=new MutationObserver(pi)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(n),stop:oi,reset:ri},{when:()=>r("errorEncounter"),start:Ne,stop:Re},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>(t=>{Ye=t??[],document.addEventListener("touchstart",Ge,{passive:!0}),document.addEventListener("touchend",Ke,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Qe,{passive:!0}),window.addEventListener("orientationchange",tn,{passive:!0})),window.visualViewport?.addEventListener("resize",en)})(n),stop:nn},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>(t=>{fn=t??[],document.addEventListener("keydown",dn,{capture:!0,passive:!0})})(n),stop:pn},{when:()=>r("scrollHijack"),start:xn,stop:An,reset:En},{when:()=>r("scrollDepthAbandon"),start:Cn,stop:Ln,reset:jn},{when:()=>r("advancedHeuristics"),start:Gn,stop:Kn,reset:()=>{Qn(),Zn=0}},{when:()=>r("helpHunt"),start:()=>(t=>{io=t??[],document.addEventListener("click",so,{capture:!0,passive:!0})})(n),stop:co,reset:ao},{when:()=>r("closeClick"),start:()=>(t=>{mo=t??[],document.addEventListener("click",_o,{capture:!0,passive:!0})})(n),stop:vo,reset:go},{when:()=>r("closeClickReversal"),start:()=>(t=>{ko=t??[],document.addEventListener("click",To,{capture:!0,passive:!0}),document.addEventListener("keydown",Do,{capture:!0,passive:!0}),window.addEventListener("popstate",xo)})(n),stop:Ao,reset:Eo},{when:()=>r("filterSpiral"),start:()=>(t=>{No=t??[],document.addEventListener("change",Ro,{capture:!0,passive:!0}),document.addEventListener("click",Co,{capture:!0,passive:!0})})(n),stop:Lo,reset:jo},{when:()=>r("copyFrustration"),start:zo,stop:qo,reset:Xo},{when:()=>r("textSelectFrustration"),start:Vo,stop:Wo,reset:Yo},{when:()=>r("deadClickTrapZone"),start:()=>(t=>{Jr=t??[],document.addEventListener("mousedown",Hr,{capture:!0,passive:!0}),document.addEventListener("click",Vr,{capture:!0,passive:!0})})(n),stop:Wr,reset:Yr},{when:()=>!0,start:()=>(t=>{or=[],rr=null,ir=!0,sr=new Map,ar=t??"",(()=>{try{const t=sessionStorage.getItem(tr);if(t){const e=JSON.parse(t);cr={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),O(mr),ur=()=>pr("popstate"),lr=()=>pr("hashchange"),fr=()=>{"hidden"===document.visibilityState&&pr("visibilitychange")},dr=()=>pr("pagehide"),window.addEventListener("popstate",ur),window.addEventListener("hashchange",lr),document.addEventListener("visibilitychange",fr),window.addEventListener("pagehide",dr)})(o),stop:_r},{when:()=>r("navigationConfusion"),start:Tr,stop:Dr,reset:xr},{when:()=>r("scrollToClickConfusion"),start:jr,stop:Ir,reset:Br},{when:()=>r("elementImpression"),start:()=>{return n=e.elementImpressionSelectors,mi=n?.length?n:["[data-fd-impression]"],_i=Date.now(),void("undefined"!=typeof IntersectionObserver&&(hi=new IntersectionObserver(t(Ti),{threshold:[0,.5,1]}),yi(),(wi=new MutationObserver(t(ki))).observe(document.body,{childList:!0,subtree:!0})));var n},stop:gi,reset:bi},{when:()=>i&&r("inputCorrection"),start:()=>(t=>{xi=t??[],document.addEventListener("input",Ai,{capture:!0,passive:!0})})(n),stop:Ei,reset:Si},{when:()=>i&&r("pasteBlocked"),start:()=>(t=>{os=t??[],document.addEventListener("paste",rs,{capture:!0,passive:!0})})(n),stop:is},{when:()=>r("hoverDwell"),start:()=>{const t=e.signals?.hoverDwell;((t,e)=>{Ui=t?.dwellMs??2e3,Ni=e??[],document.addEventListener("mouseover",Ci,{passive:!0}),document.addEventListener("mouseout",Li,{passive:!0}),document.addEventListener("click",ji,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,n)},stop:Ii,reset:Bi},{when:()=>r("exitIntent"),start:Ji,stop:Zi,reset:Hi},{when:()=>r("performanceVitals"),start:Qi,stop:es,reset:ns}]}(e,h,a))n.when()&&(n.start(),ds.push({stop:n.stop,reset:n.reset}));as=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)=>{P();for(const t of ds)t.reset?.();Ar(n),(t=>{ar=t})(n);const o=H(n,e.pageRules??[]),r=bs(n,e.ignorePages??[]);U(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(;Yt.length&&e-Yt[0].ts>Kt;)Yt.shift();for(;Gt.length&&e-Gt[0].ts>Kt;)Gt.shift();if(Yt.length>=100&&(Yt=Yt.slice(-50)),Gt.length>=100&&(Gt=Gt.slice(-50)),Yt.push({path:t,ts:e}),r){Gt.push({path:t,ts:e});const n=Gt.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 B({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(Gt=Gt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(Yt.length<4)return;let i=!1;const s=[];for(let e=0;e<Yt.length-1;e++)if(Yt[e].path===t){const t=Yt.slice(e,Yt.length),n=new Set(t.map(t=>t.path));if(n.size>=2){s.push(...Array.from(n)),i=!0;break}}i&&(B({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:Yt.slice(-5).map(t=>t.path)}}),Yt=[{path:t,ts:e}],Gt=Gt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(n),r||B({t:"pv",ts:Date.now(),d:{ref:""}})}))}function hs(t,e){if(!cs)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);B({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 ws(t,e={}){if(!cs)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||B({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ms(t){if(!cs)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++)}z({segment:e})}function _s(t){t&&us&&!cs?ps(us):t||(gs(),r())}function vs(){gs(),r()}function gs(){if(cs){for(const t of ds)t.stop();ds=[],P(),S=!1,document.removeEventListener("visibilitychange",j),window.removeEventListener("pagehide",I),y&&(clearTimeout(y),y=null),as&&(as(),as=null),(()=>{const t=window;t[ls]===fs&&delete t[ls]})(),cs=!1}}function bs(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 ys(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:ys(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{}ps(o),t.flusterduck=Object.freeze({init:ps,signal:hs,track:ws,identify:ms,setConsent:_s,optOut:vs,destroy:gs})}catch{}})()})();
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var an=Object.defineProperty;var Zs=Object.getOwnPropertyDescriptor;var Qs=Object.getOwnPropertyNames;var Js=Object.prototype.hasOwnProperty;var ea=(e,t)=>{for(var n in t)an(e,n,{get:t[n],enumerable:!0})},ta=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qs(t))!Js.call(e,r)&&r!==n&&an(e,r,{get:()=>t[r],enumerable:!(o=Zs(t,r))||o.enumerable});return e};var na=e=>ta(an({},"__esModule",{value:!0}),e);var td={};ea(td,{destroy:()=>on,identify:()=>Ys,init:()=>Tr,optOut:()=>$s,setConsent:()=>js,signal:()=>zs,track:()=>Xs});module.exports=na(td);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var ln="_fd_s";var oa=/^[0-9a-f]{32}$/;function Mr(e){if(e)return xr();let t=ra(ln);if(t&&oa.test(t))return t;let n=xr();return Ar(ln,n,30),n}function cn(){Ar(ln,"",-1)}function xr(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function ra(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Ar(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var ia=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${De(t)}"]`;if(e.id&&!ia.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,sa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,aa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!aa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!sa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Rr(e,t){if(t==="off")return null;if(t==="metadata")return la(e);let n=ca(e);return n?{mode:"snapshot",...n}:null}function la(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:Dr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Dr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:ua(e)}}}function ca(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:fa(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?p(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:da(t),animations:i,siblings:r}}catch{return null}}function Dr(e,t){return e&&t.includes(e)?e:null}function ua(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function da(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function fa(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Or=7e3,pa=500,ma=1e4,Nr=50,Pr=100,ga=3,Ie=6e4,bt="application/json",ha="application/json; encoding=gzip",ae=[],$=null,Hr="",Fr=Or,Br=Nr,_=null,yt={domMode:"off",compression:"auto"},un=!1,fn=null,pn=!1;function mn(e){fn=e}function gn(e){pn=e}var va=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Ea=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),wa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ba(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>wa.has(n))}var ya=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Vr=f(_a),qr=y(()=>J());function Wr(e,t,n,o,r){Hr=e,_=Object.assign(Object.create(null),t),yt={domMode:Da(r?.domMode),compression:Ra(r?.compression)},Fr=Math.max(pa,Math.min(n??Or,ma)),Br=Math.max(1,Math.min(o??Nr,Pr)),document.addEventListener("visibilitychange",Vr),window.addEventListener("pagehide",qr)}function d(e){pn||ae.length>=Pr||(ae.push(e),ae.length>=Br?J():$||($=setTimeout(J,Fr)))}function J(){Sa()}async function Sa(){if(un||!ae.length||!_)return;un=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:yt.domMode},n=e.map(r=>ka(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await dn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await dn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await dn({...t,events:o})}catch{}finally{un=!1}}function hn(e){if(_)for(let t of Object.keys(e))va.has(t)&&(_[t]=e[t])}function Ur(){J(),pn=!1,document.removeEventListener("visibilitychange",Vr),window.removeEventListener("pagehide",qr),$&&(clearTimeout($),$=null)}function _a(){document.visibilityState==="hidden"&&J()}async function dn(e){let t=JSON.stringify(e),n=await Ta(t,yt.compression);n&&zr(n,0)}async function Ta(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await La(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ha}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function La(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=Ca(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function Ca(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function zr(e,t,n=Hr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<ga&&setTimeout(()=>zr(e,t+1,n),1e3*(t+1))})}catch{}}function ka(e,t,n){let o=e.d??{},r=xa(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Ir(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Ir(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Aa(s,n):null;u&&(i.dom=u),i.signal_type&&fn&&fn(i.signal_type)}let a=Ma(o);return Object.keys(a).length&&(i.metadata=a),i}function xa(e){return e==="pv"?"pageview":e==="sig"?"signal":Ea.has(e)?e:"custom_signal"}function Ma(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!ba(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return ya.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Aa(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Rr(n,t):null}catch{return null}}function Ir(...e){for(let t of e)if(typeof t=="string"&&t)return t}function Da(e){return e==="metadata"||e==="snapshot"?e:"off"}function Ra(e){return e==="off"?"off":"auto"}function Xr(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function vn(e,t){for(let n of t){let o=Oa(n.pattern);if(o&&o.test(e))return n.label}return Na(e)}var Ia=/^[a-zA-Z0-9/:._*\-]+$/;function Oa(e){if(e.length>200||!Ia.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Na(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Pa=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],P=[],Yr=3,jr=2e3,En=8,$r=[],le=[],Kr=0,_t=new Map,Tt=new Map,Ha=1e4,Lt=!1,Gr=f(Fa);function wn(e,t){Lt||(Lt=!0,Yr=e?.threshold??3,jr=e?.windowMs??2e3,$r=[...Pa,...t??[]],Kr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",Gr,{capture:!0,passive:!0}))}function bn(){Lt&&(Lt=!1,document.removeEventListener("click",Gr,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Fa(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$r)||Wa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>jr;)P.shift();P.push({t:n,x:o,y:r});let i=Ba();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>En*En)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=qa(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=Va(n),Lr=_t.get(b)??0,rn=Lr+1,Cr=Tt.get(b)??0,Ks=Cr>0&&n-Cr<Ha;_t.set(b,rn),Tt.set(b,n);let kr=Lr>=1,Gs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,sn)=>se+sn.x,0)/s.length,vt=s.reduce((se,sn)=>se+sn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:kr,hot_repeat:Ks,...Gs??{}}}),kr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:rn,burst_count:rn,burst_seq:U}}),P=P.slice(-(i-1))}function Ba(){return le.length>=3?2:Yr}function Va(e){let t=(e-Kr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function qa(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/En*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Wa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Ua=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,za=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Xa=/^(A|BUTTON|LABEL)$/,Ya=20,Zr=[],ce=null,ja=5,Ct=new Map,Qr=f($a),Jr=f(Za);function $a(e){ce={x:e.clientX,y:e.clientY}}function yn(e){Zr=e??[],document.addEventListener("mousedown",Qr,{capture:!0,passive:!0}),document.addEventListener("click",Jr,{capture:!0,passive:!0})}function Sn(){document.removeEventListener("mousedown",Qr,{capture:!0}),document.removeEventListener("click",Jr,{capture:!0}),ce=null,Ct.clear()}function _n(){Ct.clear()}function Ka(e){try{return window.getComputedStyle(e).cursor.slice(0,Ya)}catch{return""}}function Ga(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Za(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Zr)||tl())return;let n=nl(e);if(ce=null,n||Qa(t))return;let o=Ja(t,e.clientX,e.clientY),r=o?ei(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ka(t),c=Ga(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Qa(e){if(Ua.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&za.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Xa.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Ja(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=el(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function ei(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function el(e,t,n){return ei(e,t,n).dist}function tl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function nl(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>ja}var T=null,Tn=3e3,ti=[],kt="click",xt=0,ol=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,rl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ni=f(al),oi=f(il),ri=f(sl);function Ln(e,t){Tn=e?.delayMs??3e3,ti=t??[],document.addEventListener("click",ni,{capture:!0,passive:!0}),document.addEventListener("keydown",oi,{capture:!0,passive:!0}),document.addEventListener("touchstart",ri,{capture:!0,passive:!0})}function Cn(){document.removeEventListener("click",ni,{capture:!0}),document.removeEventListener("keydown",oi,{capture:!0}),document.removeEventListener("touchstart",ri,{capture:!0}),ue()}function kn(){ue()}function il(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function sl(){kt="touch",xt=Date.now()}function al(e){let t=e.target;if(!t||v(t,ti))return;let n=t.getAttribute("role");if(!ol.test(t.tagName)&&!(n&&rl.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Tn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Tn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var ll=100,cl=5,ii=800,si=2e3,ul=3,Mn=0,dl=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,xn=0,ee=[],An=0,de=null,ai=f(fl);function Dn(e){ii=e?.velocityThreshold??800,si=e?.windowMs??2e3,document.addEventListener("mousemove",ai,{passive:!0})}function Rn(){document.removeEventListener("mousemove",ai),de&&clearTimeout(de),In()}function fl(e){let t=Date.now();t-Mn<dl||(Mn=t,de&&clearTimeout(de),de=setTimeout(()=>In(),150),pl(e.clientX,e.clientY,t))}function pl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,xn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=ll&&(ee=ee.slice(-50)),ee.push(a),An+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=cl&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-xn>si){if(Dt>=ul){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=ii&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(An)}})}In(),xn=n}}function In(){Dt=0,ee=[],An=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,Mn=0,de=null}var li=100,ci=5,ml=3,L=[],x=[],On=3e4;function Nn(e){On=e?.windowMs??3e4}function Pn(){L=[],x=[]}function Hn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>On;)L.shift();for(;x.length&&t-x[0].ts>On;)x.shift();if(L.length>=li&&(L=L.slice(-50)),x.length>=li&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=ml&&a.length>u.size){let l=a.slice(-ci).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ci).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var gl=100,ui=1e4,Bn=.5,C=[],Rt=0,Vn=0,He=!1,Fn=0,di=f(hl);function qn(e){ui=e?.windowMs??1e4,Bn=e?.depthThreshold??.5,window.addEventListener("scroll",di,{passive:!0})}function Wn(){window.removeEventListener("scroll",di),C=[],He=!1}function Un(){C=[],Rt=0,Vn=0,He=!1}function hl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,vl()}))}function vl(){let e=Date.now(),t=window.scrollY;if(Fn=document.documentElement.scrollHeight-window.innerHeight,Fn<=0)return;let n=t/Fn,o=t>Rt?"down":"up";if(e-Vn<100){Rt=t;return}for(;C.length&&e-C[0].ts>ui;)C.shift();C.length>=gl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Vn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Bn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Bn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var El=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,zn=0,fi=5e3,pi=[],wl=50,mi=f(bl),gi=f(yl),hi=f(Sl),vi=y(Ei),Fe=null;function Xn(e,t){fi=e?.pauseMs??5e3,pi=t??[],document.addEventListener("focusin",mi,{capture:!0,passive:!0}),document.addEventListener("focusout",gi,{capture:!0,passive:!0}),document.addEventListener("submit",hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",vi),Fe=y(()=>{document.visibilityState==="hidden"&&Ei()}),document.addEventListener("visibilitychange",Fe)}function Yn(){document.removeEventListener("focusin",mi,{capture:!0}),document.removeEventListener("focusout",gi,{capture:!0}),document.removeEventListener("submit",hi,{capture:!0}),window.removeEventListener("pagehide",vi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function jn(){Be.clear(),Ve.clear(),z.clear(),te=null,zn=0}function bl(e){let t=e.target;if(!t||!wi(t)||v(t,pi)||_l(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,zn=o.querySelectorAll("input, select, textarea").length)}function yl(e){let t=e.target;if(!t||!wi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<wl)&&n!==void 0){let a=r-n;if(a>=fi){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Tl(t)&&z.add(s)}function Sl(){z.clear(),te=null}function Ei(){if(z.size>0&&te){let e=zn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function wi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function _l(e){if(e.tagName==="TEXTAREA")return!0;for(let t of El)try{if(e.matches(t))return!0}catch{return!1}return!1}function Tl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,bi=/flusterduck\.com|\/v1\/ingest/,Si=f(kl),_i=f(xl);function Kn(){window.addEventListener("error",Si),window.addEventListener("unhandledrejection",_i),Ml()}function Gn(){window.removeEventListener("error",Si),window.removeEventListener("unhandledrejection",_i),Al()}var $n=/fetch|network|cors|timeout/i;function Ll(e){return $n.test(e)?"network":"script"}function Cl(e){if(e instanceof TypeError&&$n.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return $n.test(t)?"network":"unhandled_promise"}function kl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Zn(t,200),ep:"",status:0,error_category:Ll(t),url:location.pathname}})}function xl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Zn(t,200),ep:"",status:0,error_category:Cl(e.reason),url:location.pathname}})}function Ml(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:yi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Zn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?yi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function Al(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function yi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Zn(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Ti=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Dl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null,Li=[],Ci=f(Rl),ki=f(Il),xi=f(Pl),Mi=f(Bl),Ai=f(Hl);function eo(e){Li=e??[],document.addEventListener("touchstart",Ci,{passive:!0}),document.addEventListener("touchend",ki,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",xi,{passive:!0}),window.addEventListener("orientationchange",Mi,{passive:!0})),window.visualViewport?.addEventListener("resize",Ai)}function to(){document.removeEventListener("touchstart",Ci),document.removeEventListener("touchend",ki),document.removeEventListener("gesturechange",xi),window.removeEventListener("orientationchange",Mi),window.visualViewport?.removeEventListener("resize",Ai),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null}function Di(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function Rl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Di(e.touches),K=null)}function Il(e){if(me>0){let s=e.touches.length>=2?Di(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Ol(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&Nl(i,n,o),K=null}function Ol(e,t,n){if(v(e,Li))return;let o=Vl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function Nl(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Ti.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Ti.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Pl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!Dl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Hl(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Fl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Bl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Qn>3e4&&(pe=0,Qn=e),t!==Jn&&(pe++,Jn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Fl()}}),pe=0)}function Vl(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],no=[],ql=10,Wl=5e3,Ri=5,Ii=3e3,Ul=15,zl=5e3,Oi=f(Xl);function oo(e){no=e??[],document.addEventListener("keydown",Oi,{capture:!0,passive:!0})}function ro(){document.removeEventListener("keydown",Oi,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",no=[]}function Xl(e){let t=Date.now(),n=e.target;n&&v(n,no)||(e.key==="Tab"?jl(t,n,e.shiftKey):e.key==="Escape"?$l(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Kl(t,e.target))}function Yl(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function jl(e,t,n){for(;M.length&&e-M[0].ts>Wl;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=ql){let i=M.map(a=>a.el).filter(Boolean),s=Yl(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Ii?(A++,F=i,A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function $l(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===ge){if(e-he>Ii){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Kl(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;H.length&&e-H[0].ts>zl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Ul&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Gl=1e4,Zl=2,Ql=4,Jl=3e3,Xe=null,Ht=0,ec=2e3,Ni=f(oc),Pi=f(tc),Hi=f(nc);function ao(){window.addEventListener("wheel",Pi,{passive:!0}),window.addEventListener("touchmove",Hi,{passive:!0}),window.addEventListener("scroll",Ni,{passive:!0})}function lo(){window.removeEventListener("wheel",Pi),window.removeEventListener("touchmove",Hi),window.removeEventListener("scroll",Ni),Ft()}function Ft(){ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Xe=null,Ht=0}function tc(){Xe="wheel",Ht=Date.now()}function nc(){Xe="touch",Ht=Date.now()}function oc(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,rc()}))}function rc(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-io>Jl&&(ve=0,io=e),ve++,ve>=Ql&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=ec?Xe:"wheel";e-so>Gl&&(Pt=0,so=e),Pt++;let a=Pt>=Zl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Bi=f(ic),je=null,$e=null;function co(){window.addEventListener("scroll",Bi,{passive:!0}),$e=y(Fi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Fi()}),document.addEventListener("visibilitychange",je)}function uo(){window.removeEventListener("scroll",Bi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function fo(){ne=0,Ee=0,Ye=!1}function ic(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Fi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Vi=1500,qi=15e3,sc=5e3,ac=.15,po="",we=0,Bt=0,Ke=0,be=0,mo=0,Vt=null,qt=0,Wt=!1,Ut=f(cc),Wi=f(uc),ye=f(lc);function go(){Wt||(Wt=!0,mo=Ui(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Wi,{passive:!0}))}function ho(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Wi),zi(),po="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){zi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:qi,cycle:e}})},qi)}function vo(){qt=0}function lc(){Ge()}function cc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==po||o-Bt>Vi)&&(po=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Vi}}),we=0,Bt=o)}function uc(){let e=Date.now(),t=Ui(),n=mo||t,o=Math.abs(t-n)/Math.max(n,1);mo=t,!(o<ac)&&((!Ke||e-Ke>sc)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function Ui(){return Math.max(1,window.innerWidth*window.innerHeight)}function zi(){Vt&&(clearTimeout(Vt),Vt=null)}var Xi=6e4,dc=3,fc=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],pc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],Yi=[],ji=f(mc);function Eo(e){Yi=e??[],document.addEventListener("click",ji,{capture:!0,passive:!0})}function wo(){document.removeEventListener("click",ji,{capture:!0}),B=[]}function bo(){B=[]}function mc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yi)||!gc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Xi;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<dc)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Xi}}),B=[]}function gc(e){let t=e;for(let n=0;n<3&&t;n++){if(hc(t)||vc(t))return!0;t=t.parentElement}return!1}function hc(e){for(let t of fc)try{if(e.matches(t))return!0}catch{}return!1}function vc(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return pc.test(o)}var $i=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Ki=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,Gi=[],Zi=f(Ec);function yo(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0})}function So(){document.removeEventListener("click",Zi,{capture:!0}),zt=[],Xt.clear()}function _o(){zt=[],Xt.clear()}function Ec(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Gi)||!wc(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:yc(t),...u??{}}})}function wc(e){let t=e;for(let n=0;n<4&&t;n++){if(bc(t))return!0;t=t.parentElement}return!1}function bc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&Ki.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if($i.test(r)||$i.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&Ki.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function yc(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var Sc=1500,I=null,Qi=[],Ji=f(_c),es=f(Tc),ts=f(Lc);function To(e){Qi=e??[],document.addEventListener("click",Ji,{capture:!0,passive:!0}),document.addEventListener("keydown",es,{capture:!0,passive:!0}),window.addEventListener("popstate",ts)}function Lo(){document.removeEventListener("click",Ji,{capture:!0}),document.removeEventListener("keydown",es,{capture:!0}),window.removeEventListener("popstate",ts),I=null}function Co(){I=null}function _c(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Qi)){if(Cc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function Tc(e){e.key==="Escape"&&ns("escape")}function Lc(){ns("back_nav")}function ns(e){if(!I)return;let t=Date.now()-I.t;if(t>Sc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function Cc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var os=1e4,kc=3,xc=/^(checkbox|radio)$/,rs=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,ko=[],is=f(Mc),ss=f(Ac);function xo(e){ko=e??[],document.addEventListener("change",is,{capture:!0,passive:!0}),document.addEventListener("click",ss,{capture:!0,passive:!0})}function Mo(){document.removeEventListener("change",is,{capture:!0}),document.removeEventListener("click",ss,{capture:!0}),Ze.clear()}function Ao(){Ze.clear()}function Mc(e){let t=e.target;t&&(v(t,ko)||Dc(t)&&as(t))}function Ac(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ko))return;let n=t.getAttribute("role")??"";rs.test(n)&&t.tagName!=="INPUT"&&as(t)}function as(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>os;)o.shift();if(o.push({t:n}),o.length<kc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:os}}),Ze.delete(t)}function Dc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?xc.test(e.type??""):rs.test(e.getAttribute("role")??"")}var ls=15e3,Rc=3,X=[],cs=f(Ic);function Do(){document.addEventListener("copy",cs,{capture:!0,passive:!0})}function Ro(){document.removeEventListener("copy",cs,{capture:!0}),X=[]}function Io(){X=[]}function Ic(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ls;)X.shift();X.push({t:o}),!(X.length<Rc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ls}}),X=[])}var us=15e3,Oc=4,Nc=5,Pc=500,Hc=2e3,D=[],Yt=0,Qe=null,oe=null;function Oo(){Qe=y(Bc),oe=y(Fc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function No(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Po(){D=[],Yt=0}function Fc(){Yt=Date.now(),D=[]}function Bc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<Nc)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Hc)return;for(;D.length&&o-D[0].t>us;)D.shift();let r=D[D.length-1];r&&o-r.t<Pc||(D.push({t:o}),!(D.length<Oc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:us}}),D=[]))}var Ho=6e4,Vc=20,fs="_fd_sess",qc={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},Wc=10,ds={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Fo="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ps(e,Date.now())}function Uc(){try{let e=sessionStorage.getItem(fs);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function zc(){try{sessionStorage.setItem(fs,JSON.stringify(_e))}catch{}}function Xc(){let e=[],n=Date.now()-Ho,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ps(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>Vc&&n.shift()}function Yc(e){let t=e-Ho,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function jc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=qc[n.type]??Wc;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function ms(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function $c(e,t,n){return ms(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Kc(e,t,n,o){let r=ms(o),i=Xc();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Fo||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:Ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,zc()}function Gc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Yc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ps(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=jc(),i=$c(n.size,o,r);i&&(Se!==null&&ds[i]<=ds[Se]||(Se=i,Kc(i,n,o,r)))}function Bo(e){Fo=e}function Vo(e){V=[],Se=null,$t=!0,Te=new Map,Fo=e??"",Uc(),mn(Gc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function qo(){$t=!1,V=[],Se=null,Te=new Map,mn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Zc=8,Wo=3e4,Uo=5,Qc=5e3,O=[],G="",ot=!1,gs=f(eu),hs=f(tu);function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",gs),window.addEventListener("hashchange",hs)}function Xo(){window.removeEventListener("popstate",gs),window.removeEventListener("hashchange",hs),O=[],ot=!1,G=""}function Yo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Wo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<Uo)&&(ot||Jc(t))}function Jc(e){let t=O.filter(c=>e-c.ts<=Wo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<Uo||n.length===0||n.some(c=>c.leftAt-c.ts>=Qc)||new Set(n.map(c=>c.path)).size<Uo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Zc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Wo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function eu(){let e=location.pathname+location.search+location.hash;rt(e)}function tu(){let e=location.pathname+location.search+location.hash;rt(e)}var nu=.3,vs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,Es=f(ou),ws=f(iu);function jo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",Es,{passive:!0}),window.addEventListener("click",ws,{capture:!0})}function $o(){window.removeEventListener("scroll",Es),window.removeEventListener("click",ws,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function ou(){it||(it=!0,requestAnimationFrame(ru))}function ru(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>vs&&(N=!1),re==="down"){let s=ie-t,a=n*nu;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function iu(e){if(!N)return;let t=Date.now();if(t-at>vs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var su=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,au=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,lu=/^(A|BUTTON|LABEL)$/,cu=3,bs=9e4,uu=5,lt=new Map,ys=[],ct=null,du=5,Ss=f(fu),_s=f(Eu);function fu(e){ct={x:e.clientX,y:e.clientY}}function Ko(e){ys=e??[],document.addEventListener("mousedown",Ss,{capture:!0,passive:!0}),document.addEventListener("click",_s,{capture:!0,passive:!0})}function Go(){document.removeEventListener("mousedown",Ss,{capture:!0}),document.removeEventListener("click",_s,{capture:!0}),ct=null,lt.clear()}function Zo(){lt.clear()}function pu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function mu(e,t){return e*4+t}function gu(e){if(su.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&au.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&lu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function hu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function vu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>du}function Eu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ys)||hu()||vu(e)||gu(t))return;let{row:n,col:o}=pu(e.clientX,e.clientY),r=mu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<bs);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=cu){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=uu))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:bs}}),lt.set(r,[])}}var Qo=3,Le=12e4,S=new Map,Zt=[],ut=null,Ts=f(_u),Gt=f(Tu);function er(e){Zt=e??[],document.addEventListener("invalid",Ts,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(Lu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function tr(){document.removeEventListener("invalid",Ts,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function nr(){for(let e of S.values())Z(e);S.clear()}function Jo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function or(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function wu(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function bu(e){return f(t=>{ks(e)})}function yu(e){return f(t=>{ks(e)})}function Ls(e,t){let n=bu(t),o=yu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Cs(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();wu(t);let n=p(e),o=S.get(n);if(!o){Ls(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n)))}function Su(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function ks(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,or(n.el)){n.cycles+=1,n.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Jo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function _u(e){let t=e.target;t&&Cs(t)}function Tu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||or(t)&&Ls(t,n)}function Lu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=or(n);i&&!r?Cs(n):!i&&r&&Su(n)}}var Ce=null,dt=null,ir=[],xs=0,ft=new Map;function sr(e){ir=e?.length?e:["[data-fd-impression]"],xs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(ku),{threshold:[0,.5,1]}),Ms(),dt=new MutationObserver(y(Cu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ar(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function lr(){ft.clear(),Ce&&Ms()}function Ms(){for(let e of ir)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)rr(t[n])}catch{}}function rr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function Cu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of ir)try{o.matches(r)&&rr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)rr(i[s])}catch{}}}function ku(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-xs),viewport_position:s}})}}}var xu=2,Mu=3,Au=6e4,pt=new Map,As=[],Ds=f(Du);function cr(e){As=e??[],document.addEventListener("input",Ds,{capture:!0,passive:!0})}function ur(){document.removeEventListener("input",Ds,{capture:!0}),pt.clear()}function dr(){pt.clear()}function Du(e){let t=e.target;if(!t||!Ru(t)||v(t,As))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Au){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=Mu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=xu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:Iu(t)}}),pt.delete(r);return}i.lastValue=o}function Ru(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Iu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Rs=2e3,Ou=3e4,q=null,Is=Rs,Os=[],Jt=new Map,Ns=f(Nu),Ps=f(Pu),Hs=f(mt);function fr(e,t){Is=e?.dwellMs??Rs,Os=t??[],document.addEventListener("mouseover",Ns,{passive:!0}),document.addEventListener("mouseout",Ps,{passive:!0}),document.addEventListener("click",Hs,{capture:!0,passive:!0})}function pr(){document.removeEventListener("mouseover",Ns),document.removeEventListener("mouseout",Ps),document.removeEventListener("click",Hs,{capture:!0}),mt(),Jt.clear()}function mr(){mt(),Jt.clear()}function Nu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Os)||!Hu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Ou)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Is);q={el:t,selector:n,startTs:r,timer:i}}function Pu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Hu(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Fu=20,Bu=500,Vu=3e3,qu=6e4,en=0,tn=0,W=null,Fs=y(Wu);function gr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Fs)}function hr(){document.removeEventListener("mouseleave",Fs),W&&(clearTimeout(W),W=null)}function vr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Wu(e){if(e.clientY>Fu)return;let t=Date.now();t-en<Vu||t-tn<qu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),Bu))}var Uu=2500,zu=4e3,Bs=200,Xu=500,Yu=.1,ju=.25,xe=null,Me=null,j=null,ke=0;function Er(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function wr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Er(o,Uu,zu)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Bs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:Er(o,Bs,Xu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Vs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Er(ke,Yu,ju)}})}ke=0}}function br(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Vs()}function yr(){if(Vs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var qs=[],Ws=f($u);function Sr(e){qs=e??[],document.addEventListener("paste",Ws,{capture:!0,passive:!0})}function _r(){document.removeEventListener("paste",Ws,{capture:!0})}function $u(e){let t=e.target;if(!t||!Ku(t)||v(t,qs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Gu(t)}})},100)}function Ku(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Gu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Zu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Qu(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function Tr(e){if(Q||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Ju()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=Mr(e.cookieless??!1),n=Qu(e.endpoint)??Zu,o=vn(location.pathname,e.pageRules??[]),r=ed(e.domMode);Wr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=Us(location.pathname,e.ignorePages??[]);i&&gn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&wn(e.signals?.rageClick,u),l("deadClick")&&yn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;Ln(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Dn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&Nn(e.signals?.loopNav),l("scrollBounce")&&qn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Xn(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&er(u)}if(l("errorEncounter")&&Kn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&eo(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&oo(u),l("scrollHijack")&&ao(),l("scrollDepthAbandon")&&co(),l("advancedHeuristics")&&go(),l("helpHunt")&&Eo(u),l("closeClick")&&yo(u),l("closeClickReversal")&&To(u),l("filterSpiral")&&xo(u),l("copyFrustration")&&Do(),l("textSelectFrustration")&&Oo(),l("deadClickTrapZone")&&Ko(u),Vo(o),l("navigationConfusion")&&zo(),l("scrollToClickConfusion")&&jo(),l("elementImpression")&&sr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&cr(u),e.trackForms!==!1&&l("pasteBlocked")&&Sr(u),l("hoverDwell")){let c=e.signals?.hoverDwell;fr(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&gr(),l("performanceVitals")&&wr(),nn=Xr(y((c,m)=>{J(),Un(),jn(),fo(),kn(),Ge(),vo(),bo(),_o(),Co(),Ao(),Io(),Po(),Zo(),nr(),_n(),Ft(),Kt(),Yo(),lr(),dr(),mr(),vr(),yr(),rt(m),Bo(m);let E=vn(m,e.pageRules??[]),w=Us(m,e.ignorePages??[]);gn(w),hn({page:E,url:c}),Hn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function zs(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Xs(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Ys(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}hn({segment:t})}function js(e){e&&gt&&!Q?Tr(gt):e||(on(),cn())}function $s(){on(),cn()}function on(){Q&&(bn(),Sn(),Cn(),Rn(),Pn(),Wn(),Yn(),Gn(),to(),ro(),lo(),uo(),ho(),wo(),So(),Lo(),Mo(),Ro(),No(),Go(),tr(),qo(),Xo(),$o(),ar(),ur(),pr(),hr(),br(),_r(),Ur(),nn&&(nn(),nn=null),Q=!1)}function Ju(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ed(e){return e==="metadata"||e==="snapshot"?e:"off"}function Us(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}
1
+ "use strict";var bn=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var Ha=Object.prototype.hasOwnProperty;var Fa=(e,t)=>{for(var n in t)bn(e,n,{get:t[n],enumerable:!0})},Ba=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pa(t))!Ha.call(e,o)&&o!==n&&bn(e,o,{get:()=>t[o],enumerable:!(r=Na(t,o))||r.enumerable});return e};var Wa=e=>Ba(bn({},"__esModule",{value:!0}),e);var nf={};Fa(nf,{destroy:()=>fn,destroyPostHogTrigger:()=>Aa,identify:()=>da,init:()=>Ho,initPostHogTrigger:()=>xa,optOut:()=>pa,setConsent:()=>fa,signal:()=>ca,track:()=>ua});module.exports=Wa(nf);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var yn="_fd_s";var Va=/^[0-9a-f]{32}$/;function $o(e){if(e)return Xo();let t=Ua(yn);if(t&&Va.test(t))return t;let n=Xo();return Yo(yn,n,30),n}function _n(){Yo(yn,"",-1)}function Xo(){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 Ua(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Yo(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 qa=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Ne(t)}"]`;if(e.id&&!qa.test(e.id)&&e.id.length<64)return"#"+Ne(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${Ne(s)}"]`:a?i+=`[role="${Ne(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${Ne(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function Ne(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Pe=60,za=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Xa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Pe);if(!Xa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Pe);if(i&&!za.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Pe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Pe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Pe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Ko(e,t){if(t==="off")return null;if(t==="metadata")return $a(e);let n=Ya(e);return n?{mode:"snapshot",...n}:null}function $a(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:ja(e)}}}function Ya(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:Ga(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:Ka(t),animations:i,siblings:o}}catch{return null}}function jo(e,t){return e&&t.includes(e)?e:null}function ja(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 Ka(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Ga(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 Zo=7e3,Za=500,Qa=1e4,Qo=50,Jo=100,Ja=3,He=6e4,Ct="application/json",el="application/json; encoding=gzip",ue=[],Z=null,ei="",ti=Zo,ni=Qo,S=null,Mt={domMode:"off",compression:"auto"},Sn=!1,Ln=null,Cn=!1;function Mn(e){Ln=e}var kt=new Set;function ri(e){return kt.add(e),()=>{kt.delete(e)}}function tl(e){if(e.t!=="sig"||!kt.size)return;let t=typeof e.d?.s=="string"?e.d.s:"";if(t)for(let n of kt)try{n(t,e.ts)}catch{}}function kn(e){Cn=e}var nl=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),rl=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),ol=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function il(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>ol.has(n))}var sl=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,oi=f(ll),ii=y(()=>ne());function si(e,t,n,r,o){ei=e,S=Object.assign(Object.create(null),t),Mt={domMode:hl(o?.domMode),compression:vl(o?.compression)},ti=Math.max(Za,Math.min(n??Zo,Qa)),ni=Math.max(1,Math.min(r??Qo,Jo)),document.addEventListener("visibilitychange",oi),window.addEventListener("pagehide",ii)}function u(e){Cn||ue.length>=Jo||(tl(e),ue.push(e),ue.length>=ni?ne():Z||(Z=setTimeout(ne,ti)))}function ne(){al()}async function al(){if(Sn||!ue.length||!S)return;Sn=!0,Z&&(clearTimeout(Z),Z=null);let e=ue;ue=[];let t={v:1,sid:S.sid,key:S.key,url:S.url,page:S.page,ts:Date.now(),ua:S.ua,vw:S.vw,vh:S.vh,environment:S.environment,...S.segment?{segment:S.segment}:{},dom_mode:Mt.domMode},n=e.map(o=>fl(o,S.page,Mt.domMode)),r=[];try{for(let o of n){let i=[...r,o];if(JSON.stringify({...t,events:i}).length>He)if(r.length>0)await Tn({...t,events:r}),r=[o];else{let a={...t,events:[o]};JSON.stringify(a).length<=He?await Tn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r=[]}else r=i}r.length>0&&await Tn({...t,events:r})}catch{}finally{Sn=!1}}function xn(e){if(S)for(let t of Object.keys(e))nl.has(t)&&(S[t]=e[t])}function ai(){ne(),Cn=!1,document.removeEventListener("visibilitychange",oi),window.removeEventListener("pagehide",ii),Z&&(clearTimeout(Z),Z=null)}function ll(){document.visibilityState==="hidden"&&ne()}async function Tn(e){let t=JSON.stringify(e),n=await cl(t,Mt.compression);n&&li(n,0)}async function cl(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>He)return null;if(t!=="off"){let o=await ul(e);if(o&&o.byteLength<=He)return{beaconBody:new Blob([o],{type:el}),fetchBody:new Uint8Array(o),headers:{"Content-Type":Ct,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:Ct}),fetchBody:e,headers:{"Content-Type":Ct}}}async function ul(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=dl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>He)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function dl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:Ct});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}function li(e,t,n=ei){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<Ja&&setTimeout(()=>li(e,t+1,n),1e3*(t+1))})}catch{}}function fl(e,t,n){let r=e.d??{},o=pl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=Go(r.el,r.element,r.target);if(o==="signal"){i.signal_type=Go(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?gl(s,n):null;c&&(i.dom=c),i.signal_type&&Ln&&Ln(i.signal_type)}let a=ml(r);return Object.keys(a).length&&(i.metadata=a),i}function pl(e){return e==="pv"?"pageview":e==="sig"?"signal":rl.has(e)?e:"custom_signal"}function ml(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=xt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=xt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function xt(e,t="",n=0){if(!(n>4)&&!il(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 sl.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>xt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=xt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function gl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Ko(n,t):null}catch{return null}}function Go(...e){for(let t of e)if(typeof t=="string"&&t)return t}function hl(e){return e==="metadata"||e==="snapshot"?e:"off"}function vl(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 An(e,t){for(let n of t){let r=El(n.pattern);if(r&&r.test(e))return n.label}return bl(e)}var wl=/^[a-zA-Z0-9/:._*\-]+$/;function El(e){if(e.length>200||!wl.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function bl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var yl=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],B=[],ui=3,di=2e3,fi=24,At=fi,pi=[],de=[],mi=0,Dt=new Map,Rt=new Map,_l=1e4,It=!1,gi=f(Sl);function Dn(e,t){It||(It=!0,ui=e?.threshold??3,di=e?.windowMs??2e3,At=e?.radius&&e.radius>0?e.radius:fi,pi=[...yl,...t??[]],mi=Date.now(),B=[],de=[],Dt.clear(),Rt.clear(),document.addEventListener("click",gi,{capture:!0,passive:!0}))}function Rn(){It&&(It=!1,document.removeEventListener("click",gi,{capture:!0,passive:!0}),B=[],de=[],Dt.clear(),Rt.clear())}function Sl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,pi)||Ml(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;B.length&&n-B[0].t>di;)B.shift();B.push({t:n,x:r,y:o});let i=Tl();if(B.length<i)return;let s=B.slice(-i);for(let M=0;M<s.length-1;M++)for(let Oe=M+1;Oe<s.length;Oe++){let St=s[M],Tt=s[Oe],Lt=Tt.x-St.x,ce=Tt.y-St.y;if(Lt*Lt+ce*ce>At*At)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=Cl(s,i,l),b=p(t),m=h(t);de.push({selector:b,ts:n});let $=de.length,_t=Ll(n),Uo=Dt.get(b)??0,wn=Uo+1,qo=Rt.get(b)??0,Ia=qo>0&&n-qo<_l;Dt.set(b,wn),Rt.set(b,n);let zo=Uo>=1,Oa=(()=>{try{let M=t.getBoundingClientRect();if(M.width===0&&M.height===0)return null;let Oe=s.reduce((ce,En)=>ce+En.x,0)/s.length,St=s.reduce((ce,En)=>ce+En.y,0)/s.length,Tt=M.left+M.width/2,Lt=M.top+M.height/2;return{click_dx:Math.round(Oe-Tt),click_dy:Math.round(St-Lt),el_w:Math.round(M.width),el_h:Math.round(M.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:$,burst_rate_per_min:_t,repeated_target:zo,hot_repeat:Ia,...Oa??{}}}),zo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:wn,burst_count:wn,burst_seq:$}}),B=B.slice(-(i-1))}function Tl(){return de.length>=3?2:ui}function Ll(e){let t=(e-mi)/6e4;return t<=0?0:Math.round(de.length/t*10)/10}function Cl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],$=m.x-b.x,_t=m.y-b.y;d+=Math.sqrt($*$+_t*_t),l++}let g=d/l;a=Math.max(0,2-g/At*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function Ml(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,xl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Al=/^(A|BUTTON|LABEL)$/,Dl=20,hi=[],fe=null,Rl=5,Ot=new Map,vi=f(Il),wi=f(Pl);function Il(e){fe={x:e.clientX,y:e.clientY}}function In(e){hi=e??[],document.addEventListener("mousedown",vi,{capture:!0,passive:!0}),document.addEventListener("click",wi,{capture:!0,passive:!0})}function On(){document.removeEventListener("mousedown",vi,{capture:!0}),document.removeEventListener("click",wi,{capture:!0}),fe=null,Ot.clear()}function Nn(){Ot.clear()}function Ol(e){try{return window.getComputedStyle(e).cursor.slice(0,Dl)}catch{return""}}function Nl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Pl(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hi)||Wl())return;let n=Vl(e);if(fe=null,n||Hl(t))return;let r=Fl(t,e.clientX,e.clientY),o=r?Ei(e.clientX,e.clientY,r):null,i=p(t),a=(Ot.get(i)??0)+1;Ot.set(i,a);let c=a>=2,d=Ol(t),l=Nl(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 Hl(e){if(kl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&xl.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&&Al.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Fl(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=Bl(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 Bl(e,t,n){return Ei(e,t,n).dist}function Wl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Vl(e){if(!fe)return!1;let t=e.clientX-fe.x,n=e.clientY-fe.y;return Math.sqrt(t*t+n*n)>Rl}var T=null,Pn=3e3,bi=[],Nt="click",Pt=0,Ul=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,ql=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,yi=f($l),_i=f(zl),Si=f(Xl);function Hn(e,t){Pn=e?.delayMs??3e3,bi=t??[],document.addEventListener("click",yi,{capture:!0,passive:!0}),document.addEventListener("keydown",_i,{capture:!0,passive:!0}),document.addEventListener("touchstart",Si,{capture:!0,passive:!0})}function Fn(){document.removeEventListener("click",yi,{capture:!0}),document.removeEventListener("keydown",_i,{capture:!0}),document.removeEventListener("touchstart",Si,{capture:!0}),pe()}function Bn(){pe()}function zl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Nt="keydown",Pt=Date.now()))}function Xl(){Nt="touch",Pt=Date.now()}function $l(e){let t=e.target;if(!t||v(t,bi))return;let n=t.getAttribute("role");if(!Ul.test(t.tagName)&&!(n&&ql.test(n)))return;let r=Date.now();if(r-Pt>50&&(Nt="click",Pt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Pn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Nt,observed_delay_ms:d}}),pe();return}pe()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,pe();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,pe();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Pn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function pe(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Yl=100,jl=5,Ti=800,Li=2e3,Kl=3,Vn=0,Gl=16,Ht=0,Ft=0,Fe=0,Be=0,We=0,Bt=0,Wn=0,re=[],Un=0,me=null,Ci=f(Zl);function qn(e){Ti=e?.velocityThreshold??800,Li=e?.windowMs??2e3,document.addEventListener("mousemove",Ci,{passive:!0})}function zn(){document.removeEventListener("mousemove",Ci),me&&clearTimeout(me),Xn()}function Zl(e){let t=Date.now();t-Vn<Gl||(Vn=t,me&&clearTimeout(me),me=setTimeout(()=>Xn(),150),Ql(e.clientX,e.clientY,t))}function Ql(e,t,n){if(Fe===0){Ht=e,Ft=t,Fe=n,Wn=n;return}let r=(n-Fe)/1e3;if(r===0)return;let o=e-Ht,i=t-Ft;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;re.length>=Yl&&(re=re.slice(-50)),re.push(a),Un+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=jl&&(Be!==0&&c!==0&&c!==Be||We!==0&&d!==0&&d!==We)&&Bt++,Be=c||Be,We=d||We,Ht=e,Ft=t,Fe=n,n-Wn>Li){if(Bt>=Kl){let l=re.reduce((g,w)=>g+w,0)/re.length;l>=Ti&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Bt,distance_px:Math.round(Un)}})}Xn(),Wn=n}}function Xn(){Bt=0,re=[],Un=0,Be=0,We=0,Fe=0,Ht=0,Ft=0,Vn=0,me=null}var Mi=100,ki=5,Jl=3,L=[],k=[],$n=3e4;function Yn(e){$n=e?.windowMs??3e4}function jn(){L=[],k=[]}function Kn(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>$n;)L.shift();for(;k.length&&t-k[0].ts>$n;)k.shift();if(L.length>=Mi&&(L=L.slice(-50)),k.length>=Mi&&(k=k.slice(-50)),L.push({path:e,ts:t}),o){k.push({path:e,ts:t});let a=k.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=Jl&&a.length>c.size){let d=a.slice(-ki).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),k=k.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-ki).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],k=k.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var ec=100,xi=1e4,Zn=.5,C=[],Wt=0,Qn=0,Ve=!1,Gn=0,Ai=f(tc);function Jn(e){xi=e?.windowMs??1e4,Zn=e?.depthThreshold??.5,window.addEventListener("scroll",Ai,{passive:!0})}function er(){window.removeEventListener("scroll",Ai),C=[],Ve=!1}function tr(){C=[],Wt=0,Qn=0,Ve=!1}function tc(){Ve||(Ve=!0,requestAnimationFrame(()=>{Ve=!1,nc()}))}function nc(){let e=Date.now(),t=window.scrollY;if(Gn=document.documentElement.scrollHeight-window.innerHeight,Gn<=0)return;let n=t/Gn,r=t>Wt?"down":"up";if(e-Qn<100){Wt=t;return}for(;C.length&&e-C[0].ts>xi;)C.shift();C.length>=ec&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),Wt=t,Qn=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>=Zn&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=Zn){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 rc=["textarea",'[role="textbox"]',"[contenteditable]"],qe=new Map,ze=new Map,Y=new Set,oe=null,nr=0,Di=5e3,Ri=[],oc=50,Ii=f(ic),Oi=f(sc),Ni=f(ac),Pi=y(Hi),Ue=null;function rr(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),Ue=y(()=>{document.visibilityState==="hidden"&&Hi()}),document.addEventListener("visibilitychange",Ue)}function or(){document.removeEventListener("focusin",Ii,{capture:!0}),document.removeEventListener("focusout",Oi,{capture:!0}),document.removeEventListener("submit",Ni,{capture:!0}),window.removeEventListener("pagehide",Pi),Ue&&(document.removeEventListener("visibilitychange",Ue),Ue=null),qe.clear(),ze.clear(),Y.clear(),oe=null}function ir(){qe.clear(),ze.clear(),Y.clear(),oe=null,nr=0}function ic(e){let t=e.target;if(!t||!Fi(t)||v(t,Ri)||lc(t))return;let n=Date.now();qe.set(t,n),ze.set(t,n);let r=t.closest("form");r&&r!==oe&&(oe=r,nr=r.querySelectorAll("input, select, textarea").length)}function sc(e){let t=e.target;if(!t||!Fi(t))return;let n=qe.get(t),r=ze.get(t);qe.delete(t),ze.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<oc)&&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);cc(t)&&Y.add(s)}function ac(){Y.clear(),oe=null}function Hi(){if(Y.size>0&&oe){let e=nr||Y.size,t=Math.round(Y.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:Y.size,total:e,field_count:e,completion_rate:t}}),Y.clear(),oe=null}}function Fi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function lc(e){if(e.tagName==="TEXTAREA")return!0;for(let t of rc)try{if(e.matches(t))return!0}catch{return!1}return!1}function cc(e){return"value"in e?e.value.length>0:!1}var ge=null,Xe=null,Bi=/flusterduck\.com|\/v1\/ingest/,Vi=f(fc),Ui=f(pc);function ar(){window.addEventListener("error",Vi),window.addEventListener("unhandledrejection",Ui),mc()}function lr(){window.removeEventListener("error",Vi),window.removeEventListener("unhandledrejection",Ui),gc()}var sr=/fetch|network|cors|timeout/i;function uc(e){return sr.test(e)?"network":"script"}function dc(e){if(e instanceof TypeError&&sr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return sr.test(t)?"network":"unhandled_promise"}function fc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:cr(t,200),ep:"",status:0,error_category:uc(t),url:location.pathname}})}function pc(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:cr(t,200),ep:"",status:0,error_category:dc(e.reason),url:location.pathname}})}function mc(){ge||(ge=window.fetch,Xe=function(t,n){let r;try{r=ge.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Bi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Wi(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;Bi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:cr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Wi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=Xe)}function gc(){ge&&Xe&&window.fetch===Xe&&(window.fetch=ge),ge=null,Xe=null}function Wi(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 cr(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 qi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],hc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,ur=0,dr=null,zi=[],Xi=f(vc),$i=f(wc),Yi=f(yc),ji=f(Tc),Ki=f(_c);function fr(e){zi=e??[],document.addEventListener("touchstart",Xi,{passive:!0}),document.addEventListener("touchend",$i,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Yi,{passive:!0}),window.addEventListener("orientationchange",ji,{passive:!0})),window.visualViewport?.addEventListener("resize",Ki)}function pr(){document.removeEventListener("touchstart",Xi),document.removeEventListener("touchend",$i),document.removeEventListener("gesturechange",Yi),window.removeEventListener("orientationchange",ji),window.visualViewport?.removeEventListener("resize",Ki),Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,ur=0,dr=null}function Gi(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 vc(e){let t=e.touches[0];e.touches.length===1&&t?(Q={x:t.clientX,y:t.clientY,ts:Date.now()},ve=0):e.touches.length===2&&(ve=Gi(e.touches),Q=null)}function wc(e){if(ve>0){let s=e.touches.length>=2?Gi(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&($e=Math.round(s/ve*100)/100),ve=0}if(!Q||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-Q.x,r=t.clientY-Q.y,o=Date.now()-Q.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&Ec(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&bc(i,n,r),Q=null}function Ec(e,t,n){if(v(e,zi))return;let r=Lc(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 bc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||qi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!qi.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 yc(){let e=Date.now();if(e-Ye>3e4&&(I=0,Ye=e),I++,I>=2){let t=document.activeElement||document.body;!hc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-je>200&&(je=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:$e}})),I=0,$e=1}}function _c(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ye>3e4&&(I=0,Ye=t),I++,I>=2&&t-je>200){let n=Math.round(e.scale*100)/100;je=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,$e=1}}}function Sc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Tc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-ur>3e4&&(he=0,ur=e),t!==dr&&(he++,dr=t),he>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:he,orientation:Sc()}}),he=0)}function Lc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],we=null,A=0,Ee=0,V="",W=[],mr=[],Cc=10,Mc=5e3,Zi=5,Qi=3e3,kc=15,xc=5e3,Ji=f(Ac);function gr(e){mr=e??[],document.addEventListener("keydown",Ji,{capture:!0,passive:!0})}function hr(){document.removeEventListener("keydown",Ji,{capture:!0}),x=[],W=[],we=null,A=0,Ee=0,V="",mr=[]}function Ac(e){let t=Date.now(),n=e.target;n&&v(n,mr)||(e.key==="Tab"?Rc(t,n,e.shiftKey):e.key==="Escape"?Ic(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Oc(t,e.target))}function Dc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Rc(e,t,n){for(;x.length&&e-x[0].ts>Mc;)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>=Cc){let i=x.map(a=>a.el).filter(Boolean),s=Dc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===we?e-Ee<=Qi?(A++,V=i,A>=Zi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",we=null)):(Ee=e,A=1,V=i):(we=o,Ee=e,A=1,V=i)}}function Ic(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===we){if(e-Ee>Qi){Ee=e,A=1,V=p(t);return}A++,V=p(t),A>=Zi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",we=null)}}function Oc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;W.length&&e-W[0].ts>xc;)W.shift();W.length>=50&&(W=W.slice(-25)),W.push({ts:e,container:n});let r=W.filter(o=>o.container===n);r.length>=kc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),W=[])}var be=0,Vt=0,Ut=null,vr=0,qt=!1,zt=0,wr=0,Nc=1e4,Pc=2,Hc=4,Fc=3e3,Ke=null,Xt=0,Bc=2e3,es=f(Uc),ts=f(Wc),ns=f(Vc);function Er(){window.addEventListener("wheel",ts,{passive:!0}),window.addEventListener("touchmove",ns,{passive:!0}),window.addEventListener("scroll",es,{passive:!0})}function br(){window.removeEventListener("wheel",ts),window.removeEventListener("touchmove",ns),window.removeEventListener("scroll",es),$t()}function $t(){be=0,Vt=0,Ut=null,vr=0,qt=!1,zt=0,wr=0,Ke=null,Xt=0}function Wc(){Ke="wheel",Xt=Date.now()}function Vc(){Ke="touch",Xt=Date.now()}function Uc(){qt||(qt=!0,requestAnimationFrame(()=>{qt=!1,qc()}))}function qc(){let e=Date.now(),t=window.scrollY,n=t-Vt;if(Math.abs(n)<2){Vt=t;return}let r=n>0?"down":"up";if(Ut&&r!==Ut&&(e-vr>Fc&&(be=0,vr=e),be++,be>=Hc&&Math.abs(n)>100)){let i=e-Xt,s=Ke!==null&&i<=Bc?Ke:"wheel";e-wr>Nc&&(zt=0,wr=e),zt++;let a=zt>=Pc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:be,source:s,repeated:a}}),be=0}Ut=r,Vt=t}var ie=0,ye=0,Ge=!1,os=f(zc),Ze=null,Qe=null;function yr(){window.addEventListener("scroll",os,{passive:!0}),Qe=y(rs),window.addEventListener("pagehide",Qe),Ze=y(()=>{document.visibilityState==="hidden"&&rs()}),document.addEventListener("visibilitychange",Ze)}function _r(){window.removeEventListener("scroll",os),Qe&&(window.removeEventListener("pagehide",Qe),Qe=null),Ze&&(document.removeEventListener("visibilitychange",Ze),Ze=null),ie=0,ye=0,Ge=!1}function Sr(){ie=0,ye=0,Ge=!1}function zc(){Ge||(Ge=!0,requestAnimationFrame(()=>{Ge=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ie&&(ie=t,ye===0&&(ye=Date.now()))}}))}function rs(){if(ie>.05){let e=Date.now(),t=ye>0?Math.max(0,e-ye):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ie*100)/100,max_depth:Math.round(ie*100),dwell_ms:t}})}}var is=1500,ss=15e3,Xc=5e3,$c=.15,Tr="",_e=0,Yt=0,Je=0,Se=0,Lr=0,jt=null,Kt=0,Gt=!1,Zt=f(jc),as=f(Kc),Te=f(Yc);function Cr(){Gt||(Gt=!0,Lr=ls(),et(),document.addEventListener("mouseenter",Zt,!0),document.addEventListener("mouseleave",Zt,!0),document.addEventListener("click",Te,{capture:!0,passive:!0}),document.addEventListener("keydown",Te,{capture:!0,passive:!0}),document.addEventListener("scroll",Te,{passive:!0}),window.addEventListener("resize",as,{passive:!0}))}function Mr(){Gt&&(Gt=!1,document.removeEventListener("mouseenter",Zt,!0),document.removeEventListener("mouseleave",Zt,!0),document.removeEventListener("click",Te,{capture:!0}),document.removeEventListener("keydown",Te,{capture:!0}),document.removeEventListener("scroll",Te),window.removeEventListener("resize",as),cs(),Tr="",_e=0,Yt=0,Se=0,Je=0,Kt=0)}function et(){cs(),Kt+=1;let e=Kt;jt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:ss,cycle:e}})},ss)}function kr(){Kt=0}function Yc(){et()}function jc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Tr||r-Yt>is)&&(Tr=n,Yt=r,_e=0),_e+=1,!(_e<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:_e,window_ms:is}}),_e=0,Yt=r)}function Kc(){let e=Date.now(),t=ls(),n=Lr||t,r=Math.abs(t-n)/Math.max(n,1);Lr=t,!(r<$c)&&((!Je||e-Je>Xc)&&(Je=e,Se=0),Se+=1,!(Se<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Se,area_delta:Math.round(r*1e3)/1e3}}),Se=0,Je=e))}function ls(){return Math.max(1,window.innerWidth*window.innerHeight)}function cs(){jt&&(clearTimeout(jt),jt=null)}var us=6e4,Gc=3,Zc=["[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"]'],Qc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,U=[],ds=[],fs=f(Jc);function xr(e){ds=e??[],document.addEventListener("click",fs,{capture:!0,passive:!0})}function Ar(){document.removeEventListener("click",fs,{capture:!0}),U=[]}function Dr(){U=[]}function Jc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ds)||!eu(t))return;let n=Date.now();for(;U.length&&n-U[0].t>us;)U.shift();let r=p(t);if(U.push({t:n,el:r}),U.length<Gc)return;let o=new Set(U.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:U.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:us}}),U=[]}function eu(e){let t=e;for(let n=0;n<3&&t;n++){if(tu(t)||nu(t))return!0;t=t.parentElement}return!1}function tu(e){for(let t of Zc)try{if(e.matches(t))return!0}catch{}return!1}function nu(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return Qc.test(r)}var ps=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ms=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Qt=[],Jt=new Map,gs=[],hs=f(ru);function Rr(e){gs=e??[],document.addEventListener("click",hs,{capture:!0,passive:!0})}function Ir(){document.removeEventListener("click",hs,{capture:!0}),Qt=[],Jt.clear()}function Or(){Qt=[],Jt.clear()}function ru(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,gs)||!ou(t))return;let n=Date.now(),r=p(t),o=h(t);Qt.push({t:n,el:r});let s=(Jt.get(r)??0)+1;Jt.set(r,s);let a=Qt.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:su(t),...c??{}}})}function ou(e){let t=e;for(let n=0;n<4&&t;n++){if(iu(t))return!0;t=t.parentElement}return!1}function iu(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&&ms.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ps.test(o)||ps.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ms.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 su(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 au=1500,O=null,vs=[],ws=f(lu),Es=f(cu),bs=f(uu);function Nr(e){vs=e??[],document.addEventListener("click",ws,{capture:!0,passive:!0}),document.addEventListener("keydown",Es,{capture:!0,passive:!0}),window.addEventListener("popstate",bs)}function Pr(){document.removeEventListener("click",ws,{capture:!0}),document.removeEventListener("keydown",Es,{capture:!0}),window.removeEventListener("popstate",bs),O=null}function Hr(){O=null}function lu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,vs)){if(du(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function cu(e){e.key==="Escape"&&ys("escape")}function uu(){ys("back_nav")}function ys(e){if(!O)return;let t=Date.now()-O.t;if(t>au){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 du(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var _s=1e4,fu=3,pu=/^(checkbox|radio)$/,Ss=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,tt=new Map,Fr=[],Ts=f(mu),Ls=f(gu);function Br(e){Fr=e??[],document.addEventListener("change",Ts,{capture:!0,passive:!0}),document.addEventListener("click",Ls,{capture:!0,passive:!0})}function Wr(){document.removeEventListener("change",Ts,{capture:!0}),document.removeEventListener("click",Ls,{capture:!0}),tt.clear()}function Vr(){tt.clear()}function mu(e){let t=e.target;t&&(v(t,Fr)||hu(t)&&Cs(t))}function gu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Fr))return;let n=t.getAttribute("role")??"";Ss.test(n)&&t.tagName!=="INPUT"&&Cs(t)}function Cs(e){let t=p(e),n=Date.now(),r=tt.get(t);for(r||(r=[],tt.set(t,r));r.length&&n-r[0].t>_s;)r.shift();if(r.push({t:n}),r.length<fu)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}}),tt.delete(t)}function hu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?pu.test(e.type??""):Ss.test(e.getAttribute("role")??"")}var Ms=15e3,vu=3,j=[],ks=f(wu);function Ur(){document.addEventListener("copy",ks,{capture:!0,passive:!0})}function qr(){document.removeEventListener("copy",ks,{capture:!0}),j=[]}function zr(){j=[]}function wu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;j.length&&r-j[0].t>Ms;)j.shift();j.push({t:r}),!(j.length<vu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:j.length,window_ms:Ms}}),j=[])}var xs=15e3,Eu=4,bu=5,yu=500,_u=2e3,D=[],en=0,nt=null,se=null;function Xr(){nt=y(Tu),se=y(Su),document.addEventListener("selectionchange",nt),document.addEventListener("copy",se,{capture:!0,passive:!0}),document.addEventListener("cut",se,{capture:!0,passive:!0})}function $r(){nt&&(document.removeEventListener("selectionchange",nt),nt=null),se&&(document.removeEventListener("copy",se,{capture:!0}),document.removeEventListener("cut",se,{capture:!0}),se=null),D=[],en=0}function Yr(){D=[],en=0}function Su(){en=Date.now(),D=[]}function Tu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<bu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-en<_u)return;for(;D.length&&r-D[0].t>xs;)D.shift();let o=D[D.length-1];o&&r-o.t<yu||(D.push({t:r}),!(D.length<Eu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:xs}}),D=[]))}var jr=6e4,Lu=20,Ds="_fd_sess",Cu={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},Mu=10,As={low:1,medium:2,high:3,critical:4},q=[],Le=null,nn=!1,Me=new Map,Ce={totalSignals:0,pagesWithFrustration:0},Kr="",rt=null,ot=null,it=null,st=null;function tn(e){nn&&Rs(e,Date.now())}function ku(){try{let e=sessionStorage.getItem(Ds);if(e){let t=JSON.parse(e);Ce={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function xu(){try{sessionStorage.setItem(Ds,JSON.stringify(Ce))}catch{}}function Au(){let e=[],n=Date.now()-jr,r=[];for(let[o,i]of Me.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Rs(e,t){Me.has(e)||Me.set(e,[]);let n=Me.get(e);n.push(t),n.length>Lu&&n.shift()}function Du(e){let t=e-jr,n=0;for(;n<q.length&&q[n].ts<t;)n++;n>0&&(q=q.slice(n))}function Ru(){let e=new Map,t=0;for(let n of q)e.set(n.type,(e.get(n.type)??0)+1),t+=Cu[n.type]??Mu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Is(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 Iu(e,t,n){return Is(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Ou(e,t,n,r){let o=Is(r),i=Au();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Kr||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:Ce.totalSignals,session_pages_with_frustration:Ce.pagesWithFrustration}}),Ce.totalSignals+=q.length,Ce.pagesWithFrustration+=1,xu()}function Nu(e){if(!nn||e==="frustration_burst")return;let t=Date.now();Du(t),q.length===0&&(Le=null),q.push({type:e,ts:t}),Rs(e,t);let{distinctTypes:n,totalWeight:r,typeCounts:o}=Ru(),i=Iu(n.size,r,o);i&&(Le!==null&&As[i]<=As[Le]||(Le=i,Ou(i,n,r,o)))}function Gr(e){Kr=e}function Zr(e){q=[],Le=null,nn=!0,Me=new Map,Kr=e??"",ku(),Mn(Nu),rt=()=>tn("popstate"),ot=()=>tn("hashchange"),it=()=>{document.visibilityState==="hidden"&&tn("visibilitychange")},st=()=>tn("pagehide"),window.addEventListener("popstate",rt),window.addEventListener("hashchange",ot),document.addEventListener("visibilitychange",it),window.addEventListener("pagehide",st)}function Qr(){nn=!1,q=[],Le=null,Me=new Map,Mn(null),rt&&(window.removeEventListener("popstate",rt),rt=null),ot&&(window.removeEventListener("hashchange",ot),ot=null),it&&(document.removeEventListener("visibilitychange",it),it=null),st&&(window.removeEventListener("pagehide",st),st=null)}var Pu=8,Jr=3e4,eo=5,Hu=5e3,N=[],J="",at=!1,Os=f(Bu),Ns=f(Wu);function to(){N=[],at=!1,J=location.pathname+location.search+location.hash,window.addEventListener("popstate",Os),window.addEventListener("hashchange",Ns)}function no(){window.removeEventListener("popstate",Os),window.removeEventListener("hashchange",Ns),N=[],at=!1,J=""}function ro(){N=[],at=!1,J=location.pathname+location.search+location.hash}function lt(e){let t=Date.now();if(J&&J!==e){let n=N[N.length-1];n&&n.path===J&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>Jr;)N.shift();e!==J&&(N.push({path:e,ts:t,leftAt:null}),J=e),!(N.length<eo)&&(at||Fu(t))}function Fu(e){let t=N.filter(l=>e-l.ts<=Jr),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<eo||n.length===0||n.some(l=>l.leftAt-l.ts>=Hu)||new Set(n.map(l=>l.path)).size<eo)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(-Pu);at=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:Jr,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Bu(){let e=location.pathname+location.search+location.hash;lt(e)}function Wu(){let e=location.pathname+location.search+location.hash;lt(e)}var Vu=.3,Ps=3e3,K=[],ct=!1,ae="none",le=0,ut=0,dt=0,P=!1,Hs=f(Uu),Fs=f(zu);function oo(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1,window.addEventListener("scroll",Hs,{passive:!0}),window.addEventListener("click",Fs,{capture:!0})}function io(){window.removeEventListener("scroll",Hs),window.removeEventListener("click",Fs,{capture:!0}),rn()}function rn(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1}function Uu(){ct||(ct=!0,requestAnimationFrame(qu))}function qu(){ct=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=K[K.length-1];if(r&&e-r.ts<50||(K.push({y:t,ts:e}),K.length>60&&(K=K.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){ae!=="down"&&P&&(P=!1),t>le&&(le=t),ae="down";return}if(P&&e-dt>Ps&&(P=!1),ae==="down"){let s=le-t,a=n*Vu;s>=a&&!P&&(ut=t,dt=e,P=!0)}ae="up"}function zu(e){if(!P)return;let t=Date.now();if(t-dt>Ps){P=!1;return}if(window.scrollY+e.clientY>ut+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(le-ut),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,le=window.scrollY,ae="none",K=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Xu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,$u=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Yu=/^(A|BUTTON|LABEL)$/,ju=3,Bs=9e4,Ku=5,ft=new Map,Ws=[],pt=null,Gu=5,Vs=f(Zu),Us=f(rd);function Zu(e){pt={x:e.clientX,y:e.clientY}}function so(e){Ws=e??[],document.addEventListener("mousedown",Vs,{capture:!0,passive:!0}),document.addEventListener("click",Us,{capture:!0,passive:!0})}function ao(){document.removeEventListener("mousedown",Vs,{capture:!0}),document.removeEventListener("click",Us,{capture:!0}),pt=null,ft.clear()}function lo(){ft.clear()}function Qu(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 Ju(e,t){return e*4+t}function ed(e){if(Xu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&$u.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&&Yu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function td(){let e=window.getSelection();return e!==null&&e.toString().length>0}function nd(e){if(!pt)return!1;let t=e.clientX-pt.x,n=e.clientY-pt.y;return Math.sqrt(t*t+n*n)>Gu}function rd(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Ws)||td()||nd(e)||ed(t))return;let{row:n,col:r}=Qu(e.clientX,e.clientY),o=Ju(n,r),i=Date.now(),s=p(t),c=(ft.get(o)??[]).filter(d=>i-d.ts<Bs);if(c.push({ts:i,selector:s}),ft.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,$]of d)$>g&&(g=$,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Ku))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:Bs}}),ft.set(o,[])}}var co=3,ke=12e4,_=new Map,sn=[],mt=null,qs=f(ld),on=f(cd);function fo(e){sn=e??[],document.addEventListener("invalid",qs,{capture:!0,passive:!0}),document.addEventListener("input",on,{capture:!0,passive:!0}),document.addEventListener("change",on,{capture:!0,passive:!0}),mt=new MutationObserver(ud),mt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function po(){document.removeEventListener("invalid",qs,{capture:!0}),document.removeEventListener("input",on,{capture:!0}),document.removeEventListener("change",on,{capture:!0}),mt&&(mt.disconnect(),mt=null);for(let e of _.values())ee(e);_.clear()}function mo(){for(let e of _.values())ee(e);_.clear()}function uo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function go(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function an(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function od(e){for(let[t,n]of _)e-n.lastTs>ke&&(ee(n),_.delete(t))}function ee(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function id(e){return f(t=>{$s(e)})}function sd(e){return f(t=>{$s(e)})}function zs(e,t){let n=id(t),r=sd(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return _.set(t,o),o}function Xs(e){if(!an(e)||v(e,sn))return;let t=Date.now();od(t);let n=p(e),r=_.get(n);if(!r){zs(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:uo(e)}}),ee(r),_.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:uo(e)}}),ee(r),_.delete(n)))}function ad(e){if(!an(e))return;let t=Date.now(),n=p(e),r=_.get(n);if(r){if(t-r.lastTs>ke){ee(r),_.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function $s(e){let t=Date.now(),n=_.get(e);if(n){if(t-n.lastTs>ke){ee(n),_.delete(e);return}if(n.lastTs=t,go(n.el)){n.cycles+=1,n.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:ke,field_type:uo(n.el)}}),ee(n),_.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ld(e){let t=e.target;t&&Xs(t)}function cd(e){let t=e.target;if(!t||!an(t)||v(t,sn))return;let n=p(t);_.has(n)||go(t)&&zs(t,n)}function ud(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!an(n)||v(n,sn))continue;let r=t.oldValue,o=r==="true"||r==="",i=go(n);i&&!o?Xs(n):!i&&o&&ad(n)}}var xe=null,gt=null,vo=[],Ys=0,ht=new Map;function wo(e){vo=e?.length?e:["[data-fd-impression]"],Ys=Date.now(),!(typeof IntersectionObserver>"u")&&(xe=new IntersectionObserver(y(fd),{threshold:[0,.5,1]}),js(),gt=new MutationObserver(y(dd)),gt.observe(document.body,{childList:!0,subtree:!0}))}function Eo(){xe&&(xe.disconnect(),xe=null),gt&&(gt.disconnect(),gt=null),ht.clear()}function bo(){ht.clear(),xe&&js()}function js(){for(let e of vo)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)ho(t[n])}catch{}}function ho(e){ht.has(e)||(ht.set(e,{firstSeenTs:0,emitted:!1}),xe.observe(e))}function dd(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 vo)try{r.matches(o)&&ho(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)ho(i[s])}catch{}}}function fd(e){let t=Date.now();for(let n of e){let r=ht.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Ys),viewport_position:s}})}}}var pd=2,md=3,gd=6e4,vt=new Map,Ks=[],Gs=f(hd);function yo(e){Ks=e??[],document.addEventListener("input",Gs,{capture:!0,passive:!0})}function _o(){document.removeEventListener("input",Gs,{capture:!0}),vt.clear()}function So(){vt.clear()}function hd(e){let t=e.target;if(!t||!vd(t)||v(t,Ks))return;let n=Date.now(),r=t.value??"",o=p(t),i=vt.get(o);if(!i){vt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>gd){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>=md)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=pd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:wd(t)}}),vt.delete(o);return}i.lastValue=r}function vd(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 Zs=2e3,Ed=3e4,z=null,Qs=Zs,Js=[],ln=new Map,ea=f(bd),ta=f(yd),na=f(wt);function To(e,t){Qs=e?.dwellMs??Zs,Js=t??[],document.addEventListener("mouseover",ea,{passive:!0}),document.addEventListener("mouseout",ta,{passive:!0}),document.addEventListener("click",na,{capture:!0,passive:!0})}function Lo(){document.removeEventListener("mouseover",ea),document.removeEventListener("mouseout",ta),document.removeEventListener("click",na,{capture:!0}),wt(),ln.clear()}function Co(){wt(),ln.clear()}function bd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Js)||!_d(t))return;let n=p(t);if(z?.selector===n)return;wt();let r=Date.now();if(r-(ln.get(n)??0)<Ed)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);ln.set(n,s),z=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Qs);z={el:t,selector:n,startTs:o,timer:i}}function yd(e){if(!z)return;let t=e.target;if(t!==z.el&&!z.el.contains(t))return;let n=e.relatedTarget;n&&z.el.contains(n)||wt()}function wt(){z&&(clearTimeout(z.timer),z=null)}function _d(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 Sd=20,Td=500,Ld=3e3,Cd=6e4,cn=0,un=0,X=null,ra=y(Md);function Mo(){cn=Date.now(),un=0,document.addEventListener("mouseleave",ra)}function ko(){document.removeEventListener("mouseleave",ra),X&&(clearTimeout(X),X=null)}function xo(){cn=Date.now(),un=0,X&&(clearTimeout(X),X=null)}function Md(e){if(e.clientY>Sd)return;let t=Date.now();t-cn<Ld||t-un<Cd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();un=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-cn)}})}),Td))}var kd=2500,xd=4e3,oa=200,Ad=500,Dd=.1,Rd=.25,De=null,Re=null,G=null,Ae=0;function Ao(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Do(){if(!(typeof PerformanceObserver>"u")){try{De=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Ao(r,kd,xd)}})})),De.observe({type:"largest-contentful-paint",buffered:!0})}catch{De=null}try{Re=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<oa||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Ao(r,oa,Ad)}})}})),Re.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Re=null}try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!0})}catch{G=null}}}function ia(){if(G){if(G.disconnect(),G=null,Ae>0){let e=Math.round(Ae*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Ao(Ae,Dd,Rd)}})}Ae=0}}function Ro(){De&&(De.disconnect(),De=null),Re&&(Re.disconnect(),Re=null),ia()}function Io(){if(ia(),!(typeof PerformanceObserver>"u"))try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!1})}catch{G=null}}var sa=[],aa=f(Id);function Oo(e){sa=e??[],document.addEventListener("paste",aa,{capture:!0,passive:!0})}function No(){document.removeEventListener("paste",aa,{capture:!0})}function Id(e){let t=e.target;if(!t||!Od(t)||v(t,sa))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:Nd(t)}})},100)}function Od(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 Nd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Pd="https://api.flusterduck.com/v1/ingest",te=!1,dn=null,Ie=null,Et="__flusterduck_instance__",Po=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function Hd(){let e=window;return e[Et]&&e[Et]!==Po?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[Et]=Po,!0)}function Fd(){let e=window;e[Et]===Po&&delete e[Et]}var bt=[];function Bd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Dn(e.signals?.rageClick,t),stop:Rn},{when:()=>r("deadClick"),start:()=>In(t),stop:On,reset:Nn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Hn(i?{delayMs:i.windowMs}:void 0,t)},stop:Fn,reset:Bn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;qn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:zn},{when:()=>r("loopNav"),start:()=>Yn(e.signals?.loopNav),stop:jn},{when:()=>r("scrollBounce"),start:Jn,stop:er,reset:tr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;rr(i?{pauseMs:i.threshold}:void 0,t)},stop:or,reset:ir},{when:()=>o&&r("formValidationLoop"),start:()=>fo(t),stop:po,reset:mo},{when:()=>r("errorEncounter"),start:ar,stop:lr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>fr(t),stop:pr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>gr(t),stop:hr},{when:()=>r("scrollHijack"),start:Er,stop:br,reset:$t},{when:()=>r("scrollDepthAbandon"),start:yr,stop:_r,reset:Sr},{when:()=>r("advancedHeuristics"),start:Cr,stop:Mr,reset:()=>{et(),kr()}},{when:()=>r("helpHunt"),start:()=>xr(t),stop:Ar,reset:Dr},{when:()=>r("closeClick"),start:()=>Rr(t),stop:Ir,reset:Or},{when:()=>r("closeClickReversal"),start:()=>Nr(t),stop:Pr,reset:Hr},{when:()=>r("filterSpiral"),start:()=>Br(t),stop:Wr,reset:Vr},{when:()=>r("copyFrustration"),start:Ur,stop:qr,reset:zr},{when:()=>r("textSelectFrustration"),start:Xr,stop:$r,reset:Yr},{when:()=>r("deadClickTrapZone"),start:()=>so(t),stop:ao,reset:lo},{when:()=>!0,start:()=>Zr(n),stop:Qr},{when:()=>r("navigationConfusion"),start:to,stop:no,reset:ro},{when:()=>r("scrollToClickConfusion"),start:oo,stop:io,reset:rn},{when:()=>r("elementImpression"),start:()=>wo(e.elementImpressionSelectors),stop:Eo,reset:bo},{when:()=>o&&r("inputCorrection"),start:()=>yo(t),stop:_o,reset:So},{when:()=>o&&r("pasteBlocked"),start:()=>Oo(t),stop:No},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;To(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Lo,reset:Co},{when:()=>r("exitIntent"),start:Mo,stop:ko,reset:xo},{when:()=>r("performanceVitals"),start:Do,stop:Ro,reset:Io}]}function Wd(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 Ho(e){if(te||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Vd()){Ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ie=e;return}if(!Hd()){Ie=e;return}Ie=e,te=!0;let t=$o(e.cookieless??!1),n=Wd(e.endpoint)??Pd,r=An(location.pathname,e.pageRules??[]),o=Ud(e.domMode);si(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=la(location.pathname,e.ignorePages??[]);i&&kn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];bt=[];for(let d of Bd(e,c,r))d.when()&&(d.start(),bt.push({stop:d.stop,reset:d.reset}));dn=ci(y((d,l)=>{ne();for(let E of bt)E.reset?.();lt(l),Gr(l);let g=An(l,e.pageRules??[]),w=la(l,e.ignorePages??[]);kn(w),xn({page:g,url:d}),Kn(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 ca(e,t){if(!te||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function ua(e,t={}){if(!te||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function da(e){if(!te||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}xn({segment:t})}function fa(e){e&&Ie&&!te?Ho(Ie):e||(fn(),_n())}function pa(){fn(),_n()}function fn(){if(te){for(let e of bt)e.stop();bt=[],ai(),dn&&(dn(),dn=null),Fd(),te=!1}}function Vd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Ud(e){return e==="metadata"||e==="snapshot"?e:"off"}function la(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 va=.1,wa=.01,Ea=3e4,ba=50,ya=1e4,qd=500,zd=3e4,Xd=6e4,ma=10,$d=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Yd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,jd=/^\$\$?(heatmap|scroll)/,_a=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],hn=!1,pn=null,mn=null,yt=null,H=null,gn=null,Sa=va,Ta=wa,La=new Set,Ca=new Set(_a),Ma=Ea,Wo=ba,ka=ya,R=[],vn=0,F=[];function ga(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function xa(e){hn||(hn=!0,Sa=ga(e?.baselineSampleRate,va),Ta=ga(e?.scrollSampleRate,wa),La=new Set(e?.conversionEvents??[]),Ca=new Set(e?.criticalSignals?.length?e.criticalSignals:_a),Ma=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:Ea,Wo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:ba,ka=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:ya,R=[],vn=0,F=[],mn=ri(tf),ha()||(pn=setInterval(()=>{ha()&&Vo()},qd),setTimeout(()=>Vo(),zd)))}function Aa(){hn&&(hn=!1,Vo(),mn&&(mn(),mn=null),yt&&gn&&yt.capture.__fd_wrapped&&(yt.capture=gn),yt=null,H=null,gn=null,R=[],F=[],vn=0)}function Vo(){pn&&(clearInterval(pn),pn=null)}function ha(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;gn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return Gd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,yt=e,!0}catch{return!1}}function Kd(e){return $d.has(e)?"critical":La.has(e)||Yd.test(e)?"conversion":jd.test(e)?"scroll":"baseline"}function Gd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Kd(e);if(o==="critical"||o==="conversion")return H(e,Bo(t,r),n);if(r<vn)return H(e,{...Bo(t,r),fd_boosted:!0},n);if(Zd(o==="scroll"?Ta:Sa))return H(e,Bo(t,r),n);ef({name:e,properties:t,ts:r})}function Zd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Qd();return t?Jd(t)%1e4/1e4<e:Math.random()<e}var Fo="";function Qd(){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 Fo||(Fo=Math.random().toString(36).slice(2)),Fo}function Jd(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 Bo(e,t){return Ra(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function ef(e){R.push(e),Da(e.ts)}function Da(e){let t=e-Ma;for(;R.length&&R[0].ts<t;)R.shift();R.length>Wo&&(R=R.slice(-Wo))}function Ra(e){let t=e-Xd;F=F.filter(n=>n.ts>=t),F.length>ma&&(F=F.slice(-ma))}function tf(e,t){if(F.push({name:e,ts:t}),Ra(t),!Ca.has(e)||(vn=t+ka,!H||!R.length))return;Da(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.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { init, signal, track, identify, setConsent, optOut, destroy } from './core';
2
+ export { initPostHogTrigger, destroyPostHogTrigger } from './posthog-trigger';
3
+ export type { PostHogTriggerOptions } from './posthog-trigger';
2
4
  export type { Config, SDKEvent, SnapshotData } from './types';
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 Xs=/^[0-9a-f]{32}$/;function kr(e){if(e)return Cr();let t=Ys(sn);if(t&&Xs.test(t))return t;let n=Cr();return xr(sn,n,30),n}function an(){xr(sn,"",-1)}function Cr(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Ys(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function xr(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var js=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${De(t)}"]`;if(e.id&&!js.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,$s=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ks=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!Ks.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!$s.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Ar(e,t){if(t==="off")return null;if(t==="metadata")return Gs(e);let n=Zs(e);return n?{mode:"snapshot",...n}:null}function Gs(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:Mr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Mr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Qs(e)}}}function Zs(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:ea(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?p(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Js(t),animations:i,siblings:r}}catch{return null}}function Mr(e,t){return e&&t.includes(e)?e:null}function Qs(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Js(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function ea(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Rr=7e3,ta=500,na=1e4,Ir=50,Or=100,oa=3,Ie=6e4,bt="application/json",ra="application/json; encoding=gzip",ae=[],$=null,Nr="",Pr=Rr,Hr=Ir,_=null,yt={domMode:"off",compression:"auto"},ln=!1,un=null,dn=!1;function fn(e){un=e}function pn(e){dn=e}var ia=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),sa=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),aa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function la(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>aa.has(n))}var ca=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Fr=f(da),Br=y(()=>J());function Vr(e,t,n,o,r){Nr=e,_=Object.assign(Object.create(null),t),yt={domMode:wa(r?.domMode),compression:ba(r?.compression)},Pr=Math.max(ta,Math.min(n??Rr,na)),Hr=Math.max(1,Math.min(o??Ir,Or)),document.addEventListener("visibilitychange",Fr),window.addEventListener("pagehide",Br)}function d(e){dn||ae.length>=Or||(ae.push(e),ae.length>=Hr?J():$||($=setTimeout(J,Pr)))}function J(){ua()}async function ua(){if(ln||!ae.length||!_)return;ln=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:yt.domMode},n=e.map(r=>ga(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await cn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await cn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await cn({...t,events:o})}catch{}finally{ln=!1}}function mn(e){if(_)for(let t of Object.keys(e))ia.has(t)&&(_[t]=e[t])}function qr(){J(),dn=!1,document.removeEventListener("visibilitychange",Fr),window.removeEventListener("pagehide",Br),$&&(clearTimeout($),$=null)}function da(){document.visibilityState==="hidden"&&J()}async function cn(e){let t=JSON.stringify(e),n=await fa(t,yt.compression);n&&Wr(n,0)}async function fa(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await pa(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ra}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function pa(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=ma(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function ma(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function Wr(e,t,n=Nr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<oa&&setTimeout(()=>Wr(e,t+1,n),1e3*(t+1))})}catch{}}function ga(e,t,n){let o=e.d??{},r=ha(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Dr(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Dr(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Ea(s,n):null;u&&(i.dom=u),i.signal_type&&un&&un(i.signal_type)}let a=va(o);return Object.keys(a).length&&(i.metadata=a),i}function ha(e){return e==="pv"?"pageview":e==="sig"?"signal":sa.has(e)?e:"custom_signal"}function va(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!la(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return ca.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Ea(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Ar(n,t):null}catch{return null}}function Dr(...e){for(let t of e)if(typeof t=="string"&&t)return t}function wa(e){return e==="metadata"||e==="snapshot"?e:"off"}function ba(e){return e==="off"?"off":"auto"}function Ur(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function gn(e,t){for(let n of t){let o=Sa(n.pattern);if(o&&o.test(e))return n.label}return _a(e)}var ya=/^[a-zA-Z0-9/:._*\-]+$/;function Sa(e){if(e.length>200||!ya.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function _a(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Ta=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],P=[],zr=3,Xr=2e3,hn=8,Yr=[],le=[],jr=0,_t=new Map,Tt=new Map,La=1e4,Lt=!1,$r=f(Ca);function vn(e,t){Lt||(Lt=!0,zr=e?.threshold??3,Xr=e?.windowMs??2e3,Yr=[...Ta,...t??[]],jr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",$r,{capture:!0,passive:!0}))}function En(){Lt&&(Lt=!1,document.removeEventListener("click",$r,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Ca(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yr)||Aa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>Xr;)P.shift();P.push({t:n,x:o,y:r});let i=ka();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>hn*hn)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=Ma(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=xa(n),_r=_t.get(b)??0,on=_r+1,Tr=Tt.get(b)??0,Us=Tr>0&&n-Tr<La;_t.set(b,on),Tt.set(b,n);let Lr=_r>=1,zs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,rn)=>se+rn.x,0)/s.length,vt=s.reduce((se,rn)=>se+rn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:Lr,hot_repeat:Us,...zs??{}}}),Lr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:on,burst_count:on,burst_seq:U}}),P=P.slice(-(i-1))}function ka(){return le.length>=3?2:zr}function xa(e){let t=(e-jr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function Ma(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/hn*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Aa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Da=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ra=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ia=/^(A|BUTTON|LABEL)$/,Oa=20,Kr=[],ce=null,Na=5,Ct=new Map,Gr=f(Pa),Zr=f(Ba);function Pa(e){ce={x:e.clientX,y:e.clientY}}function wn(e){Kr=e??[],document.addEventListener("mousedown",Gr,{capture:!0,passive:!0}),document.addEventListener("click",Zr,{capture:!0,passive:!0})}function bn(){document.removeEventListener("mousedown",Gr,{capture:!0}),document.removeEventListener("click",Zr,{capture:!0}),ce=null,Ct.clear()}function yn(){Ct.clear()}function Ha(e){try{return window.getComputedStyle(e).cursor.slice(0,Oa)}catch{return""}}function Fa(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ba(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Kr)||Ua())return;let n=za(e);if(ce=null,n||Va(t))return;let o=qa(t,e.clientX,e.clientY),r=o?Qr(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ha(t),c=Fa(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Va(e){if(Da.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ra.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Ia.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function qa(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=Wa(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function Qr(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Wa(e,t,n){return Qr(e,t,n).dist}function Ua(){let e=window.getSelection();return e!==null&&e.toString().length>0}function za(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>Na}var T=null,Sn=3e3,Jr=[],kt="click",xt=0,Xa=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ya=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ei=f(Ka),ti=f(ja),ni=f($a);function _n(e,t){Sn=e?.delayMs??3e3,Jr=t??[],document.addEventListener("click",ei,{capture:!0,passive:!0}),document.addEventListener("keydown",ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",ni,{capture:!0,passive:!0})}function Tn(){document.removeEventListener("click",ei,{capture:!0}),document.removeEventListener("keydown",ti,{capture:!0}),document.removeEventListener("touchstart",ni,{capture:!0}),ue()}function Ln(){ue()}function ja(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function $a(){kt="touch",xt=Date.now()}function Ka(e){let t=e.target;if(!t||v(t,Jr))return;let n=t.getAttribute("role");if(!Xa.test(t.tagName)&&!(n&&Ya.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Sn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Sn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Ga=100,Za=5,oi=800,ri=2e3,Qa=3,kn=0,Ja=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,Cn=0,ee=[],xn=0,de=null,ii=f(el);function Mn(e){oi=e?.velocityThreshold??800,ri=e?.windowMs??2e3,document.addEventListener("mousemove",ii,{passive:!0})}function An(){document.removeEventListener("mousemove",ii),de&&clearTimeout(de),Dn()}function el(e){let t=Date.now();t-kn<Ja||(kn=t,de&&clearTimeout(de),de=setTimeout(()=>Dn(),150),tl(e.clientX,e.clientY,t))}function tl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,Cn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=Ga&&(ee=ee.slice(-50)),ee.push(a),xn+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=Za&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-Cn>ri){if(Dt>=Qa){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=oi&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(xn)}})}Dn(),Cn=n}}function Dn(){Dt=0,ee=[],xn=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,kn=0,de=null}var si=100,ai=5,nl=3,L=[],x=[],Rn=3e4;function In(e){Rn=e?.windowMs??3e4}function On(){L=[],x=[]}function Nn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Rn;)L.shift();for(;x.length&&t-x[0].ts>Rn;)x.shift();if(L.length>=si&&(L=L.slice(-50)),x.length>=si&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=nl&&a.length>u.size){let l=a.slice(-ai).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ai).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var ol=100,li=1e4,Hn=.5,C=[],Rt=0,Fn=0,He=!1,Pn=0,ci=f(rl);function Bn(e){li=e?.windowMs??1e4,Hn=e?.depthThreshold??.5,window.addEventListener("scroll",ci,{passive:!0})}function Vn(){window.removeEventListener("scroll",ci),C=[],He=!1}function qn(){C=[],Rt=0,Fn=0,He=!1}function rl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,il()}))}function il(){let e=Date.now(),t=window.scrollY;if(Pn=document.documentElement.scrollHeight-window.innerHeight,Pn<=0)return;let n=t/Pn,o=t>Rt?"down":"up";if(e-Fn<100){Rt=t;return}for(;C.length&&e-C[0].ts>li;)C.shift();C.length>=ol&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Fn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Hn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Hn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var sl=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,Wn=0,ui=5e3,di=[],al=50,fi=f(ll),pi=f(cl),mi=f(ul),gi=y(hi),Fe=null;function Un(e,t){ui=e?.pauseMs??5e3,di=t??[],document.addEventListener("focusin",fi,{capture:!0,passive:!0}),document.addEventListener("focusout",pi,{capture:!0,passive:!0}),document.addEventListener("submit",mi,{capture:!0,passive:!0}),window.addEventListener("pagehide",gi),Fe=y(()=>{document.visibilityState==="hidden"&&hi()}),document.addEventListener("visibilitychange",Fe)}function zn(){document.removeEventListener("focusin",fi,{capture:!0}),document.removeEventListener("focusout",pi,{capture:!0}),document.removeEventListener("submit",mi,{capture:!0}),window.removeEventListener("pagehide",gi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function Xn(){Be.clear(),Ve.clear(),z.clear(),te=null,Wn=0}function ll(e){let t=e.target;if(!t||!vi(t)||v(t,di)||dl(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,Wn=o.querySelectorAll("input, select, textarea").length)}function cl(e){let t=e.target;if(!t||!vi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<al)&&n!==void 0){let a=r-n;if(a>=ui){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);fl(t)&&z.add(s)}function ul(){z.clear(),te=null}function hi(){if(z.size>0&&te){let e=Wn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function vi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function dl(e){if(e.tagName==="TEXTAREA")return!0;for(let t of sl)try{if(e.matches(t))return!0}catch{return!1}return!1}function fl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,Ei=/flusterduck\.com|\/v1\/ingest/,bi=f(gl),yi=f(hl);function jn(){window.addEventListener("error",bi),window.addEventListener("unhandledrejection",yi),vl()}function $n(){window.removeEventListener("error",bi),window.removeEventListener("unhandledrejection",yi),El()}var Yn=/fetch|network|cors|timeout/i;function pl(e){return Yn.test(e)?"network":"script"}function ml(e){if(e instanceof TypeError&&Yn.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return Yn.test(t)?"network":"unhandled_promise"}function gl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Kn(t,200),ep:"",status:0,error_category:pl(t),url:location.pathname}})}function hl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Kn(t,200),ep:"",status:0,error_category:ml(e.reason),url:location.pathname}})}function vl(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:wi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Kn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?wi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function El(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function wi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Kn(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Si=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],wl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null,_i=[],Ti=f(bl),Li=f(yl),Ci=f(Tl),ki=f(kl),xi=f(Ll);function Qn(e){_i=e??[],document.addEventListener("touchstart",Ti,{passive:!0}),document.addEventListener("touchend",Li,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Ci,{passive:!0}),window.addEventListener("orientationchange",ki,{passive:!0})),window.visualViewport?.addEventListener("resize",xi)}function Jn(){document.removeEventListener("touchstart",Ti),document.removeEventListener("touchend",Li),document.removeEventListener("gesturechange",Ci),window.removeEventListener("orientationchange",ki),window.visualViewport?.removeEventListener("resize",xi),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null}function Mi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function bl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Mi(e.touches),K=null)}function yl(e){if(me>0){let s=e.touches.length>=2?Mi(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Sl(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&_l(i,n,o),K=null}function Sl(e,t,n){if(v(e,_i))return;let o=xl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function _l(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Si.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Si.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Tl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!wl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Ll(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Cl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function kl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Gn>3e4&&(pe=0,Gn=e),t!==Zn&&(pe++,Zn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Cl()}}),pe=0)}function xl(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],eo=[],Ml=10,Al=5e3,Ai=5,Di=3e3,Dl=15,Rl=5e3,Ri=f(Il);function to(e){eo=e??[],document.addEventListener("keydown",Ri,{capture:!0,passive:!0})}function no(){document.removeEventListener("keydown",Ri,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",eo=[]}function Il(e){let t=Date.now(),n=e.target;n&&v(n,eo)||(e.key==="Tab"?Nl(t,n,e.shiftKey):e.key==="Escape"?Pl(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Hl(t,e.target))}function Ol(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Nl(e,t,n){for(;M.length&&e-M[0].ts>Al;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=Ml){let i=M.map(a=>a.el).filter(Boolean),s=Ol(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Di?(A++,F=i,A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function Pl(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===ge){if(e-he>Di){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Hl(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;H.length&&e-H[0].ts>Rl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Dl&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Fl=1e4,Bl=2,Vl=4,ql=3e3,Xe=null,Ht=0,Wl=2e3,Ii=f(Xl),Oi=f(Ul),Ni=f(zl);function io(){window.addEventListener("wheel",Oi,{passive:!0}),window.addEventListener("touchmove",Ni,{passive:!0}),window.addEventListener("scroll",Ii,{passive:!0})}function so(){window.removeEventListener("wheel",Oi),window.removeEventListener("touchmove",Ni),window.removeEventListener("scroll",Ii),Ft()}function Ft(){ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Xe=null,Ht=0}function Ul(){Xe="wheel",Ht=Date.now()}function zl(){Xe="touch",Ht=Date.now()}function Xl(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,Yl()}))}function Yl(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-oo>ql&&(ve=0,oo=e),ve++,ve>=Vl&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=Wl?Xe:"wheel";e-ro>Fl&&(Pt=0,ro=e),Pt++;let a=Pt>=Bl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Hi=f(jl),je=null,$e=null;function ao(){window.addEventListener("scroll",Hi,{passive:!0}),$e=y(Pi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Pi()}),document.addEventListener("visibilitychange",je)}function lo(){window.removeEventListener("scroll",Hi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function co(){ne=0,Ee=0,Ye=!1}function jl(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Pi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Fi=1500,Bi=15e3,$l=5e3,Kl=.15,uo="",we=0,Bt=0,Ke=0,be=0,fo=0,Vt=null,qt=0,Wt=!1,Ut=f(Zl),Vi=f(Ql),ye=f(Gl);function po(){Wt||(Wt=!0,fo=qi(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Vi,{passive:!0}))}function mo(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Vi),Wi(),uo="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){Wi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:Bi,cycle:e}})},Bi)}function go(){qt=0}function Gl(){Ge()}function Zl(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==uo||o-Bt>Fi)&&(uo=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Fi}}),we=0,Bt=o)}function Ql(){let e=Date.now(),t=qi(),n=fo||t,o=Math.abs(t-n)/Math.max(n,1);fo=t,!(o<Kl)&&((!Ke||e-Ke>$l)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function qi(){return Math.max(1,window.innerWidth*window.innerHeight)}function Wi(){Vt&&(clearTimeout(Vt),Vt=null)}var Ui=6e4,Jl=3,ec=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],tc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],zi=[],Xi=f(nc);function ho(e){zi=e??[],document.addEventListener("click",Xi,{capture:!0,passive:!0})}function vo(){document.removeEventListener("click",Xi,{capture:!0}),B=[]}function Eo(){B=[]}function nc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,zi)||!oc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Ui;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<Jl)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Ui}}),B=[]}function oc(e){let t=e;for(let n=0;n<3&&t;n++){if(rc(t)||ic(t))return!0;t=t.parentElement}return!1}function rc(e){for(let t of ec)try{if(e.matches(t))return!0}catch{}return!1}function ic(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return tc.test(o)}var Yi=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ji=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,$i=[],Ki=f(sc);function wo(e){$i=e??[],document.addEventListener("click",Ki,{capture:!0,passive:!0})}function bo(){document.removeEventListener("click",Ki,{capture:!0}),zt=[],Xt.clear()}function yo(){zt=[],Xt.clear()}function sc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$i)||!ac(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:cc(t),...u??{}}})}function ac(e){let t=e;for(let n=0;n<4&&t;n++){if(lc(t))return!0;t=t.parentElement}return!1}function lc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&ji.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if(Yi.test(r)||Yi.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ji.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function cc(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var uc=1500,I=null,Gi=[],Zi=f(dc),Qi=f(fc),Ji=f(pc);function So(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0}),document.addEventListener("keydown",Qi,{capture:!0,passive:!0}),window.addEventListener("popstate",Ji)}function _o(){document.removeEventListener("click",Zi,{capture:!0}),document.removeEventListener("keydown",Qi,{capture:!0}),window.removeEventListener("popstate",Ji),I=null}function To(){I=null}function dc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Gi)){if(mc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function fc(e){e.key==="Escape"&&es("escape")}function pc(){es("back_nav")}function es(e){if(!I)return;let t=Date.now()-I.t;if(t>uc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function mc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var ts=1e4,gc=3,hc=/^(checkbox|radio)$/,ns=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,Lo=[],os=f(vc),rs=f(Ec);function Co(e){Lo=e??[],document.addEventListener("change",os,{capture:!0,passive:!0}),document.addEventListener("click",rs,{capture:!0,passive:!0})}function ko(){document.removeEventListener("change",os,{capture:!0}),document.removeEventListener("click",rs,{capture:!0}),Ze.clear()}function xo(){Ze.clear()}function vc(e){let t=e.target;t&&(v(t,Lo)||wc(t)&&is(t))}function Ec(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Lo))return;let n=t.getAttribute("role")??"";ns.test(n)&&t.tagName!=="INPUT"&&is(t)}function is(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>ts;)o.shift();if(o.push({t:n}),o.length<gc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:ts}}),Ze.delete(t)}function wc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?hc.test(e.type??""):ns.test(e.getAttribute("role")??"")}var ss=15e3,bc=3,X=[],as=f(yc);function Mo(){document.addEventListener("copy",as,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("copy",as,{capture:!0}),X=[]}function Do(){X=[]}function yc(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ss;)X.shift();X.push({t:o}),!(X.length<bc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ss}}),X=[])}var ls=15e3,Sc=4,_c=5,Tc=500,Lc=2e3,D=[],Yt=0,Qe=null,oe=null;function Ro(){Qe=y(kc),oe=y(Cc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function Io(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Oo(){D=[],Yt=0}function Cc(){Yt=Date.now(),D=[]}function kc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<_c)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Lc)return;for(;D.length&&o-D[0].t>ls;)D.shift();let r=D[D.length-1];r&&o-r.t<Tc||(D.push({t:o}),!(D.length<Sc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:ls}}),D=[]))}var No=6e4,xc=20,us="_fd_sess",Mc={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},Ac=10,cs={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Po="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ds(e,Date.now())}function Dc(){try{let e=sessionStorage.getItem(us);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Rc(){try{sessionStorage.setItem(us,JSON.stringify(_e))}catch{}}function Ic(){let e=[],n=Date.now()-No,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ds(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>xc&&n.shift()}function Oc(e){let t=e-No,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function Nc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=Mc[n.type]??Ac;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function fs(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function Pc(e,t,n){return fs(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Hc(e,t,n,o){let r=fs(o),i=Ic();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Po||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:No,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,Rc()}function Fc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Oc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ds(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=Nc(),i=Pc(n.size,o,r);i&&(Se!==null&&cs[i]<=cs[Se]||(Se=i,Hc(i,n,o,r)))}function Ho(e){Po=e}function Fo(e){V=[],Se=null,$t=!0,Te=new Map,Po=e??"",Dc(),fn(Fc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function Bo(){$t=!1,V=[],Se=null,Te=new Map,fn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Bc=8,Vo=3e4,qo=5,Vc=5e3,O=[],G="",ot=!1,ps=f(Wc),ms=f(Uc);function Wo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",ps),window.addEventListener("hashchange",ms)}function Uo(){window.removeEventListener("popstate",ps),window.removeEventListener("hashchange",ms),O=[],ot=!1,G=""}function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Vo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<qo)&&(ot||qc(t))}function qc(e){let t=O.filter(c=>e-c.ts<=Vo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<qo||n.length===0||n.some(c=>c.leftAt-c.ts>=Vc)||new Set(n.map(c=>c.path)).size<qo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Bc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Vo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function Wc(){let e=location.pathname+location.search+location.hash;rt(e)}function Uc(){let e=location.pathname+location.search+location.hash;rt(e)}var zc=.3,gs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,hs=f(Xc),vs=f(jc);function Xo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",hs,{passive:!0}),window.addEventListener("click",vs,{capture:!0})}function Yo(){window.removeEventListener("scroll",hs),window.removeEventListener("click",vs,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function Xc(){it||(it=!0,requestAnimationFrame(Yc))}function Yc(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>gs&&(N=!1),re==="down"){let s=ie-t,a=n*zc;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function jc(e){if(!N)return;let t=Date.now();if(t-at>gs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var $c=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Kc=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Gc=/^(A|BUTTON|LABEL)$/,Zc=3,Es=9e4,Qc=5,lt=new Map,ws=[],ct=null,Jc=5,bs=f(eu),ys=f(su);function eu(e){ct={x:e.clientX,y:e.clientY}}function jo(e){ws=e??[],document.addEventListener("mousedown",bs,{capture:!0,passive:!0}),document.addEventListener("click",ys,{capture:!0,passive:!0})}function $o(){document.removeEventListener("mousedown",bs,{capture:!0}),document.removeEventListener("click",ys,{capture:!0}),ct=null,lt.clear()}function Ko(){lt.clear()}function tu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function nu(e,t){return e*4+t}function ou(e){if($c.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Kc.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Gc.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ru(){let e=window.getSelection();return e!==null&&e.toString().length>0}function iu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>Jc}function su(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ws)||ru()||iu(e)||ou(t))return;let{row:n,col:o}=tu(e.clientX,e.clientY),r=nu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<Es);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=Zc){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=Qc))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:Es}}),lt.set(r,[])}}var Go=3,Le=12e4,S=new Map,Zt=[],ut=null,Ss=f(du),Gt=f(fu);function Qo(e){Zt=e??[],document.addEventListener("invalid",Ss,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(pu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function Jo(){document.removeEventListener("invalid",Ss,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function er(){for(let e of S.values())Z(e);S.clear()}function Zo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function tr(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function au(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function lu(e){return f(t=>{Ls(e)})}function cu(e){return f(t=>{Ls(e)})}function _s(e,t){let n=lu(t),o=cu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Ts(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();au(t);let n=p(e),o=S.get(n);if(!o){_s(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n)))}function uu(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function Ls(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,tr(n.el)){n.cycles+=1,n.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Zo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function du(e){let t=e.target;t&&Ts(t)}function fu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||tr(t)&&_s(t,n)}function pu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=tr(n);i&&!r?Ts(n):!i&&r&&uu(n)}}var Ce=null,dt=null,or=[],Cs=0,ft=new Map;function rr(e){or=e?.length?e:["[data-fd-impression]"],Cs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(gu),{threshold:[0,.5,1]}),ks(),dt=new MutationObserver(y(mu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ir(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function sr(){ft.clear(),Ce&&ks()}function ks(){for(let e of or)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)nr(t[n])}catch{}}function nr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function mu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of or)try{o.matches(r)&&nr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)nr(i[s])}catch{}}}function gu(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Cs),viewport_position:s}})}}}var hu=2,vu=3,Eu=6e4,pt=new Map,xs=[],Ms=f(wu);function ar(e){xs=e??[],document.addEventListener("input",Ms,{capture:!0,passive:!0})}function lr(){document.removeEventListener("input",Ms,{capture:!0}),pt.clear()}function cr(){pt.clear()}function wu(e){let t=e.target;if(!t||!bu(t)||v(t,xs))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Eu){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=vu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=hu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:yu(t)}}),pt.delete(r);return}i.lastValue=o}function bu(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function yu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var As=2e3,Su=3e4,q=null,Ds=As,Rs=[],Jt=new Map,Is=f(_u),Os=f(Tu),Ns=f(mt);function ur(e,t){Ds=e?.dwellMs??As,Rs=t??[],document.addEventListener("mouseover",Is,{passive:!0}),document.addEventListener("mouseout",Os,{passive:!0}),document.addEventListener("click",Ns,{capture:!0,passive:!0})}function dr(){document.removeEventListener("mouseover",Is),document.removeEventListener("mouseout",Os),document.removeEventListener("click",Ns,{capture:!0}),mt(),Jt.clear()}function fr(){mt(),Jt.clear()}function _u(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Rs)||!Lu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Su)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Ds);q={el:t,selector:n,startTs:r,timer:i}}function Tu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Lu(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Cu=20,ku=500,xu=3e3,Mu=6e4,en=0,tn=0,W=null,Ps=y(Au);function pr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Ps)}function mr(){document.removeEventListener("mouseleave",Ps),W&&(clearTimeout(W),W=null)}function gr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Au(e){if(e.clientY>Cu)return;let t=Date.now();t-en<xu||t-tn<Mu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),ku))}var Du=2500,Ru=4e3,Hs=200,Iu=500,Ou=.1,Nu=.25,xe=null,Me=null,j=null,ke=0;function hr(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function vr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:hr(o,Du,Ru)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Hs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:hr(o,Hs,Iu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Fs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:hr(ke,Ou,Nu)}})}ke=0}}function Er(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Fs()}function wr(){if(Fs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var Bs=[],Vs=f(Pu);function br(e){Bs=e??[],document.addEventListener("paste",Vs,{capture:!0,passive:!0})}function yr(){document.removeEventListener("paste",Vs,{capture:!0})}function Pu(e){let t=e.target;if(!t||!Hu(t)||v(t,Bs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Fu(t)}})},100)}function Hu(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Fu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Bu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Vu(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function Ws(e){if(Q||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Yu()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=kr(e.cookieless??!1),n=Vu(e.endpoint)??Bu,o=gn(location.pathname,e.pageRules??[]),r=ju(e.domMode);Vr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=qs(location.pathname,e.ignorePages??[]);i&&pn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&vn(e.signals?.rageClick,u),l("deadClick")&&wn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;_n(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Mn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&In(e.signals?.loopNav),l("scrollBounce")&&Bn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Un(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&Qo(u)}if(l("errorEncounter")&&jn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&Qn(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&to(u),l("scrollHijack")&&io(),l("scrollDepthAbandon")&&ao(),l("advancedHeuristics")&&po(),l("helpHunt")&&ho(u),l("closeClick")&&wo(u),l("closeClickReversal")&&So(u),l("filterSpiral")&&Co(u),l("copyFrustration")&&Mo(),l("textSelectFrustration")&&Ro(),l("deadClickTrapZone")&&jo(u),Fo(o),l("navigationConfusion")&&Wo(),l("scrollToClickConfusion")&&Xo(),l("elementImpression")&&rr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&ar(u),e.trackForms!==!1&&l("pasteBlocked")&&br(u),l("hoverDwell")){let c=e.signals?.hoverDwell;ur(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&pr(),l("performanceVitals")&&vr(),nn=Ur(y((c,m)=>{J(),qn(),Xn(),co(),Ln(),Ge(),go(),Eo(),yo(),To(),xo(),Do(),Oo(),Ko(),er(),yn(),Ft(),Kt(),zo(),sr(),cr(),fr(),gr(),wr(),rt(m),Ho(m);let E=gn(m,e.pageRules??[]),w=qs(m,e.ignorePages??[]);pn(w),mn({page:E,url:c}),Nn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function qu(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Wu(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Uu(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}mn({segment:t})}function zu(e){e&&gt&&!Q?Ws(gt):e||(Sr(),an())}function Xu(){Sr(),an()}function Sr(){Q&&(En(),bn(),Tn(),An(),On(),Vn(),zn(),$n(),Jn(),no(),so(),lo(),mo(),vo(),bo(),_o(),ko(),Ao(),Io(),$o(),Jo(),Bo(),Uo(),Yo(),ir(),lr(),dr(),mr(),Er(),yr(),qr(),nn&&(nn(),nn=null),Q=!1)}function Yu(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ju(e){return e==="metadata"||e==="snapshot"?e:"off"}function qs(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}export{Sr as destroy,Uu as identify,Ws as init,Xu as optOut,zu as setConsent,qu as signal,Wu as track};
1
+ function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var En="_fd_s";var Ma=/^[0-9a-f]{32}$/;function zo(e){if(e)return qo();let t=ka(En);if(t&&Ma.test(t))return t;let n=qo();return Xo(En,n,30),n}function bn(){Xo(En,"",-1)}function qo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function ka(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Xo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var xa=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Ne(t)}"]`;if(e.id&&!xa.test(e.id)&&e.id.length<64)return"#"+Ne(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${Ne(s)}"]`:a?i+=`[role="${Ne(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${Ne(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function Ne(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Pe=60,Aa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Da=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Pe);if(!Da.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Pe);if(i&&!Aa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Pe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Pe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Pe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Yo(e,t){if(t==="off")return null;if(t==="metadata")return Ra(e);let n=Ia(e);return n?{mode:"snapshot",...n}:null}function Ra(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:$o(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:$o(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Oa(e)}}}function Ia(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Pa(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Na(t),animations:i,siblings:o}}catch{return null}}function $o(e,t){return e&&t.includes(e)?e:null}function Oa(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Na(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Pa(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Ko=7e3,Ha=500,Fa=1e4,Go=50,Zo=100,Ba=3,He=6e4,Ct="application/json",Wa="application/json; encoding=gzip",ue=[],Z=null,Qo="",Jo=Ko,ei=Go,S=null,Mt={domMode:"off",compression:"auto"},yn=!1,Sn=null,Tn=!1;function Ln(e){Sn=e}var kt=new Set;function ti(e){return kt.add(e),()=>{kt.delete(e)}}function Va(e){if(e.t!=="sig"||!kt.size)return;let t=typeof e.d?.s=="string"?e.d.s:"";if(t)for(let n of kt)try{n(t,e.ts)}catch{}}function Cn(e){Tn=e}var Ua=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),qa=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),za=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function Xa(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>za.has(n))}var $a=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,ni=f(ja),ri=y(()=>ne());function oi(e,t,n,r,o){Qo=e,S=Object.assign(Object.create(null),t),Mt={domMode:nl(o?.domMode),compression:rl(o?.compression)},Jo=Math.max(Ha,Math.min(n??Ko,Fa)),ei=Math.max(1,Math.min(r??Go,Zo)),document.addEventListener("visibilitychange",ni),window.addEventListener("pagehide",ri)}function u(e){Tn||ue.length>=Zo||(Va(e),ue.push(e),ue.length>=ei?ne():Z||(Z=setTimeout(ne,Jo)))}function ne(){Ya()}async function Ya(){if(yn||!ue.length||!S)return;yn=!0,Z&&(clearTimeout(Z),Z=null);let e=ue;ue=[];let t={v:1,sid:S.sid,key:S.key,url:S.url,page:S.page,ts:Date.now(),ua:S.ua,vw:S.vw,vh:S.vh,environment:S.environment,...S.segment?{segment:S.segment}:{},dom_mode:Mt.domMode},n=e.map(o=>Qa(o,S.page,Mt.domMode)),r=[];try{for(let o of n){let i=[...r,o];if(JSON.stringify({...t,events:i}).length>He)if(r.length>0)await _n({...t,events:r}),r=[o];else{let a={...t,events:[o]};JSON.stringify(a).length<=He?await _n(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r=[]}else r=i}r.length>0&&await _n({...t,events:r})}catch{}finally{yn=!1}}function Mn(e){if(S)for(let t of Object.keys(e))Ua.has(t)&&(S[t]=e[t])}function ii(){ne(),Tn=!1,document.removeEventListener("visibilitychange",ni),window.removeEventListener("pagehide",ri),Z&&(clearTimeout(Z),Z=null)}function ja(){document.visibilityState==="hidden"&&ne()}async function _n(e){let t=JSON.stringify(e),n=await Ka(t,Mt.compression);n&&si(n,0)}async function Ka(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>He)return null;if(t!=="off"){let o=await Ga(e);if(o&&o.byteLength<=He)return{beaconBody:new Blob([o],{type:Wa}),fetchBody:new Uint8Array(o),headers:{"Content-Type":Ct,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:Ct}),fetchBody:e,headers:{"Content-Type":Ct}}}async function Ga(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=Za(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>He)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function Za(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:Ct});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}function si(e,t,n=Qo){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<Ba&&setTimeout(()=>si(e,t+1,n),1e3*(t+1))})}catch{}}function Qa(e,t,n){let r=e.d??{},o=Ja(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=jo(r.el,r.element,r.target);if(o==="signal"){i.signal_type=jo(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?tl(s,n):null;c&&(i.dom=c),i.signal_type&&Sn&&Sn(i.signal_type)}let a=el(r);return Object.keys(a).length&&(i.metadata=a),i}function Ja(e){return e==="pv"?"pageview":e==="sig"?"signal":qa.has(e)?e:"custom_signal"}function el(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=xt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=xt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function xt(e,t="",n=0){if(!(n>4)&&!Xa(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return $a.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>xt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=xt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function tl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Yo(n,t):null}catch{return null}}function jo(...e){for(let t of e)if(typeof t=="string"&&t)return t}function nl(e){return e==="metadata"||e==="snapshot"?e:"off"}function rl(e){return e==="off"?"off":"auto"}function ai(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function kn(e,t){for(let n of t){let r=il(n.pattern);if(r&&r.test(e))return n.label}return sl(e)}var ol=/^[a-zA-Z0-9/:._*\-]+$/;function il(e){if(e.length>200||!ol.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function sl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var al=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],B=[],li=3,ci=2e3,ui=24,At=ui,di=[],de=[],fi=0,Dt=new Map,Rt=new Map,ll=1e4,It=!1,pi=f(cl);function xn(e,t){It||(It=!0,li=e?.threshold??3,ci=e?.windowMs??2e3,At=e?.radius&&e.radius>0?e.radius:ui,di=[...al,...t??[]],fi=Date.now(),B=[],de=[],Dt.clear(),Rt.clear(),document.addEventListener("click",pi,{capture:!0,passive:!0}))}function An(){It&&(It=!1,document.removeEventListener("click",pi,{capture:!0,passive:!0}),B=[],de=[],Dt.clear(),Rt.clear())}function cl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,di)||pl(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;B.length&&n-B[0].t>ci;)B.shift();B.push({t:n,x:r,y:o});let i=ul();if(B.length<i)return;let s=B.slice(-i);for(let M=0;M<s.length-1;M++)for(let Oe=M+1;Oe<s.length;Oe++){let St=s[M],Tt=s[Oe],Lt=Tt.x-St.x,ce=Tt.y-St.y;if(Lt*Lt+ce*ce>At*At)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=fl(s,i,l),b=p(t),m=h(t);de.push({selector:b,ts:n});let $=de.length,_t=dl(n),Wo=Dt.get(b)??0,vn=Wo+1,Vo=Rt.get(b)??0,La=Vo>0&&n-Vo<ll;Dt.set(b,vn),Rt.set(b,n);let Uo=Wo>=1,Ca=(()=>{try{let M=t.getBoundingClientRect();if(M.width===0&&M.height===0)return null;let Oe=s.reduce((ce,wn)=>ce+wn.x,0)/s.length,St=s.reduce((ce,wn)=>ce+wn.y,0)/s.length,Tt=M.left+M.width/2,Lt=M.top+M.height/2;return{click_dx:Math.round(Oe-Tt),click_dy:Math.round(St-Lt),el_w:Math.round(M.width),el_h:Math.round(M.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:$,burst_rate_per_min:_t,repeated_target:Uo,hot_repeat:La,...Ca??{}}}),Uo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:vn,burst_count:vn,burst_seq:$}}),B=B.slice(-(i-1))}function ul(){return de.length>=3?2:li}function dl(e){let t=(e-fi)/6e4;return t<=0?0:Math.round(de.length/t*10)/10}function fl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],$=m.x-b.x,_t=m.y-b.y;d+=Math.sqrt($*$+_t*_t),l++}let g=d/l;a=Math.max(0,2-g/At*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function pl(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var ml=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,gl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,hl=/^(A|BUTTON|LABEL)$/,vl=20,mi=[],fe=null,wl=5,Ot=new Map,gi=f(El),hi=f(_l);function El(e){fe={x:e.clientX,y:e.clientY}}function Dn(e){mi=e??[],document.addEventListener("mousedown",gi,{capture:!0,passive:!0}),document.addEventListener("click",hi,{capture:!0,passive:!0})}function Rn(){document.removeEventListener("mousedown",gi,{capture:!0}),document.removeEventListener("click",hi,{capture:!0}),fe=null,Ot.clear()}function In(){Ot.clear()}function bl(e){try{return window.getComputedStyle(e).cursor.slice(0,vl)}catch{return""}}function yl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function _l(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,mi)||Cl())return;let n=Ml(e);if(fe=null,n||Sl(t))return;let r=Tl(t,e.clientX,e.clientY),o=r?vi(e.clientX,e.clientY,r):null,i=p(t),a=(Ot.get(i)??0)+1;Ot.set(i,a);let c=a>=2,d=bl(t),l=yl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function Sl(e){if(ml.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&gl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&hl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Tl(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Ll(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function vi(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Ll(e,t,n){return vi(e,t,n).dist}function Cl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Ml(e){if(!fe)return!1;let t=e.clientX-fe.x,n=e.clientY-fe.y;return Math.sqrt(t*t+n*n)>wl}var T=null,On=3e3,wi=[],Nt="click",Pt=0,kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,xl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Ei=f(Rl),bi=f(Al),yi=f(Dl);function Nn(e,t){On=e?.delayMs??3e3,wi=t??[],document.addEventListener("click",Ei,{capture:!0,passive:!0}),document.addEventListener("keydown",bi,{capture:!0,passive:!0}),document.addEventListener("touchstart",yi,{capture:!0,passive:!0})}function Pn(){document.removeEventListener("click",Ei,{capture:!0}),document.removeEventListener("keydown",bi,{capture:!0}),document.removeEventListener("touchstart",yi,{capture:!0}),pe()}function Hn(){pe()}function Al(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Nt="keydown",Pt=Date.now()))}function Dl(){Nt="touch",Pt=Date.now()}function Rl(e){let t=e.target;if(!t||v(t,wi))return;let n=t.getAttribute("role");if(!kl.test(t.tagName)&&!(n&&xl.test(n)))return;let r=Date.now();if(r-Pt>50&&(Nt="click",Pt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=On&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Nt,observed_delay_ms:d}}),pe();return}pe()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,pe();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,pe();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},On+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function pe(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Il=100,Ol=5,_i=800,Si=2e3,Nl=3,Bn=0,Pl=16,Ht=0,Ft=0,Fe=0,Be=0,We=0,Bt=0,Fn=0,re=[],Wn=0,me=null,Ti=f(Hl);function Vn(e){_i=e?.velocityThreshold??800,Si=e?.windowMs??2e3,document.addEventListener("mousemove",Ti,{passive:!0})}function Un(){document.removeEventListener("mousemove",Ti),me&&clearTimeout(me),qn()}function Hl(e){let t=Date.now();t-Bn<Pl||(Bn=t,me&&clearTimeout(me),me=setTimeout(()=>qn(),150),Fl(e.clientX,e.clientY,t))}function Fl(e,t,n){if(Fe===0){Ht=e,Ft=t,Fe=n,Fn=n;return}let r=(n-Fe)/1e3;if(r===0)return;let o=e-Ht,i=t-Ft;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;re.length>=Il&&(re=re.slice(-50)),re.push(a),Wn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=Ol&&(Be!==0&&c!==0&&c!==Be||We!==0&&d!==0&&d!==We)&&Bt++,Be=c||Be,We=d||We,Ht=e,Ft=t,Fe=n,n-Fn>Si){if(Bt>=Nl){let l=re.reduce((g,w)=>g+w,0)/re.length;l>=_i&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Bt,distance_px:Math.round(Wn)}})}qn(),Fn=n}}function qn(){Bt=0,re=[],Wn=0,Be=0,We=0,Fe=0,Ht=0,Ft=0,Bn=0,me=null}var Li=100,Ci=5,Bl=3,L=[],k=[],zn=3e4;function Xn(e){zn=e?.windowMs??3e4}function $n(){L=[],k=[]}function Yn(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>zn;)L.shift();for(;k.length&&t-k[0].ts>zn;)k.shift();if(L.length>=Li&&(L=L.slice(-50)),k.length>=Li&&(k=k.slice(-50)),L.push({path:e,ts:t}),o){k.push({path:e,ts:t});let a=k.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=Bl&&a.length>c.size){let d=a.slice(-Ci).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),k=k.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ci).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],k=k.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var Wl=100,Mi=1e4,Kn=.5,C=[],Wt=0,Gn=0,Ve=!1,jn=0,ki=f(Vl);function Zn(e){Mi=e?.windowMs??1e4,Kn=e?.depthThreshold??.5,window.addEventListener("scroll",ki,{passive:!0})}function Qn(){window.removeEventListener("scroll",ki),C=[],Ve=!1}function Jn(){C=[],Wt=0,Gn=0,Ve=!1}function Vl(){Ve||(Ve=!0,requestAnimationFrame(()=>{Ve=!1,Ul()}))}function Ul(){let e=Date.now(),t=window.scrollY;if(jn=document.documentElement.scrollHeight-window.innerHeight,jn<=0)return;let n=t/jn,r=t>Wt?"down":"up";if(e-Gn<100){Wt=t;return}for(;C.length&&e-C[0].ts>Mi;)C.shift();C.length>=Wl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),Wt=t,Gn=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=Kn&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=Kn){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var ql=["textarea",'[role="textbox"]',"[contenteditable]"],qe=new Map,ze=new Map,Y=new Set,oe=null,er=0,xi=5e3,Ai=[],zl=50,Di=f(Xl),Ri=f($l),Ii=f(Yl),Oi=y(Ni),Ue=null;function tr(e,t){xi=e?.pauseMs??5e3,Ai=t??[],document.addEventListener("focusin",Di,{capture:!0,passive:!0}),document.addEventListener("focusout",Ri,{capture:!0,passive:!0}),document.addEventListener("submit",Ii,{capture:!0,passive:!0}),window.addEventListener("pagehide",Oi),Ue=y(()=>{document.visibilityState==="hidden"&&Ni()}),document.addEventListener("visibilitychange",Ue)}function nr(){document.removeEventListener("focusin",Di,{capture:!0}),document.removeEventListener("focusout",Ri,{capture:!0}),document.removeEventListener("submit",Ii,{capture:!0}),window.removeEventListener("pagehide",Oi),Ue&&(document.removeEventListener("visibilitychange",Ue),Ue=null),qe.clear(),ze.clear(),Y.clear(),oe=null}function rr(){qe.clear(),ze.clear(),Y.clear(),oe=null,er=0}function Xl(e){let t=e.target;if(!t||!Pi(t)||v(t,Ai)||jl(t))return;let n=Date.now();qe.set(t,n),ze.set(t,n);let r=t.closest("form");r&&r!==oe&&(oe=r,er=r.querySelectorAll("input, select, textarea").length)}function $l(e){let t=e.target;if(!t||!Pi(t))return;let n=qe.get(t),r=ze.get(t);qe.delete(t),ze.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<zl)&&n!==void 0){let a=o-n;if(a>=xi){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Kl(t)&&Y.add(s)}function Yl(){Y.clear(),oe=null}function Ni(){if(Y.size>0&&oe){let e=er||Y.size,t=Math.round(Y.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:Y.size,total:e,field_count:e,completion_rate:t}}),Y.clear(),oe=null}}function Pi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function jl(e){if(e.tagName==="TEXTAREA")return!0;for(let t of ql)try{if(e.matches(t))return!0}catch{return!1}return!1}function Kl(e){return"value"in e?e.value.length>0:!1}var ge=null,Xe=null,Hi=/flusterduck\.com|\/v1\/ingest/,Bi=f(Ql),Wi=f(Jl);function ir(){window.addEventListener("error",Bi),window.addEventListener("unhandledrejection",Wi),ec()}function sr(){window.removeEventListener("error",Bi),window.removeEventListener("unhandledrejection",Wi),tc()}var or=/fetch|network|cors|timeout/i;function Gl(e){return or.test(e)?"network":"script"}function Zl(e){if(e instanceof TypeError&&or.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return or.test(t)?"network":"unhandled_promise"}function Ql(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:ar(t,200),ep:"",status:0,error_category:Gl(t),url:location.pathname}})}function Jl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:ar(t,200),ep:"",status:0,error_category:Zl(e.reason),url:location.pathname}})}function ec(){ge||(ge=window.fetch,Xe=function(t,n){let r;try{r=ge.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Hi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Fi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Hi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:ar(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Fi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=Xe)}function tc(){ge&&Xe&&window.fetch===Xe&&(window.fetch=ge),ge=null,Xe=null}function Fi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function ar(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var Vi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],nc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,lr=0,cr=null,Ui=[],qi=f(rc),zi=f(oc),Xi=f(ac),$i=f(uc),Yi=f(lc);function ur(e){Ui=e??[],document.addEventListener("touchstart",qi,{passive:!0}),document.addEventListener("touchend",zi,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Xi,{passive:!0}),window.addEventListener("orientationchange",$i,{passive:!0})),window.visualViewport?.addEventListener("resize",Yi)}function dr(){document.removeEventListener("touchstart",qi),document.removeEventListener("touchend",zi),document.removeEventListener("gesturechange",Xi),window.removeEventListener("orientationchange",$i),window.visualViewport?.removeEventListener("resize",Yi),Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,lr=0,cr=null}function ji(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function rc(e){let t=e.touches[0];e.touches.length===1&&t?(Q={x:t.clientX,y:t.clientY,ts:Date.now()},ve=0):e.touches.length===2&&(ve=ji(e.touches),Q=null)}function oc(e){if(ve>0){let s=e.touches.length>=2?ji(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&($e=Math.round(s/ve*100)/100),ve=0}if(!Q||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-Q.x,r=t.clientY-Q.y,o=Date.now()-Q.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&ic(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&sc(i,n,r),Q=null}function ic(e,t,n){if(v(e,Ui))return;let r=dc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function sc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Vi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Vi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function ac(){let e=Date.now();if(e-Ye>3e4&&(I=0,Ye=e),I++,I>=2){let t=document.activeElement||document.body;!nc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-je>200&&(je=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:$e}})),I=0,$e=1}}function lc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ye>3e4&&(I=0,Ye=t),I++,I>=2&&t-je>200){let n=Math.round(e.scale*100)/100;je=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,$e=1}}}function cc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function uc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-lr>3e4&&(he=0,lr=e),t!==cr&&(he++,cr=t),he>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:he,orientation:cc()}}),he=0)}function dc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],we=null,A=0,Ee=0,V="",W=[],fr=[],fc=10,pc=5e3,Ki=5,Gi=3e3,mc=15,gc=5e3,Zi=f(hc);function pr(e){fr=e??[],document.addEventListener("keydown",Zi,{capture:!0,passive:!0})}function mr(){document.removeEventListener("keydown",Zi,{capture:!0}),x=[],W=[],we=null,A=0,Ee=0,V="",fr=[]}function hc(e){let t=Date.now(),n=e.target;n&&v(n,fr)||(e.key==="Tab"?wc(t,n,e.shiftKey):e.key==="Escape"?Ec(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&bc(t,e.target))}function vc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function wc(e,t,n){for(;x.length&&e-x[0].ts>pc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=fc){let i=x.map(a=>a.el).filter(Boolean),s=vc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===we?e-Ee<=Gi?(A++,V=i,A>=Ki&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",we=null)):(Ee=e,A=1,V=i):(we=o,Ee=e,A=1,V=i)}}function Ec(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===we){if(e-Ee>Gi){Ee=e,A=1,V=p(t);return}A++,V=p(t),A>=Ki&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",we=null)}}function bc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;W.length&&e-W[0].ts>gc;)W.shift();W.length>=50&&(W=W.slice(-25)),W.push({ts:e,container:n});let r=W.filter(o=>o.container===n);r.length>=mc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),W=[])}var be=0,Vt=0,Ut=null,gr=0,qt=!1,zt=0,hr=0,yc=1e4,_c=2,Sc=4,Tc=3e3,Ke=null,Xt=0,Lc=2e3,Qi=f(kc),Ji=f(Cc),es=f(Mc);function vr(){window.addEventListener("wheel",Ji,{passive:!0}),window.addEventListener("touchmove",es,{passive:!0}),window.addEventListener("scroll",Qi,{passive:!0})}function wr(){window.removeEventListener("wheel",Ji),window.removeEventListener("touchmove",es),window.removeEventListener("scroll",Qi),$t()}function $t(){be=0,Vt=0,Ut=null,gr=0,qt=!1,zt=0,hr=0,Ke=null,Xt=0}function Cc(){Ke="wheel",Xt=Date.now()}function Mc(){Ke="touch",Xt=Date.now()}function kc(){qt||(qt=!0,requestAnimationFrame(()=>{qt=!1,xc()}))}function xc(){let e=Date.now(),t=window.scrollY,n=t-Vt;if(Math.abs(n)<2){Vt=t;return}let r=n>0?"down":"up";if(Ut&&r!==Ut&&(e-gr>Tc&&(be=0,gr=e),be++,be>=Sc&&Math.abs(n)>100)){let i=e-Xt,s=Ke!==null&&i<=Lc?Ke:"wheel";e-hr>yc&&(zt=0,hr=e),zt++;let a=zt>=_c;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:be,source:s,repeated:a}}),be=0}Ut=r,Vt=t}var ie=0,ye=0,Ge=!1,ns=f(Ac),Ze=null,Qe=null;function Er(){window.addEventListener("scroll",ns,{passive:!0}),Qe=y(ts),window.addEventListener("pagehide",Qe),Ze=y(()=>{document.visibilityState==="hidden"&&ts()}),document.addEventListener("visibilitychange",Ze)}function br(){window.removeEventListener("scroll",ns),Qe&&(window.removeEventListener("pagehide",Qe),Qe=null),Ze&&(document.removeEventListener("visibilitychange",Ze),Ze=null),ie=0,ye=0,Ge=!1}function yr(){ie=0,ye=0,Ge=!1}function Ac(){Ge||(Ge=!0,requestAnimationFrame(()=>{Ge=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ie&&(ie=t,ye===0&&(ye=Date.now()))}}))}function ts(){if(ie>.05){let e=Date.now(),t=ye>0?Math.max(0,e-ye):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ie*100)/100,max_depth:Math.round(ie*100),dwell_ms:t}})}}var rs=1500,os=15e3,Dc=5e3,Rc=.15,_r="",_e=0,Yt=0,Je=0,Se=0,Sr=0,jt=null,Kt=0,Gt=!1,Zt=f(Oc),is=f(Nc),Te=f(Ic);function Tr(){Gt||(Gt=!0,Sr=ss(),et(),document.addEventListener("mouseenter",Zt,!0),document.addEventListener("mouseleave",Zt,!0),document.addEventListener("click",Te,{capture:!0,passive:!0}),document.addEventListener("keydown",Te,{capture:!0,passive:!0}),document.addEventListener("scroll",Te,{passive:!0}),window.addEventListener("resize",is,{passive:!0}))}function Lr(){Gt&&(Gt=!1,document.removeEventListener("mouseenter",Zt,!0),document.removeEventListener("mouseleave",Zt,!0),document.removeEventListener("click",Te,{capture:!0}),document.removeEventListener("keydown",Te,{capture:!0}),document.removeEventListener("scroll",Te),window.removeEventListener("resize",is),as(),_r="",_e=0,Yt=0,Se=0,Je=0,Kt=0)}function et(){as(),Kt+=1;let e=Kt;jt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:os,cycle:e}})},os)}function Cr(){Kt=0}function Ic(){et()}function Oc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==_r||r-Yt>rs)&&(_r=n,Yt=r,_e=0),_e+=1,!(_e<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:_e,window_ms:rs}}),_e=0,Yt=r)}function Nc(){let e=Date.now(),t=ss(),n=Sr||t,r=Math.abs(t-n)/Math.max(n,1);Sr=t,!(r<Rc)&&((!Je||e-Je>Dc)&&(Je=e,Se=0),Se+=1,!(Se<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Se,area_delta:Math.round(r*1e3)/1e3}}),Se=0,Je=e))}function ss(){return Math.max(1,window.innerWidth*window.innerHeight)}function as(){jt&&(clearTimeout(jt),jt=null)}var ls=6e4,Pc=3,Hc=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],Fc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,U=[],cs=[],us=f(Bc);function Mr(e){cs=e??[],document.addEventListener("click",us,{capture:!0,passive:!0})}function kr(){document.removeEventListener("click",us,{capture:!0}),U=[]}function xr(){U=[]}function Bc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,cs)||!Wc(t))return;let n=Date.now();for(;U.length&&n-U[0].t>ls;)U.shift();let r=p(t);if(U.push({t:n,el:r}),U.length<Pc)return;let o=new Set(U.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:U.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ls}}),U=[]}function Wc(e){let t=e;for(let n=0;n<3&&t;n++){if(Vc(t)||Uc(t))return!0;t=t.parentElement}return!1}function Vc(e){for(let t of Hc)try{if(e.matches(t))return!0}catch{}return!1}function Uc(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return Fc.test(r)}var ds=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,fs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Qt=[],Jt=new Map,ps=[],ms=f(qc);function Ar(e){ps=e??[],document.addEventListener("click",ms,{capture:!0,passive:!0})}function Dr(){document.removeEventListener("click",ms,{capture:!0}),Qt=[],Jt.clear()}function Rr(){Qt=[],Jt.clear()}function qc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ps)||!zc(t))return;let n=Date.now(),r=p(t),o=h(t);Qt.push({t:n,el:r});let s=(Jt.get(r)??0)+1;Jt.set(r,s);let a=Qt.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:$c(t),...c??{}}})}function zc(e){let t=e;for(let n=0;n<4&&t;n++){if(Xc(t))return!0;t=t.parentElement}return!1}function Xc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&fs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ds.test(o)||ds.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&fs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function $c(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var Yc=1500,O=null,gs=[],hs=f(jc),vs=f(Kc),ws=f(Gc);function Ir(e){gs=e??[],document.addEventListener("click",hs,{capture:!0,passive:!0}),document.addEventListener("keydown",vs,{capture:!0,passive:!0}),window.addEventListener("popstate",ws)}function Or(){document.removeEventListener("click",hs,{capture:!0}),document.removeEventListener("keydown",vs,{capture:!0}),window.removeEventListener("popstate",ws),O=null}function Nr(){O=null}function jc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,gs)){if(Zc(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function Kc(e){e.key==="Escape"&&Es("escape")}function Gc(){Es("back_nav")}function Es(e){if(!O)return;let t=Date.now()-O.t;if(t>Yc){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function Zc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var bs=1e4,Qc=3,Jc=/^(checkbox|radio)$/,ys=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,tt=new Map,Pr=[],_s=f(eu),Ss=f(tu);function Hr(e){Pr=e??[],document.addEventListener("change",_s,{capture:!0,passive:!0}),document.addEventListener("click",Ss,{capture:!0,passive:!0})}function Fr(){document.removeEventListener("change",_s,{capture:!0}),document.removeEventListener("click",Ss,{capture:!0}),tt.clear()}function Br(){tt.clear()}function eu(e){let t=e.target;t&&(v(t,Pr)||nu(t)&&Ts(t))}function tu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Pr))return;let n=t.getAttribute("role")??"";ys.test(n)&&t.tagName!=="INPUT"&&Ts(t)}function Ts(e){let t=p(e),n=Date.now(),r=tt.get(t);for(r||(r=[],tt.set(t,r));r.length&&n-r[0].t>bs;)r.shift();if(r.push({t:n}),r.length<Qc)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:bs}}),tt.delete(t)}function nu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?Jc.test(e.type??""):ys.test(e.getAttribute("role")??"")}var Ls=15e3,ru=3,j=[],Cs=f(ou);function Wr(){document.addEventListener("copy",Cs,{capture:!0,passive:!0})}function Vr(){document.removeEventListener("copy",Cs,{capture:!0}),j=[]}function Ur(){j=[]}function ou(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;j.length&&r-j[0].t>Ls;)j.shift();j.push({t:r}),!(j.length<ru)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:j.length,window_ms:Ls}}),j=[])}var Ms=15e3,iu=4,su=5,au=500,lu=2e3,D=[],en=0,nt=null,se=null;function qr(){nt=y(uu),se=y(cu),document.addEventListener("selectionchange",nt),document.addEventListener("copy",se,{capture:!0,passive:!0}),document.addEventListener("cut",se,{capture:!0,passive:!0})}function zr(){nt&&(document.removeEventListener("selectionchange",nt),nt=null),se&&(document.removeEventListener("copy",se,{capture:!0}),document.removeEventListener("cut",se,{capture:!0}),se=null),D=[],en=0}function Xr(){D=[],en=0}function cu(){en=Date.now(),D=[]}function uu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<su)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-en<lu)return;for(;D.length&&r-D[0].t>Ms;)D.shift();let o=D[D.length-1];o&&r-o.t<au||(D.push({t:r}),!(D.length<iu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:Ms}}),D=[]))}var $r=6e4,du=20,xs="_fd_sess",fu={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},pu=10,ks={low:1,medium:2,high:3,critical:4},q=[],Le=null,nn=!1,Me=new Map,Ce={totalSignals:0,pagesWithFrustration:0},Yr="",rt=null,ot=null,it=null,st=null;function tn(e){nn&&As(e,Date.now())}function mu(){try{let e=sessionStorage.getItem(xs);if(e){let t=JSON.parse(e);Ce={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function gu(){try{sessionStorage.setItem(xs,JSON.stringify(Ce))}catch{}}function hu(){let e=[],n=Date.now()-$r,r=[];for(let[o,i]of Me.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function As(e,t){Me.has(e)||Me.set(e,[]);let n=Me.get(e);n.push(t),n.length>du&&n.shift()}function vu(e){let t=e-$r,n=0;for(;n<q.length&&q[n].ts<t;)n++;n>0&&(q=q.slice(n))}function wu(){let e=new Map,t=0;for(let n of q)e.set(n.type,(e.get(n.type)??0)+1),t+=fu[n.type]??pu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Ds(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Eu(e,t,n){return Ds(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function bu(e,t,n,r){let o=Ds(r),i=hu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Yr||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:$r,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Ce.totalSignals,session_pages_with_frustration:Ce.pagesWithFrustration}}),Ce.totalSignals+=q.length,Ce.pagesWithFrustration+=1,gu()}function yu(e){if(!nn||e==="frustration_burst")return;let t=Date.now();vu(t),q.length===0&&(Le=null),q.push({type:e,ts:t}),As(e,t);let{distinctTypes:n,totalWeight:r,typeCounts:o}=wu(),i=Eu(n.size,r,o);i&&(Le!==null&&ks[i]<=ks[Le]||(Le=i,bu(i,n,r,o)))}function jr(e){Yr=e}function Kr(e){q=[],Le=null,nn=!0,Me=new Map,Yr=e??"",mu(),Ln(yu),rt=()=>tn("popstate"),ot=()=>tn("hashchange"),it=()=>{document.visibilityState==="hidden"&&tn("visibilitychange")},st=()=>tn("pagehide"),window.addEventListener("popstate",rt),window.addEventListener("hashchange",ot),document.addEventListener("visibilitychange",it),window.addEventListener("pagehide",st)}function Gr(){nn=!1,q=[],Le=null,Me=new Map,Ln(null),rt&&(window.removeEventListener("popstate",rt),rt=null),ot&&(window.removeEventListener("hashchange",ot),ot=null),it&&(document.removeEventListener("visibilitychange",it),it=null),st&&(window.removeEventListener("pagehide",st),st=null)}var _u=8,Zr=3e4,Qr=5,Su=5e3,N=[],J="",at=!1,Rs=f(Lu),Is=f(Cu);function Jr(){N=[],at=!1,J=location.pathname+location.search+location.hash,window.addEventListener("popstate",Rs),window.addEventListener("hashchange",Is)}function eo(){window.removeEventListener("popstate",Rs),window.removeEventListener("hashchange",Is),N=[],at=!1,J=""}function to(){N=[],at=!1,J=location.pathname+location.search+location.hash}function lt(e){let t=Date.now();if(J&&J!==e){let n=N[N.length-1];n&&n.path===J&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>Zr;)N.shift();e!==J&&(N.push({path:e,ts:t,leftAt:null}),J=e),!(N.length<Qr)&&(at||Tu(t))}function Tu(e){let t=N.filter(l=>e-l.ts<=Zr),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<Qr||n.length===0||n.some(l=>l.leftAt-l.ts>=Su)||new Set(n.map(l=>l.path)).size<Qr)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-_u);at=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:Zr,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Lu(){let e=location.pathname+location.search+location.hash;lt(e)}function Cu(){let e=location.pathname+location.search+location.hash;lt(e)}var Mu=.3,Os=3e3,K=[],ct=!1,ae="none",le=0,ut=0,dt=0,P=!1,Ns=f(ku),Ps=f(Au);function no(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1,window.addEventListener("scroll",Ns,{passive:!0}),window.addEventListener("click",Ps,{capture:!0})}function ro(){window.removeEventListener("scroll",Ns),window.removeEventListener("click",Ps,{capture:!0}),rn()}function rn(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1}function ku(){ct||(ct=!0,requestAnimationFrame(xu))}function xu(){ct=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=K[K.length-1];if(r&&e-r.ts<50||(K.push({y:t,ts:e}),K.length>60&&(K=K.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){ae!=="down"&&P&&(P=!1),t>le&&(le=t),ae="down";return}if(P&&e-dt>Os&&(P=!1),ae==="down"){let s=le-t,a=n*Mu;s>=a&&!P&&(ut=t,dt=e,P=!0)}ae="up"}function Au(e){if(!P)return;let t=Date.now();if(t-dt>Os){P=!1;return}if(window.scrollY+e.clientY>ut+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(le-ut),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,le=window.scrollY,ae="none",K=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Du=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ru=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Iu=/^(A|BUTTON|LABEL)$/,Ou=3,Hs=9e4,Nu=5,ft=new Map,Fs=[],pt=null,Pu=5,Bs=f(Hu),Ws=f(qu);function Hu(e){pt={x:e.clientX,y:e.clientY}}function oo(e){Fs=e??[],document.addEventListener("mousedown",Bs,{capture:!0,passive:!0}),document.addEventListener("click",Ws,{capture:!0,passive:!0})}function io(){document.removeEventListener("mousedown",Bs,{capture:!0}),document.removeEventListener("click",Ws,{capture:!0}),pt=null,ft.clear()}function so(){ft.clear()}function Fu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function Bu(e,t){return e*4+t}function Wu(e){if(Du.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ru.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Iu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Vu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Uu(e){if(!pt)return!1;let t=e.clientX-pt.x,n=e.clientY-pt.y;return Math.sqrt(t*t+n*n)>Pu}function qu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Fs)||Vu()||Uu(e)||Wu(t))return;let{row:n,col:r}=Fu(e.clientX,e.clientY),o=Bu(n,r),i=Date.now(),s=p(t),c=(ft.get(o)??[]).filter(d=>i-d.ts<Hs);if(c.push({ts:i,selector:s}),ft.set(o,c),c.length>=Ou){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,$]of d)$>g&&(g=$,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Nu))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Hs}}),ft.set(o,[])}}var ao=3,ke=12e4,_=new Map,sn=[],mt=null,Vs=f(ju),on=f(Ku);function co(e){sn=e??[],document.addEventListener("invalid",Vs,{capture:!0,passive:!0}),document.addEventListener("input",on,{capture:!0,passive:!0}),document.addEventListener("change",on,{capture:!0,passive:!0}),mt=new MutationObserver(Gu),mt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function uo(){document.removeEventListener("invalid",Vs,{capture:!0}),document.removeEventListener("input",on,{capture:!0}),document.removeEventListener("change",on,{capture:!0}),mt&&(mt.disconnect(),mt=null);for(let e of _.values())ee(e);_.clear()}function fo(){for(let e of _.values())ee(e);_.clear()}function lo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function po(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function an(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function zu(e){for(let[t,n]of _)e-n.lastTs>ke&&(ee(n),_.delete(t))}function ee(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function Xu(e){return f(t=>{zs(e)})}function $u(e){return f(t=>{zs(e)})}function Us(e,t){let n=Xu(t),r=$u(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return _.set(t,o),o}function qs(e){if(!an(e)||v(e,sn))return;let t=Date.now();zu(t);let n=p(e),r=_.get(n);if(!r){Us(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:lo(e)}}),ee(r),_.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:lo(e)}}),ee(r),_.delete(n)))}function Yu(e){if(!an(e))return;let t=Date.now(),n=p(e),r=_.get(n);if(r){if(t-r.lastTs>ke){ee(r),_.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function zs(e){let t=Date.now(),n=_.get(e);if(n){if(t-n.lastTs>ke){ee(n),_.delete(e);return}if(n.lastTs=t,po(n.el)){n.cycles+=1,n.cycles>=ao&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:ke,field_type:lo(n.el)}}),ee(n),_.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ju(e){let t=e.target;t&&qs(t)}function Ku(e){let t=e.target;if(!t||!an(t)||v(t,sn))return;let n=p(t);_.has(n)||po(t)&&Us(t,n)}function Gu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!an(n)||v(n,sn))continue;let r=t.oldValue,o=r==="true"||r==="",i=po(n);i&&!o?qs(n):!i&&o&&Yu(n)}}var xe=null,gt=null,go=[],Xs=0,ht=new Map;function ho(e){go=e?.length?e:["[data-fd-impression]"],Xs=Date.now(),!(typeof IntersectionObserver>"u")&&(xe=new IntersectionObserver(y(Qu),{threshold:[0,.5,1]}),$s(),gt=new MutationObserver(y(Zu)),gt.observe(document.body,{childList:!0,subtree:!0}))}function vo(){xe&&(xe.disconnect(),xe=null),gt&&(gt.disconnect(),gt=null),ht.clear()}function wo(){ht.clear(),xe&&$s()}function $s(){for(let e of go)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)mo(t[n])}catch{}}function mo(e){ht.has(e)||(ht.set(e,{firstSeenTs:0,emitted:!1}),xe.observe(e))}function Zu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of go)try{r.matches(o)&&mo(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)mo(i[s])}catch{}}}function Qu(e){let t=Date.now();for(let n of e){let r=ht.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Xs),viewport_position:s}})}}}var Ju=2,ed=3,td=6e4,vt=new Map,Ys=[],js=f(nd);function Eo(e){Ys=e??[],document.addEventListener("input",js,{capture:!0,passive:!0})}function bo(){document.removeEventListener("input",js,{capture:!0}),vt.clear()}function yo(){vt.clear()}function nd(e){let t=e.target;if(!t||!rd(t)||v(t,Ys))return;let n=Date.now(),r=t.value??"",o=p(t),i=vt.get(o);if(!i){vt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>td){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=ed)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=Ju)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:od(t)}}),vt.delete(o);return}i.lastValue=r}function rd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function od(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Ks=2e3,id=3e4,z=null,Gs=Ks,Zs=[],ln=new Map,Qs=f(sd),Js=f(ad),ea=f(wt);function _o(e,t){Gs=e?.dwellMs??Ks,Zs=t??[],document.addEventListener("mouseover",Qs,{passive:!0}),document.addEventListener("mouseout",Js,{passive:!0}),document.addEventListener("click",ea,{capture:!0,passive:!0})}function So(){document.removeEventListener("mouseover",Qs),document.removeEventListener("mouseout",Js),document.removeEventListener("click",ea,{capture:!0}),wt(),ln.clear()}function To(){wt(),ln.clear()}function sd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Zs)||!ld(t))return;let n=p(t);if(z?.selector===n)return;wt();let r=Date.now();if(r-(ln.get(n)??0)<id)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);ln.set(n,s),z=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Gs);z={el:t,selector:n,startTs:o,timer:i}}function ad(e){if(!z)return;let t=e.target;if(t!==z.el&&!z.el.contains(t))return;let n=e.relatedTarget;n&&z.el.contains(n)||wt()}function wt(){z&&(clearTimeout(z.timer),z=null)}function ld(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var cd=20,ud=500,dd=3e3,fd=6e4,cn=0,un=0,X=null,ta=y(pd);function Lo(){cn=Date.now(),un=0,document.addEventListener("mouseleave",ta)}function Co(){document.removeEventListener("mouseleave",ta),X&&(clearTimeout(X),X=null)}function Mo(){cn=Date.now(),un=0,X&&(clearTimeout(X),X=null)}function pd(e){if(e.clientY>cd)return;let t=Date.now();t-cn<dd||t-un<fd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();un=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-cn)}})}),ud))}var md=2500,gd=4e3,na=200,hd=500,vd=.1,wd=.25,De=null,Re=null,G=null,Ae=0;function ko(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function xo(){if(!(typeof PerformanceObserver>"u")){try{De=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:ko(r,md,gd)}})})),De.observe({type:"largest-contentful-paint",buffered:!0})}catch{De=null}try{Re=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<na||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:ko(r,na,hd)}})}})),Re.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Re=null}try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!0})}catch{G=null}}}function ra(){if(G){if(G.disconnect(),G=null,Ae>0){let e=Math.round(Ae*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:ko(Ae,vd,wd)}})}Ae=0}}function Ao(){De&&(De.disconnect(),De=null),Re&&(Re.disconnect(),Re=null),ra()}function Do(){if(ra(),!(typeof PerformanceObserver>"u"))try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!1})}catch{G=null}}var oa=[],ia=f(Ed);function Ro(e){oa=e??[],document.addEventListener("paste",ia,{capture:!0,passive:!0})}function Io(){document.removeEventListener("paste",ia,{capture:!0})}function Ed(e){let t=e.target;if(!t||!bd(t)||v(t,oa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:yd(t)}})},100)}function bd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function yd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var _d="https://api.flusterduck.com/v1/ingest",te=!1,dn=null,Ie=null,Et="__flusterduck_instance__",Oo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function Sd(){let e=window;return e[Et]&&e[Et]!==Oo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[Et]=Oo,!0)}function Td(){let e=window;e[Et]===Oo&&delete e[Et]}var bt=[];function Ld(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>xn(e.signals?.rageClick,t),stop:An},{when:()=>r("deadClick"),start:()=>Dn(t),stop:Rn,reset:In},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Nn(i?{delayMs:i.windowMs}:void 0,t)},stop:Pn,reset:Hn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Vn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Un},{when:()=>r("loopNav"),start:()=>Xn(e.signals?.loopNav),stop:$n},{when:()=>r("scrollBounce"),start:Zn,stop:Qn,reset:Jn},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;tr(i?{pauseMs:i.threshold}:void 0,t)},stop:nr,reset:rr},{when:()=>o&&r("formValidationLoop"),start:()=>co(t),stop:uo,reset:fo},{when:()=>r("errorEncounter"),start:ir,stop:sr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>ur(t),stop:dr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>pr(t),stop:mr},{when:()=>r("scrollHijack"),start:vr,stop:wr,reset:$t},{when:()=>r("scrollDepthAbandon"),start:Er,stop:br,reset:yr},{when:()=>r("advancedHeuristics"),start:Tr,stop:Lr,reset:()=>{et(),Cr()}},{when:()=>r("helpHunt"),start:()=>Mr(t),stop:kr,reset:xr},{when:()=>r("closeClick"),start:()=>Ar(t),stop:Dr,reset:Rr},{when:()=>r("closeClickReversal"),start:()=>Ir(t),stop:Or,reset:Nr},{when:()=>r("filterSpiral"),start:()=>Hr(t),stop:Fr,reset:Br},{when:()=>r("copyFrustration"),start:Wr,stop:Vr,reset:Ur},{when:()=>r("textSelectFrustration"),start:qr,stop:zr,reset:Xr},{when:()=>r("deadClickTrapZone"),start:()=>oo(t),stop:io,reset:so},{when:()=>!0,start:()=>Kr(n),stop:Gr},{when:()=>r("navigationConfusion"),start:Jr,stop:eo,reset:to},{when:()=>r("scrollToClickConfusion"),start:no,stop:ro,reset:rn},{when:()=>r("elementImpression"),start:()=>ho(e.elementImpressionSelectors),stop:vo,reset:wo},{when:()=>o&&r("inputCorrection"),start:()=>Eo(t),stop:bo,reset:yo},{when:()=>o&&r("pasteBlocked"),start:()=>Ro(t),stop:Io},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;_o(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:So,reset:To},{when:()=>r("exitIntent"),start:Lo,stop:Co,reset:Mo},{when:()=>r("performanceVitals"),start:xo,stop:Ao,reset:Do}]}function Cd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function aa(e){if(te||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Rd()){Ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ie=e;return}if(!Sd()){Ie=e;return}Ie=e,te=!0;let t=zo(e.cookieless??!1),n=Cd(e.endpoint)??_d,r=kn(location.pathname,e.pageRules??[]),o=Id(e.domMode);oi(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=sa(location.pathname,e.ignorePages??[]);i&&Cn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];bt=[];for(let d of Ld(e,c,r))d.when()&&(d.start(),bt.push({stop:d.stop,reset:d.reset}));dn=ai(y((d,l)=>{ne();for(let E of bt)E.reset?.();lt(l),jr(l);let g=kn(l,e.pageRules??[]),w=sa(l,e.ignorePages??[]);Cn(w),Mn({page:g,url:d}),Yn(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function Md(e,t){if(!te||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function kd(e,t={}){if(!te||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function xd(e){if(!te||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}Mn({segment:t})}function Ad(e){e&&Ie&&!te?aa(Ie):e||(No(),bn())}function Dd(){No(),bn()}function No(){if(te){for(let e of bt)e.stop();bt=[],ii(),dn&&(dn(),dn=null),Td(),te=!1}}function Rd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Id(e){return e==="metadata"||e==="snapshot"?e:"off"}function sa(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var da=.1,fa=.01,pa=3e4,ma=50,ga=1e4,Od=500,Nd=3e4,Pd=6e4,la=10,Hd=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Fd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,Bd=/^\$\$?(heatmap|scroll)/,ha=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],gn=!1,fn=null,pn=null,yt=null,H=null,mn=null,va=da,wa=fa,Ea=new Set,ba=new Set(ha),ya=pa,Fo=ma,_a=ga,R=[],hn=0,F=[];function ca(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Wd(e){gn||(gn=!0,va=ca(e?.baselineSampleRate,da),wa=ca(e?.scrollSampleRate,fa),Ea=new Set(e?.conversionEvents??[]),ba=new Set(e?.criticalSignals?.length?e.criticalSignals:ha),ya=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:pa,Fo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:ma,_a=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:ga,R=[],hn=0,F=[],pn=ti(jd),ua()||(fn=setInterval(()=>{ua()&&Bo()},Od),setTimeout(()=>Bo(),Nd)))}function Vd(){gn&&(gn=!1,Bo(),pn&&(pn(),pn=null),yt&&mn&&yt.capture.__fd_wrapped&&(yt.capture=mn),yt=null,H=null,mn=null,R=[],F=[],hn=0)}function Bo(){fn&&(clearInterval(fn),fn=null)}function ua(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;mn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return qd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,yt=e,!0}catch{return!1}}function Ud(e){return Hd.has(e)?"critical":Ea.has(e)||Fd.test(e)?"conversion":Bd.test(e)?"scroll":"baseline"}function qd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Ud(e);if(o==="critical"||o==="conversion")return H(e,Ho(t,r),n);if(r<hn)return H(e,{...Ho(t,r),fd_boosted:!0},n);if(zd(o==="scroll"?wa:va))return H(e,Ho(t,r),n);Yd({name:e,properties:t,ts:r})}function zd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Xd();return t?$d(t)%1e4/1e4<e:Math.random()<e}var Po="";function Xd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return Po||(Po=Math.random().toString(36).slice(2)),Po}function $d(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Ho(e,t){return Ta(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function Yd(e){R.push(e),Sa(e.ts)}function Sa(e){let t=e-ya;for(;R.length&&R[0].ts<t;)R.shift();R.length>Fo&&(R=R.slice(-Fo))}function Ta(e){let t=e-Pd;F=F.filter(n=>n.ts>=t),F.length>la&&(F=F.slice(-la))}function jd(e,t){if(F.push({name:e,ts:t}),Ta(t),!ba.has(e)||(hn=t+_a,!H||!R.length))return;Sa(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}export{No as destroy,Vd as destroyPostHogTrigger,xd as identify,aa as init,Wd as initPostHogTrigger,Dd as optOut,Ad as setConsent,Md as signal,kd as track};
@@ -0,0 +1,36 @@
1
+ type CaptureFn = (eventName: string, properties?: Record<string, unknown>, options?: Record<string, unknown>) => unknown;
2
+ interface PostHogLike {
3
+ capture: CaptureFn;
4
+ get_distinct_id?: () => string;
5
+ __loaded?: boolean;
6
+ }
7
+ declare global {
8
+ interface Window {
9
+ posthog?: PostHogLike;
10
+ }
11
+ }
12
+ export interface PostHogTriggerOptions {
13
+ /** Keep rate for tier P2 (general events, pageviews). Default 0.1. */
14
+ baselineSampleRate?: number;
15
+ /** Keep rate for tier P3 (scroll and heatmap noise). Default 0.01. */
16
+ scrollSampleRate?: number;
17
+ /**
18
+ * PostHog event names that always pass (tier P1 conversions), in addition
19
+ * to the built-in conversion pattern match. Example: ['plan_upgraded'].
20
+ */
21
+ conversionEvents?: string[];
22
+ /**
23
+ * Flusterduck signal names that trigger retroactive capture and the boost
24
+ * window. Defaults to the high-confidence frustration set.
25
+ */
26
+ criticalSignals?: string[];
27
+ /** How far back the retroactive buffer reaches, in ms. Default 30000. */
28
+ bufferWindowMs?: number;
29
+ /** Max events held in the retroactive buffer. Default 50. */
30
+ bufferMaxEvents?: number;
31
+ /** How long after a signal everything is captured, in ms. Default 10000. */
32
+ boostWindowMs?: number;
33
+ }
34
+ export declare function initPostHogTrigger(opts?: PostHogTriggerOptions): void;
35
+ export declare function destroyPostHogTrigger(): void;
36
+ export {};
package/dist/queue.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { SDKEvent, QueueMeta, QueueOptions } from './types';
2
2
  export declare function setCorrelatorHook(fn: ((signalType: string) => void) | null): void;
3
+ type SignalListener = (signalType: string, ts: number) => void;
4
+ export declare function subscribeSignals(fn: SignalListener): () => void;
3
5
  export declare function setQueuePaused(val: boolean): void;
4
6
  export declare function initQueue(ep: string, meta: QueueMeta, interval?: number, maxSize?: number, options?: QueueOptions): void;
5
7
  export declare function enqueue(event: SDKEvent): void;
6
8
  export declare function flush(): void;
7
9
  export declare function updateMeta(updates: Partial<QueueMeta>): void;
8
10
  export declare function destroyQueue(): void;
11
+ export {};
@@ -1,5 +1,6 @@
1
1
  export declare function initRageClick(opts?: {
2
2
  threshold?: number;
3
3
  windowMs?: number;
4
+ radius?: number;
4
5
  }, ignore?: string[]): void;
5
6
  export declare function destroyRageClick(): void;
package/dist/types.d.ts CHANGED
@@ -26,6 +26,8 @@ export interface SignalOpts {
26
26
  enabled?: boolean;
27
27
  threshold?: number;
28
28
  windowMs?: number;
29
+ /** Max pairwise click distance in px for rage click clustering. Default 24. */
30
+ radius?: number;
29
31
  }
30
32
  export interface SDKEvent {
31
33
  t: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flusterduck",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Lightweight UX confusion monitoring SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",