@scalebun/web 1.3.1-beta.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scalebun.min.js +1 -1
- package/dist/scalebun.min.js.map +1 -1
- package/package.json +1 -1
package/dist/scalebun.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var og=Object.defineProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)og(n,t,{get:e[t],enumerable:!0})};function H(){let n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.randomUUID=="function")return n.randomUUID();let e=typeof performance!="undefined"?performance.now():0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(Math.floor(e)+Math.floor(Math.random()*16))%16;return(t==="x"?r:r&3|8).toString(16)})}function P(){return Date.now()}function Ga(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Ka);if(n)return n;let e=`web_${H()}`;return localStorage.setItem(Ka,e),e}}catch{}return`web_${H()}`}var Ka,Xa=k(()=>{"use strict";Ka="scalebun_device_id"});function Ya(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(_s,...e)}}var _s,Os=k(()=>{"use strict";_s="[scalebun]"});var Ja=k(()=>{"use strict"});function Qa(){return{platform:"web",renderer:"dom",sdk:{name:cg,version:Ns}}}function Za(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=lg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function ec(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function tc(){let n={};try{typeof navigator!="undefined"&&(n.locale=navigator.language),n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,typeof location!="undefined"&&(n.url=location.href),typeof window!="undefined"&&(n.viewport={width:window.innerWidth,height:window.innerHeight});let e=navigator==null?void 0:navigator.connection;e!=null&&e.effectiveType&&(n.networkType=e.effectiveType)}catch{}return n}function lg(n){var s,i,o,a,c,l,u,d,p;let e={},t={},r=(s=/(Edg|OPR)\/([\d.]+)/.exec(n))!=null?s:/(Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(i={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?i:r[1],e.version=(o=r[2])==null?void 0:o.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(a=/Windows NT ([\d.]+)/.exec(n))==null?void 0:a[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(l=(c=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:c[1])==null?void 0:l.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(u=/Android ([\d.]+)/.exec(n))==null?void 0:u[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(p=(d=/OS ([\d_]+)/.exec(n))==null?void 0:d[1])==null?void 0:p.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var cg,Ns,nc=k(()=>{"use strict";cg="@scalebun/web",Ns="1.3.1-beta.0"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function fg(n){return n.replace(ug,"[email]").replace(pg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return fg(n);if(Array.isArray(n))return n.slice(0,1e3).map(t=>mt(t,e+1));if(typeof n=="object"){let t={},r=0;for(let s in n){if(r++>200)break;if(!Object.prototype.hasOwnProperty.call(n,s))continue;let i=n[s];t[s]=dg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var dg,ug,pg,Bs=k(()=>{"use strict";dg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,ug=/[\w.+-]+@[\w-]+\.[\w.-]+/g,pg=/\b\d[\d -]{11,18}\d\b/g});function rc(n){try{let e=sc()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function mg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function hg(){let n=typeof document!="undefined";return{dom:n,storage:rc("localStorage"),session:rc("sessionStorage"),indexedDB:ht("indexedDB"),history:typeof history!="undefined"&&typeof history.pushState=="function",network:typeof fetch!="undefined",beacon:typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function",keepalive:mg(),performance:typeof performance!="undefined"&&typeof performance.now=="function",performanceObserver:ht("PerformanceObserver"),mutationObserver:ht("MutationObserver"),intersectionObserver:ht("IntersectionObserver"),resizeObserver:ht("ResizeObserver"),visibility:n&&typeof document.visibilityState!="undefined",raf:typeof requestAnimationFrame!="undefined",crypto:typeof crypto!="undefined"&&typeof crypto.subtle!="undefined",webWorker:ht("Worker")}}function gg(){return Fs===null&&(Fs=hg()),Fs}function gt(n){return gg()[n]}var sc,ht,Fs,Ds=k(()=>{"use strict";sc=()=>globalThis,ht=n=>typeof sc()[n]!="undefined";Fs=null});function Pe(n,e,t){if(!gt("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var qs=k(()=>{"use strict";Ds()});var bn,ic=k(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function bt(n){return n.length>oc?n.slice(0,oc):n}function vg(n){return n.replace(/[?#].*$/,"")}function wg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ac(n){let e={},t=!1;for(let r in n)n[r]!==void 0&&n[r]!==null&&(e[r]=n[r],t=!0);return t?e:void 0}function xg(n){var t;if(n.kind==="frame"||n.kind==="performance")return null;let e=typeof n.timestamp=="number"?n.timestamp:Date.now();switch(n.kind){case"log":return{ts:e,category:"console",level:wg(n.level),message:bt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:bt(j(`${n.method} ${vg(n.url)}`)),data:ac({status:r,duration:n.duration})}}case"event":return Sg(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:bt(j(n.message))};default:return null}}function Sg(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:bt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ac({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function cc(n){$s=n}function lc(n){if(!$s)return n;try{return $s(n)}catch{return n}}function dc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=lc(e);t&&We.add(t)}function uc(n){let e=xg(n);if(!e)return;let t=lc(e);t&&We.add(t)}function pc(){We.clear()}var bg,yg,oc,Hs,We,$s,fc=k(()=>{"use strict";Bs();bg=50,yg=200,oc=256;Hs=class{constructor(){this.ring=[];this.max=bg}setMax(e){this.max=Math.max(1,Math.min(yg,Math.floor(e))),this.trim()}add(e){var r;let t=this.ring[this.ring.length-1];if(t&&t.category===e.category&&t.message===e.message&&t.level===e.level){t.count=((r=t.count)!=null?r:1)+1,t.ts=e.ts;return}this.ring.push(e),this.trim()}snapshot(){return this.ring.slice()}clear(){this.ring=[]}trim(){for(;this.ring.length>this.max;)this.ring.shift()}},We=new Hs});function mc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function hc(){yn=void 0,vn=void 0}var yn,vn,gc=k(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(zt={...zt,...n})}function yt(){return zt}function bc(){let n=zt.deviceId;zt=n!=null?{deviceId:n}:{}}var zt,yc=k(()=>{"use strict";zt={}});function kg(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function Us(){return zs===null&&(zs=kg()),zs}function Eg(){return Us()==="browser"}function vc(){return!Eg()}var zs,wc=k(()=>{"use strict";zs=null});function wn(n){n&&(Vs=n)}function vt(n){if(Vs)try{n.nonce=Vs}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=vt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Vs,xc=k(()=>{"use strict";Vs=null});var $=k(()=>{"use strict";Xa();Os();Ja();nc();Bs();qs();ic();fc();gc();yc();wc();Ds();xc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(js);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function wt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(js,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function Sc(n=Vt,e=Ks){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,wt(r),it=r,r;let s={id:`sess_${H()}`,startedAt:t,lastSeenAt:t,seq:0};return wt(s),it=s,s}function kc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(js)===null){it.lastSeenAt=n,wt(it),Ws=n;return}}catch{}if(n-Ws<6e4)return;Ws=n;let e=xn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Gs(n=1){let e=xn();if(!e){let r=Ut;return Ut+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),wt(e),t}function Ec(n){let e=xn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(Ut<n&&(Ut=n),Ut)}var js,Vt,Ks,it,Ws,Ut,Sn=k(()=>{"use strict";$();js="scalebun_session",Vt=30*60*1e3,Ks=4*60*60*1e3;it=null,Ws=0,Ut=0});var Ys={};L(Ys,{SDK_SIGNING_VERSION:()=>Ic,signBody:()=>Cc,signatureHeaders:()=>Ag});function Ig(n,e){let t=Xs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Xs.delete(e)),Xs.set(e,t)),t}function Cg(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Cc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Ig(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Cg(new Uint8Array(i))}catch{return null}}async function Ag(n,e){let t=await Cc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Ic}:{}}var Ic,Xs,Js=k(()=>{"use strict";Ic="1",Xs=new Map});var Ac={};L(Ac,{gzipString:()=>Tg});async function Tg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var Tc=k(()=>{"use strict"});function Pg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Rg,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(xt)||t.createObjectStore(xt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var Rg,xt,Mg,Be,Wt=k(()=>{"use strict";Rg="scalebun",xt="queue",Mg="pending";Be=class{constructor(e=Mg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Pg()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(xt,"readonly").objectStore(xt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(xt,"readwrite");s.objectStore(xt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function Rc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Lg,_g,St,Cn=k(()=>{"use strict";Lg=1e3,_g=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(_g,Lg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function kt(n,e,t){let r=n.map(c=>({it:c,n:Og(c),gone:!1})),s=r.reduce((c,l)=>c+l.n,0);if(s<=2e6)return n.slice();let i=c=>{for(let l of r){if(s<=2e6)return;l.gone||!c(l.it)||(l.gone=!0,s-=l.n)}};if(e&&t){let c=r.reduce((l,u)=>l+(t(u.it)?1:0),0);for(let l of r){if(s<=2e6)break;if(l.gone||!e(l.it))continue;let u=t(l.it);u&&c<=1||(l.gone=!0,s-=l.n,u&&c--)}}else e&&i(e);i(()=>!0);let o=r.filter(c=>!c.gone).map(c=>c.it);if(!e||!t)return o;let a=!1;return o.filter(c=>e(c)?t(c)?(a=!0,!0):a:!0)}var Og,Tn=k(()=>{"use strict";Og=n=>JSON.stringify(n).length+1});function Qs(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Pn,Zs=k(()=>{"use strict";Pn=class{constructor(){this.features=new Map}add(e){this.features.set(e.name,e)}get(e){return this.features.get(e)}async setupAll(e){var t;for(let r of this.features.values())try{await r.setup(e)}catch(s){e.log(`[scalebun] feature "${r.name}" failed to set up:`,s);try{let i=s,o=String((t=i==null?void 0:i.message)!=null?t:s).slice(0,300);e.trackEvent("sdk_feature_setup_failed",{feature:r.name,error:(i==null?void 0:i.name)||"Error",message:o,moduleLoad:Qs(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}}});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function ei(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=k(()=>{"use strict"});function ti(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ti(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Nc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=k(()=>{"use strict"});var Uc={};L(Uc,{anchorOf:()=>zc,fieldKeyOf:()=>Hc,fieldLabelOf:()=>$c,formIdOf:()=>Nn,installFormAnalytics:()=>Zg,isSensitiveField:()=>Dc,isTrackableField:()=>qc,stepOf:()=>jt});function Dc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Wg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return jg.test(t)}function qc(n){if(!n||typeof n.matches!="function"||!n.matches(Gg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Kg.has(e)?!1:!Dc(n)}function Hc(n,e){let t=n.getAttribute("name");if(t)return t;if(n.id)return n.id;let r=(n.getAttribute("type")||n.tagName).toLowerCase(),s=-1;try{s=Array.prototype.indexOf.call(e.elements,n)}catch{}return s>=0?`${r}[${s}]`:r}function $c(n){var r,s,i,o,a;let e="";try{if(e=n.getAttribute("aria-label")||"",!e){let c=n.getAttribute("id"),l=n.ownerDocument;if(c&&l&&(e=((r=l.querySelector(`label[for="${c}"]`))==null?void 0:r.textContent)||""),e||(e=((i=(s=n.closest)==null?void 0:s.call(n,"label"))==null?void 0:i.textContent)||""),!e){let u=n.getAttribute("aria-labelledby");u&&l&&(e=((a=l.getElementById((o=u.split(/\s+/)[0])!=null?o:""))==null?void 0:a.textContent)||"")}}}catch{}let t=j(e.replace(/\s+/g," ").trim());if(t)return t.length>Bc?`${t.slice(0,Bc-1)}\u2026`:t}function Jg(n){let e=5381;for(let t=0;t<n.length;t++)e=(e<<5)+e+n.charCodeAt(t)|0;return(e>>>0).toString(36)}function Nn(n){var s,i;if(n.id)return n.id;let e=n.getAttribute("name");if(e)return e;let t="";try{t=(s=(n.getAttribute("action")||"").split("?")[0])!=null?s:""}catch{}let r=[];try{for(let o of Array.from(n.elements)){let a=(i=o.getAttribute)==null?void 0:i.call(o,"name");a&&r.push(a)}}catch{}return`form_${Jg(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function jt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function zc(n){var e,t,r;try{let s=(e=n.getBoundingClientRect)==null?void 0:e.call(n);if(!s||s.width===0&&s.height===0)return;let i={ex:s.x|0,ey:s.y|0,ew:s.width|0,eh:s.height|0},o=(r=(t=n.closest)==null?void 0:t.call(n,"[data-scalebun-component]"))==null?void 0:r.getAttribute("data-scalebun-component");return o&&(i.component=o),i}catch{return}}function Qg(n){let e=n.validity;return e?e.valueMissing?"required":e.typeMismatch?"type":e.patternMismatch?"pattern":e.tooShort?"too_short":e.tooLong?"too_long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.badInput?"bad_input":e.customError?"custom":"invalid":"invalid"}function Zg(n){if(typeof document=="undefined")return{onSubmit:()=>({}),stop:()=>{}};let e=!0,t=new Map,r=m=>{let h=t.get(m);return h||(t.size>=Yg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Nn(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:jt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,Xg).map(([h,g])=>({key:h,ms:Math.round(g.ms),changed:g.changed,errored:g.errored,order:g.order,...g.label?{label:g.label}:{}})),o=m=>{if(!e)return null;let h=m.target;if(!qc(h))return null;let g=h.form;if(!g||Fc(g)||Fc(h))return null;let S=r(g);return S?{form:g,el:h,key:Hc(h,g),st:S}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:S}=h,v=g.fields.get(S);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:$c(h.el)},g.fields.set(S,v)),v.focusedAt=at(),g.lastField=S},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var S;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:Nn(h.form),field_key:h.key,error_type:Qg(h.el),step:jt(h.form),...(S=zc(h.el))!=null?S:{}}})},d=(m,h)=>{var g;for(let S of h.fields.values())S.focusedAt!=null&&(S.ms+=at()-S.focusedAt,S.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Nn(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var Wg,jg,Kg,Gg,Xg,Yg,Bc,Fc,at,Vc=k(()=>{"use strict";$();Wg=new Set(["password","hidden"]),jg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Kg=new Set(["submit","button","reset","image"]),Gg="input, select, textarea",Xg=30,Yg=20;Bc=60;Fc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Wc={};L(Wc,{installScrollTracker:()=>eb});function eb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>tb(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=0,s=()=>document.documentElement,i=()=>{try{let l=s();e=Math.max(e,l.scrollHeight),t=window.innerWidth||l.clientWidth||0,r=window.innerHeight||l.clientHeight||0}catch{}},o=()=>{let l=window.scrollY||window.pageYOffset||0;l>n&&(n=l)},a;if(typeof ResizeObserver!="undefined")try{a=new ResizeObserver(()=>i()),a.observe(s())}catch{a=void 0}return i(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),{summary:()=>{i();let l=e||0,u=r||0,d=Et(n,l,u);return{scroll_depth_pct:d,max_scroll_px:Math.round(n),doc_h:Math.round(l),viewport_w:Math.round(t),viewport_h:Math.round(u),max_bucket:Nc(d),scrollable:ti(l,u)}},reset:()=>{n=0,e=0,t=window.innerWidth||0,r=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",i),a==null||a.disconnect()}}}function tb(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var jc=k(()=>{"use strict";On()});var Gc={};L(Gc,{ATTENTION_BANDS:()=>nb,bandFractions:()=>Kc,installAttentionTracker:()=>rb});function Kc(n,e,t,r){let s=new Array(r).fill(0);if(t<=0||e<=0||r<=0)return s;let i=t/r,o=Math.max(0,n),a=Math.min(t,n+e);for(let c=0;c<r;c++){let l=c*i,u=(c+1)*i,d=Math.max(0,Math.min(a,u)-Math.max(o,l));s[c]=i>0?d/i:0}return s}function rb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>sb(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,S=Kc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=S[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function sb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var nb,ct,Xc=k(()=>{"use strict";nb=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var Zc={};L(Zc,{describeElement:()=>Fn,installAutocapture:()=>pb});function cb(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Fn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:cb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Qc(r):r),n.id&&(t.el_id=n.id);let s=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,3);s.length&&(t.classes=s);let i=n.getAttribute("href");i&&!/^\s*javascript:/i.test(i)&&(t.href=i);let o=n.getAttribute("name");o&&(t.name=o);let a=(c=n.closest("[data-scalebun-variant]"))==null?void 0:c.getAttribute("data-scalebun-variant");return a&&(t.variant=a),t}function lb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Yc))return t;return n&&typeof n.closest=="function"?n.closest(Yc):null}function db(n){return ab.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function ub(n){try{return new URL(n,location.href)}catch{return null}}function Jc(){try{return location.pathname}catch{return""}}function pb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Vc(),Uc)).then(T=>{e&&(t=T.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(jc(),Wc)).then(T=>{e&&(r=T.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(Xc(),Gc)).then(T=>{e&&(s=T.installAttentionTracker())}).catch(()=>{});let i=T=>{var ce;if(!e)return;let A=T.target,O=typeof T.composedPath=="function"?T.composedPath():[],z=lb(A,O),D=z!=null?z:A&&db(A)?A:null;if(!D||Bn(D))return;let te={...Fn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=ub(J);if(!Q)return;D.hasAttribute("download")||ob.test(Q.pathname+Q.search)?n.onEvent({name:"$download",props:{url:Q.href,file:Q.pathname.split("/").pop()||Q.pathname,path:location.pathname}}):Q.host&&Q.host!==location.host&&n.onEvent({name:"$outbound_link",props:{url:Q.href,host:Q.host,path:location.pathname}})},o=T=>{var z;if(!e)return;let A=T.target;if(!A||typeof A.matches!="function"||!A.matches(ib)||Bn(A))return;let O={...Fn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];O.option_value=A.value,O.option_index=A.selectedIndex,D&&(O.option_text=n.maskText===!0?Qc(D.text):D.text),O.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(O.checked=A.checked,O.input_type=A.type,A.value&&A.value!=="on"&&(O.option_value=A.value));n.onEvent({name:"$change",props:O})},a=T=>{var O;if(!e)return;let A=T.target;!A||A.tagName!=="FORM"||Bn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(O=t==null?void 0:t.onSubmit(A))!=null?O:{}}})},c=0,l=null,u=0,d=Jc(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},S=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let T=document.documentElement,A=Et(window.scrollY,T.scrollHeight,window.innerHeight||T.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var T,A;!p||f||(S(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(T=r==null?void 0:r.summary())!=null?T:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},E=new WeakSet,w;typeof IntersectionObserver!="undefined"&&(w=new IntersectionObserver(T=>{if(e)for(let A of T){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!E.has(O)&&(E.add(O),w.unobserve(O),Bn(O)||n.onEvent({name:"$impression",props:{...Fn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!w||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(T=>{E.has(T)||w.observe(T)})}catch{}},x=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=Jc(),p=!0,f=!1,g(),I()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",S),window.addEventListener("popstate",x);let C=history.pushState,M=history.replaceState;return history.pushState=function(...T){C.apply(this,T),x()},history.replaceState=function(...T){M.apply(this,T),x()},x(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",S),window.removeEventListener("popstate",x),w==null||w.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Yc,ib,ob,ab,Qc,Bn,el=k(()=>{"use strict";On();Yc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',ib='select, input[type="checkbox"], input[type="radio"]',ob=/\.(pdf|zip|gz|tar|rar|7z|csv|tsv|xlsx?|docx?|pptx?|dmg|pkg|exe|msi|apk|ipa|mp3|mp4|mov|avi|wav|svg|png|jpe?g|gif|webp|txt|json|xml)(\?|#|$)/i,ab=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Qc=n=>n.replace(/\S/g,"*");Bn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function di(n){return n.replace(/[?#].*$/,"").trim()}function Mb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function xl(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:di((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:di((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:di(n)}}function Sl(n,e){let t={};return n&&n!=="<anonymous>"&&(t.function=n),e.file&&(t.file=e.file),e.line!=null&&(t.line=e.line),e.col!=null&&(t.col=e.col),t.inApp=Mb(e.file),t}function Pb(n){let e=n.trim();if(!e)return null;if(e.indexOf("at ")===0){let r=e.slice(3).trim().replace(/^async\s+/,""),s,i=r.indexOf(" (");i!==-1&&r.endsWith(")")&&(s=r.slice(0,i).trim()||void 0,r=r.slice(i+2,-1));let o=xl(r);return o?Sl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=xl(e.slice(t+1));if(s&&s.file)return Sl(r,s)}return null}function kl(n){var r;if(!n)return[];let e=[],t=n.split(`
|
|
1
|
+
"use strict";(()=>{var og=Object.defineProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)og(n,t,{get:e[t],enumerable:!0})};function H(){let n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.randomUUID=="function")return n.randomUUID();let e=typeof performance!="undefined"?performance.now():0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(Math.floor(e)+Math.floor(Math.random()*16))%16;return(t==="x"?r:r&3|8).toString(16)})}function P(){return Date.now()}function Ga(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Ka);if(n)return n;let e=`web_${H()}`;return localStorage.setItem(Ka,e),e}}catch{}return`web_${H()}`}var Ka,Xa=k(()=>{"use strict";Ka="scalebun_device_id"});function Ya(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(_s,...e)}}var _s,Os=k(()=>{"use strict";_s="[scalebun]"});var Ja=k(()=>{"use strict"});function Qa(){return{platform:"web",renderer:"dom",sdk:{name:cg,version:Ns}}}function Za(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=lg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function ec(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function tc(){let n={};try{typeof navigator!="undefined"&&(n.locale=navigator.language),n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,typeof location!="undefined"&&(n.url=location.href),typeof window!="undefined"&&(n.viewport={width:window.innerWidth,height:window.innerHeight});let e=navigator==null?void 0:navigator.connection;e!=null&&e.effectiveType&&(n.networkType=e.effectiveType)}catch{}return n}function lg(n){var s,i,o,a,c,l,u,d,p;let e={},t={},r=(s=/(Edg|OPR)\/([\d.]+)/.exec(n))!=null?s:/(Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(i={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?i:r[1],e.version=(o=r[2])==null?void 0:o.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(a=/Windows NT ([\d.]+)/.exec(n))==null?void 0:a[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(l=(c=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:c[1])==null?void 0:l.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(u=/Android ([\d.]+)/.exec(n))==null?void 0:u[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(p=(d=/OS ([\d_]+)/.exec(n))==null?void 0:d[1])==null?void 0:p.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var cg,Ns,nc=k(()=>{"use strict";cg="@scalebun/web",Ns="1.3.1"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function fg(n){return n.replace(ug,"[email]").replace(pg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return fg(n);if(Array.isArray(n))return n.slice(0,1e3).map(t=>mt(t,e+1));if(typeof n=="object"){let t={},r=0;for(let s in n){if(r++>200)break;if(!Object.prototype.hasOwnProperty.call(n,s))continue;let i=n[s];t[s]=dg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var dg,ug,pg,Bs=k(()=>{"use strict";dg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,ug=/[\w.+-]+@[\w-]+\.[\w.-]+/g,pg=/\b\d[\d -]{11,18}\d\b/g});function rc(n){try{let e=sc()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function mg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function hg(){let n=typeof document!="undefined";return{dom:n,storage:rc("localStorage"),session:rc("sessionStorage"),indexedDB:ht("indexedDB"),history:typeof history!="undefined"&&typeof history.pushState=="function",network:typeof fetch!="undefined",beacon:typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function",keepalive:mg(),performance:typeof performance!="undefined"&&typeof performance.now=="function",performanceObserver:ht("PerformanceObserver"),mutationObserver:ht("MutationObserver"),intersectionObserver:ht("IntersectionObserver"),resizeObserver:ht("ResizeObserver"),visibility:n&&typeof document.visibilityState!="undefined",raf:typeof requestAnimationFrame!="undefined",crypto:typeof crypto!="undefined"&&typeof crypto.subtle!="undefined",webWorker:ht("Worker")}}function gg(){return Fs===null&&(Fs=hg()),Fs}function gt(n){return gg()[n]}var sc,ht,Fs,Ds=k(()=>{"use strict";sc=()=>globalThis,ht=n=>typeof sc()[n]!="undefined";Fs=null});function Pe(n,e,t){if(!gt("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var qs=k(()=>{"use strict";Ds()});var bn,ic=k(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function bt(n){return n.length>oc?n.slice(0,oc):n}function vg(n){return n.replace(/[?#].*$/,"")}function wg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ac(n){let e={},t=!1;for(let r in n)n[r]!==void 0&&n[r]!==null&&(e[r]=n[r],t=!0);return t?e:void 0}function xg(n){var t;if(n.kind==="frame"||n.kind==="performance")return null;let e=typeof n.timestamp=="number"?n.timestamp:Date.now();switch(n.kind){case"log":return{ts:e,category:"console",level:wg(n.level),message:bt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:bt(j(`${n.method} ${vg(n.url)}`)),data:ac({status:r,duration:n.duration})}}case"event":return Sg(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:bt(j(n.message))};default:return null}}function Sg(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:bt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ac({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function cc(n){$s=n}function lc(n){if(!$s)return n;try{return $s(n)}catch{return n}}function dc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=lc(e);t&&We.add(t)}function uc(n){let e=xg(n);if(!e)return;let t=lc(e);t&&We.add(t)}function pc(){We.clear()}var bg,yg,oc,Hs,We,$s,fc=k(()=>{"use strict";Bs();bg=50,yg=200,oc=256;Hs=class{constructor(){this.ring=[];this.max=bg}setMax(e){this.max=Math.max(1,Math.min(yg,Math.floor(e))),this.trim()}add(e){var r;let t=this.ring[this.ring.length-1];if(t&&t.category===e.category&&t.message===e.message&&t.level===e.level){t.count=((r=t.count)!=null?r:1)+1,t.ts=e.ts;return}this.ring.push(e),this.trim()}snapshot(){return this.ring.slice()}clear(){this.ring=[]}trim(){for(;this.ring.length>this.max;)this.ring.shift()}},We=new Hs});function mc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function hc(){yn=void 0,vn=void 0}var yn,vn,gc=k(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(zt={...zt,...n})}function yt(){return zt}function bc(){let n=zt.deviceId;zt=n!=null?{deviceId:n}:{}}var zt,yc=k(()=>{"use strict";zt={}});function kg(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function Us(){return zs===null&&(zs=kg()),zs}function Eg(){return Us()==="browser"}function vc(){return!Eg()}var zs,wc=k(()=>{"use strict";zs=null});function wn(n){n&&(Vs=n)}function vt(n){if(Vs)try{n.nonce=Vs}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=vt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Vs,xc=k(()=>{"use strict";Vs=null});var $=k(()=>{"use strict";Xa();Os();Ja();nc();Bs();qs();ic();fc();gc();yc();wc();Ds();xc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(js);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function wt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(js,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function Sc(n=Vt,e=Ks){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,wt(r),it=r,r;let s={id:`sess_${H()}`,startedAt:t,lastSeenAt:t,seq:0};return wt(s),it=s,s}function kc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(js)===null){it.lastSeenAt=n,wt(it),Ws=n;return}}catch{}if(n-Ws<6e4)return;Ws=n;let e=xn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Gs(n=1){let e=xn();if(!e){let r=Ut;return Ut+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),wt(e),t}function Ec(n){let e=xn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(Ut<n&&(Ut=n),Ut)}var js,Vt,Ks,it,Ws,Ut,Sn=k(()=>{"use strict";$();js="scalebun_session",Vt=30*60*1e3,Ks=4*60*60*1e3;it=null,Ws=0,Ut=0});var Ys={};L(Ys,{SDK_SIGNING_VERSION:()=>Ic,signBody:()=>Cc,signatureHeaders:()=>Ag});function Ig(n,e){let t=Xs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Xs.delete(e)),Xs.set(e,t)),t}function Cg(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Cc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Ig(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Cg(new Uint8Array(i))}catch{return null}}async function Ag(n,e){let t=await Cc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Ic}:{}}var Ic,Xs,Js=k(()=>{"use strict";Ic="1",Xs=new Map});var Ac={};L(Ac,{gzipString:()=>Tg});async function Tg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var Tc=k(()=>{"use strict"});function Pg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Rg,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(xt)||t.createObjectStore(xt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var Rg,xt,Mg,Be,Wt=k(()=>{"use strict";Rg="scalebun",xt="queue",Mg="pending";Be=class{constructor(e=Mg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Pg()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(xt,"readonly").objectStore(xt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(xt,"readwrite");s.objectStore(xt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function Rc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Lg,_g,St,Cn=k(()=>{"use strict";Lg=1e3,_g=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(_g,Lg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function kt(n,e,t){let r=n.map(c=>({it:c,n:Og(c),gone:!1})),s=r.reduce((c,l)=>c+l.n,0);if(s<=2e6)return n.slice();let i=c=>{for(let l of r){if(s<=2e6)return;l.gone||!c(l.it)||(l.gone=!0,s-=l.n)}};if(e&&t){let c=r.reduce((l,u)=>l+(t(u.it)?1:0),0);for(let l of r){if(s<=2e6)break;if(l.gone||!e(l.it))continue;let u=t(l.it);u&&c<=1||(l.gone=!0,s-=l.n,u&&c--)}}else e&&i(e);i(()=>!0);let o=r.filter(c=>!c.gone).map(c=>c.it);if(!e||!t)return o;let a=!1;return o.filter(c=>e(c)?t(c)?(a=!0,!0):a:!0)}var Og,Tn=k(()=>{"use strict";Og=n=>JSON.stringify(n).length+1});function Qs(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Pn,Zs=k(()=>{"use strict";Pn=class{constructor(){this.features=new Map}add(e){this.features.set(e.name,e)}get(e){return this.features.get(e)}async setupAll(e){var t;for(let r of this.features.values())try{await r.setup(e)}catch(s){e.log(`[scalebun] feature "${r.name}" failed to set up:`,s);try{let i=s,o=String((t=i==null?void 0:i.message)!=null?t:s).slice(0,300);e.trackEvent("sdk_feature_setup_failed",{feature:r.name,error:(i==null?void 0:i.name)||"Error",message:o,moduleLoad:Qs(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}}});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function ei(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=k(()=>{"use strict"});function ti(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ti(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Nc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=k(()=>{"use strict"});var Uc={};L(Uc,{anchorOf:()=>zc,fieldKeyOf:()=>Hc,fieldLabelOf:()=>$c,formIdOf:()=>Nn,installFormAnalytics:()=>Zg,isSensitiveField:()=>Dc,isTrackableField:()=>qc,stepOf:()=>jt});function Dc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Wg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return jg.test(t)}function qc(n){if(!n||typeof n.matches!="function"||!n.matches(Gg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Kg.has(e)?!1:!Dc(n)}function Hc(n,e){let t=n.getAttribute("name");if(t)return t;if(n.id)return n.id;let r=(n.getAttribute("type")||n.tagName).toLowerCase(),s=-1;try{s=Array.prototype.indexOf.call(e.elements,n)}catch{}return s>=0?`${r}[${s}]`:r}function $c(n){var r,s,i,o,a;let e="";try{if(e=n.getAttribute("aria-label")||"",!e){let c=n.getAttribute("id"),l=n.ownerDocument;if(c&&l&&(e=((r=l.querySelector(`label[for="${c}"]`))==null?void 0:r.textContent)||""),e||(e=((i=(s=n.closest)==null?void 0:s.call(n,"label"))==null?void 0:i.textContent)||""),!e){let u=n.getAttribute("aria-labelledby");u&&l&&(e=((a=l.getElementById((o=u.split(/\s+/)[0])!=null?o:""))==null?void 0:a.textContent)||"")}}}catch{}let t=j(e.replace(/\s+/g," ").trim());if(t)return t.length>Bc?`${t.slice(0,Bc-1)}\u2026`:t}function Jg(n){let e=5381;for(let t=0;t<n.length;t++)e=(e<<5)+e+n.charCodeAt(t)|0;return(e>>>0).toString(36)}function Nn(n){var s,i;if(n.id)return n.id;let e=n.getAttribute("name");if(e)return e;let t="";try{t=(s=(n.getAttribute("action")||"").split("?")[0])!=null?s:""}catch{}let r=[];try{for(let o of Array.from(n.elements)){let a=(i=o.getAttribute)==null?void 0:i.call(o,"name");a&&r.push(a)}}catch{}return`form_${Jg(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function jt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function zc(n){var e,t,r;try{let s=(e=n.getBoundingClientRect)==null?void 0:e.call(n);if(!s||s.width===0&&s.height===0)return;let i={ex:s.x|0,ey:s.y|0,ew:s.width|0,eh:s.height|0},o=(r=(t=n.closest)==null?void 0:t.call(n,"[data-scalebun-component]"))==null?void 0:r.getAttribute("data-scalebun-component");return o&&(i.component=o),i}catch{return}}function Qg(n){let e=n.validity;return e?e.valueMissing?"required":e.typeMismatch?"type":e.patternMismatch?"pattern":e.tooShort?"too_short":e.tooLong?"too_long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.badInput?"bad_input":e.customError?"custom":"invalid":"invalid"}function Zg(n){if(typeof document=="undefined")return{onSubmit:()=>({}),stop:()=>{}};let e=!0,t=new Map,r=m=>{let h=t.get(m);return h||(t.size>=Yg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Nn(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:jt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,Xg).map(([h,g])=>({key:h,ms:Math.round(g.ms),changed:g.changed,errored:g.errored,order:g.order,...g.label?{label:g.label}:{}})),o=m=>{if(!e)return null;let h=m.target;if(!qc(h))return null;let g=h.form;if(!g||Fc(g)||Fc(h))return null;let S=r(g);return S?{form:g,el:h,key:Hc(h,g),st:S}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:S}=h,v=g.fields.get(S);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:$c(h.el)},g.fields.set(S,v)),v.focusedAt=at(),g.lastField=S},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var S;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:Nn(h.form),field_key:h.key,error_type:Qg(h.el),step:jt(h.form),...(S=zc(h.el))!=null?S:{}}})},d=(m,h)=>{var g;for(let S of h.fields.values())S.focusedAt!=null&&(S.ms+=at()-S.focusedAt,S.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Nn(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var Wg,jg,Kg,Gg,Xg,Yg,Bc,Fc,at,Vc=k(()=>{"use strict";$();Wg=new Set(["password","hidden"]),jg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Kg=new Set(["submit","button","reset","image"]),Gg="input, select, textarea",Xg=30,Yg=20;Bc=60;Fc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Wc={};L(Wc,{installScrollTracker:()=>eb});function eb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>tb(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=0,s=()=>document.documentElement,i=()=>{try{let l=s();e=Math.max(e,l.scrollHeight),t=window.innerWidth||l.clientWidth||0,r=window.innerHeight||l.clientHeight||0}catch{}},o=()=>{let l=window.scrollY||window.pageYOffset||0;l>n&&(n=l)},a;if(typeof ResizeObserver!="undefined")try{a=new ResizeObserver(()=>i()),a.observe(s())}catch{a=void 0}return i(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),{summary:()=>{i();let l=e||0,u=r||0,d=Et(n,l,u);return{scroll_depth_pct:d,max_scroll_px:Math.round(n),doc_h:Math.round(l),viewport_w:Math.round(t),viewport_h:Math.round(u),max_bucket:Nc(d),scrollable:ti(l,u)}},reset:()=>{n=0,e=0,t=window.innerWidth||0,r=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",i),a==null||a.disconnect()}}}function tb(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var jc=k(()=>{"use strict";On()});var Gc={};L(Gc,{ATTENTION_BANDS:()=>nb,bandFractions:()=>Kc,installAttentionTracker:()=>rb});function Kc(n,e,t,r){let s=new Array(r).fill(0);if(t<=0||e<=0||r<=0)return s;let i=t/r,o=Math.max(0,n),a=Math.min(t,n+e);for(let c=0;c<r;c++){let l=c*i,u=(c+1)*i,d=Math.max(0,Math.min(a,u)-Math.max(o,l));s[c]=i>0?d/i:0}return s}function rb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>sb(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,S=Kc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=S[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function sb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var nb,ct,Xc=k(()=>{"use strict";nb=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var Zc={};L(Zc,{describeElement:()=>Fn,installAutocapture:()=>pb});function cb(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Fn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:cb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Qc(r):r),n.id&&(t.el_id=n.id);let s=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,3);s.length&&(t.classes=s);let i=n.getAttribute("href");i&&!/^\s*javascript:/i.test(i)&&(t.href=i);let o=n.getAttribute("name");o&&(t.name=o);let a=(c=n.closest("[data-scalebun-variant]"))==null?void 0:c.getAttribute("data-scalebun-variant");return a&&(t.variant=a),t}function lb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Yc))return t;return n&&typeof n.closest=="function"?n.closest(Yc):null}function db(n){return ab.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function ub(n){try{return new URL(n,location.href)}catch{return null}}function Jc(){try{return location.pathname}catch{return""}}function pb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Vc(),Uc)).then(T=>{e&&(t=T.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(jc(),Wc)).then(T=>{e&&(r=T.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(Xc(),Gc)).then(T=>{e&&(s=T.installAttentionTracker())}).catch(()=>{});let i=T=>{var ce;if(!e)return;let A=T.target,O=typeof T.composedPath=="function"?T.composedPath():[],z=lb(A,O),D=z!=null?z:A&&db(A)?A:null;if(!D||Bn(D))return;let te={...Fn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=ub(J);if(!Q)return;D.hasAttribute("download")||ob.test(Q.pathname+Q.search)?n.onEvent({name:"$download",props:{url:Q.href,file:Q.pathname.split("/").pop()||Q.pathname,path:location.pathname}}):Q.host&&Q.host!==location.host&&n.onEvent({name:"$outbound_link",props:{url:Q.href,host:Q.host,path:location.pathname}})},o=T=>{var z;if(!e)return;let A=T.target;if(!A||typeof A.matches!="function"||!A.matches(ib)||Bn(A))return;let O={...Fn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];O.option_value=A.value,O.option_index=A.selectedIndex,D&&(O.option_text=n.maskText===!0?Qc(D.text):D.text),O.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(O.checked=A.checked,O.input_type=A.type,A.value&&A.value!=="on"&&(O.option_value=A.value));n.onEvent({name:"$change",props:O})},a=T=>{var O;if(!e)return;let A=T.target;!A||A.tagName!=="FORM"||Bn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(O=t==null?void 0:t.onSubmit(A))!=null?O:{}}})},c=0,l=null,u=0,d=Jc(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},S=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let T=document.documentElement,A=Et(window.scrollY,T.scrollHeight,window.innerHeight||T.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var T,A;!p||f||(S(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(T=r==null?void 0:r.summary())!=null?T:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},E=new WeakSet,w;typeof IntersectionObserver!="undefined"&&(w=new IntersectionObserver(T=>{if(e)for(let A of T){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!E.has(O)&&(E.add(O),w.unobserve(O),Bn(O)||n.onEvent({name:"$impression",props:{...Fn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!w||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(T=>{E.has(T)||w.observe(T)})}catch{}},x=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=Jc(),p=!0,f=!1,g(),I()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",S),window.addEventListener("popstate",x);let C=history.pushState,M=history.replaceState;return history.pushState=function(...T){C.apply(this,T),x()},history.replaceState=function(...T){M.apply(this,T),x()},x(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",S),window.removeEventListener("popstate",x),w==null||w.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Yc,ib,ob,ab,Qc,Bn,el=k(()=>{"use strict";On();Yc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',ib='select, input[type="checkbox"], input[type="radio"]',ob=/\.(pdf|zip|gz|tar|rar|7z|csv|tsv|xlsx?|docx?|pptx?|dmg|pkg|exe|msi|apk|ipa|mp3|mp4|mov|avi|wav|svg|png|jpe?g|gif|webp|txt|json|xml)(\?|#|$)/i,ab=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Qc=n=>n.replace(/\S/g,"*");Bn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function di(n){return n.replace(/[?#].*$/,"").trim()}function Mb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function xl(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:di((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:di((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:di(n)}}function Sl(n,e){let t={};return n&&n!=="<anonymous>"&&(t.function=n),e.file&&(t.file=e.file),e.line!=null&&(t.line=e.line),e.col!=null&&(t.col=e.col),t.inApp=Mb(e.file),t}function Pb(n){let e=n.trim();if(!e)return null;if(e.indexOf("at ")===0){let r=e.slice(3).trim().replace(/^async\s+/,""),s,i=r.indexOf(" (");i!==-1&&r.endsWith(")")&&(s=r.slice(0,i).trim()||void 0,r=r.slice(i+2,-1));let o=xl(r);return o?Sl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=xl(e.slice(t+1));if(s&&s.file)return Sl(r,s)}return null}function kl(n){var r;if(!n)return[];let e=[],t=n.split(`
|
|
2
2
|
`);for(let s=0;s<t.length&&e.length<50;s++){let i=Pb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var El=k(()=>{"use strict"});function _b(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function Ob(n){var i;if(!n||!n.length)return"";let e=n.filter(o=>o.inApp),t=e.length?e:n,r=[],s="";for(let o of t){let a=`${(i=o.function)!=null?i:"<anonymous>"}@${_b(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=Lb))break}return r.join(">")}function Nb(n){return n.replace(/0x[0-9a-f]+/gi,"0x?").replace(/\b[0-9a-f]{8,}\b/gi,"H").replace(/\d+/g,"N").replace(/(['"]).*?\1/g,"S").trim().slice(0,200)}function Il(n,e,t){let r=Ob(e),s=r?`${n}|${r}`:`${n}|${Nb(t)}`;return Ee(s).toString(36)}var Lb,Cl=k(()=>{"use strict";Fe();Lb=5});function Al(n,e){let t=[],r=new Set,s=a=>{var u;if(!a||typeof a!="object"||r.has(a)||t.length>=5)return;r.add(a);let c=a,l=e(c.stack);t.push({type:c.name,message:String((u=c.message)!=null?u:a),...l.length?{frames:l}:{}})},i=n==null?void 0:n.errors;if(Array.isArray(i))for(let a of i)s(a);let o=n==null?void 0:n.cause;for(;o&&t.length<5&&!r.has(o);)s(o),o=o==null?void 0:o.cause;return t}var Tl=k(()=>{"use strict"});var Rl={};L(Rl,{computeFingerprint:()=>Il,extractCauses:()=>Al,parseStack:()=>kl});var Ml=k(()=>{"use strict";El();Cl();Tl()});function zl(n){try{if(typeof n=="string")return n.length;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size}catch{}return 0}function pi(n,e,t){let r=n.WebSocket;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=0,f=0,m=!1,h=!1,g=a.send.bind(a);a.send=function(y){return u++,p+=zl(y),g(y)},a.addEventListener("message",v=>{d++,f+=zl(v.data)}),a.addEventListener("error",()=>{m=!0});let S=(v,y)=>{if(h)return;h=!0;let b={protocol:"ws",method:"GET",url:c,status:m&&v===void 0?0:void 0,startedAt:l,duration:Date.now()-l,error:m?"websocket error":void 0,ws:{messagesSent:u,messagesReceived:d,bytesSent:p,bytesReceived:f,...v!==void 0?{closeCode:v}:{},...y?{closeReason:y}:{}}};e(b)};return a.addEventListener("close",v=>S(v.code,v.reason)),a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSING:{value:r.CLOSING},CLOSED:{value:r.CLOSED}})}catch{}return n.WebSocket=s,()=>{n.WebSocket=r}}var Ul=k(()=>{"use strict"});function fi(n,e,t){let r=n.EventSource;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=!1,f=!1,m=()=>{if(f)return;f=!0;let g={protocol:"sse",method:"GET",url:c,status:p?0:void 0,startedAt:l,duration:Date.now()-l,error:p?"eventsource error":void 0,ws:{messagesReceived:u,bytesReceived:d,messagesSent:0,bytesSent:0}};e(g)};a.addEventListener("message",g=>{u++,d+=typeof g.data=="string"?g.data.length:0}),a.addEventListener("error",()=>{a.readyState===2&&(p=!0,m())});let h=a.close.bind(a);return a.close=function(){return m(),h()},a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSED:{value:r.CLOSED}})}catch{}return n.EventSource=s,()=>{n.EventSource=r}}var Vl=k(()=>{"use strict"});function ny(n){try{if(n==null)return 0;if(typeof n=="string")return n.length;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString().length}catch{}}function mi(n,e,t){let r=n.sendBeacon;return typeof r!="function"?()=>{}:(n.sendBeacon=function(i,o){let a=String(i);if(t(a))return r.call(n,i,o!=null?o:void 0);let c=Date.now(),l=r.call(n,i,o!=null?o:void 0),u={protocol:"beacon",method:"POST",url:a,status:l?void 0:0,startedAt:c,duration:Date.now()-c,requestSize:ny(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Wl=k(()=>{"use strict"});var jl={};L(jl,{installBeacon:()=>mi,installEventSource:()=>fi,installStreams:()=>ry,installWebSocket:()=>pi});function ry(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(pi(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(fi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(mi(e,t,r)),i}var Kl=k(()=>{"use strict";Ul();Vl();Wl()});function hi(n,e){if(/graphql/i.test(n))return!0;if(!e)return!1;let t=e.slice(0,200);return/["']?query["']?\s*[:=]/.test(t)||/^\s*(query|mutation|subscription)\b/.test(t)}function gi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=Xl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?Gl(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=Xl(e);return t&&("query"in t||"operationName"in t)?Gl(t):void 0}if(Yl.test(e))return iy(e)}function Jn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Jn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function Gl(n){let e={},t=n.operationName;typeof t=="string"&&t&&(e.operationName=t);let r=typeof n.query=="string"?n.query:void 0;if(r){let s=Jl(r);if(s&&(e.operationType=s),!e.operationName){let i=Ql(r);i&&(e.operationName=i)}}return e}function iy(n){let e={},t=Jl(n);t&&(e.operationType=t);let r=Ql(n);return r&&(e.operationName=r),e}function Jl(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Yl.exec(e.slice(0,64));return t?t[1]:void 0}function Ql(n){let e=sy.exec(n);return e&&e[2]?e[2]:void 0}function Xl(n){try{return JSON.parse(n)}catch{return}}var Yl,sy,Zl=k(()=>{"use strict";Yl=/\b(query|mutation|subscription)\b/,sy=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function bi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function yi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var tI,ed=k(()=>{"use strict";$();tI=64*1024});var td={};L(td,{enrichHttpCapture:()=>oy,graphqlResponseHasErrors:()=>Jn,looksLikeGraphql:()=>hi,parseGraphqlRequest:()=>gi});async function oy(n,e){var s,i,o;let t,r=async()=>(t===void 0&&(t=n.readResponseText?await n.readResponseText():null),t);if(e.graphql)try{if(hi(n.url,n.reqBody)){let a=(s=gi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Jn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&bi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:yi(n.reqBody,a.bodyMaxBytes)}),bi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:yi(c,a.bodyMaxBytes)})}}catch{}}}var nd=k(()=>{"use strict";Zl();ed()});function vd(n){if(tr.size)for(let e of tr)try{e(n)}catch{}}function wd(n){return tr.add(n),()=>{tr.delete(n)}}var tr,Ei=k(()=>{"use strict";tr=new Set});var rr,sr,ir=k(()=>{"use strict";rr={startChild:()=>rr,finish(){},setData(){}},sr={startSpan:()=>rr,finish(){}}});function Ad(n){var r;let e=new Uint8Array(n);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Date.now()+s*2654435761&255;let t="";for(let s=0;s<n;s++)t+=((r=e[s])!=null?r:0).toString(16).padStart(2,"0");return t}function At(){return Ad(16)}function je(){return Ad(8)}function Td(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Rd(n){var t,r,s;let e=gy.exec(n.trim().toLowerCase());return e?{traceId:(t=e[1])!=null?t:"",spanId:(r=e[2])!=null?r:"",sampled:(parseInt((s=e[3])!=null?s:"0",16)&1)===1}:null}var gy,or=k(()=>{"use strict";gy=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var ar,Md=k(()=>{"use strict";or();ir();ar=class{constructor(e,t){this.name=e;this.traceId=At();this.rootSpanId=je();this.spans=[];this.dropped=0;this.errors=0;var r,s;this.clock=t.clock,this.maxSpans=(r=t.maxSpans)!=null?r:1e3,this.sampled=(s=t.sampled)!=null?s:!0,this.onFinish=t.onFinish,this.startMs=this.clock()}open(e,t,r){if(this.endMs!=null||this.spans.length>=this.maxSpans)return this.dropped++,rr;let s={spanId:je(),parentSpanId:t,op:e,description:r,startMs:this.clock()};this.spans.push(s);let i=this.clock;return{startChild:(o,a)=>this.open(o,s.spanId,a),finish:(o=i())=>{s.endMs==null&&(s.endMs=o)},setData:(o,a)=>{var c;((c=s.data)!=null?c:s.data={})[o]=a}}}startSpan(e,t){return this.open(e,this.rootSpanId,t)}addSpan(e,t,r,s){if(this.endMs!=null||this.spans.length>=this.maxSpans){this.dropped++;return}this.spans.push({spanId:je(),parentSpanId:this.rootSpanId,op:e,startMs:Math.round(t),endMs:Math.round(r),...s?{data:s}:{}})}finish(e=this.clock()){this.endMs==null&&(this.endMs=e,this.onFinish(this))}noteError(){this.endMs==null&&this.errors++}context(){return{traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled}}data(){var e;return{name:this.name,traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled,startMs:this.startMs,durationMs:Math.max(0,((e=this.endMs)!=null?e:this.startMs)-this.startMs),spans:this.spans.slice(),...this.dropped>0?{droppedSpans:this.dropped}:{},...this.errors>0?{errorCount:this.errors}:{}}}}});function Pd(n,e){let t=At(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ci(a),endMs:Ci(c)})};return i("dns",n.domainLookupStart,n.domainLookupEnd),i("connect",n.connectStart,n.connectEnd),n.secureConnectionStart>0&&i("tls",n.secureConnectionStart,n.connectEnd),i("request",n.requestStart,n.responseStart),i("response",n.responseStart,n.responseEnd),i("dom",n.responseEnd,n.domContentLoadedEventEnd),i("load",n.domContentLoadedEventEnd,n.loadEventEnd),{name:`pageload ${e}`,traceId:t,spanId:r,sampled:!0,startMs:0,durationMs:Ci(n.loadEventEnd||n.duration),spans:s}}var Ci,Ld=k(()=>{"use strict";or();Ci=n=>Math.round(n)});var _d={};L(_d,{Transaction:()=>ar,buildPageload:()=>Pd,formatTraceparent:()=>Td,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Rd});var Od=k(()=>{"use strict";Md();or();Ld()});var zd={};L(zd,{createBugReportWidget:()=>By});function Oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function Ny(n){return`[data-scalebun-bugreport]{position:fixed;${Oy(n)}z-index:${_y};font-family:system-ui,sans-serif}[data-scalebun-bugreport] .sbbr-launch{cursor:pointer;border:none;border-radius:9999px;padding:10px 16px;font-size:13px;font-weight:600;color:#fff;background:#ef4444;box-shadow:0 2px 8px rgba(0,0,0,.2)}[data-scalebun-bugreport].sbbr-expanded .sbbr-launch{display:none}[data-scalebun-bugreport] .sbbr-panel{display:none;width:min(300px,calc(100vw - 32px));background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:12px;padding:14px;box-shadow:0 8px 30px rgba(0,0,0,.18);margin-top:8px}[data-scalebun-bugreport] .sbbr-panel.sbbr-open{display:block}[data-scalebun-bugreport] .sbbr-title{font-size:14px;font-weight:700;margin-bottom:8px}[data-scalebun-bugreport] .sbbr-field{width:100%;box-sizing:border-box;font:inherit;font-size:13px;padding:8px;border:1px solid #e5e7eb;border-radius:8px}[data-scalebun-bugreport] textarea.sbbr-field{resize:vertical}[data-scalebun-bugreport] .sbbr-email{margin-top:8px}[data-scalebun-bugreport] .sbbr-status{font-size:12px;color:#6b7280;min-height:16px;margin-top:8px}[data-scalebun-bugreport] .sbbr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}[data-scalebun-bugreport] .sbbr-btn{cursor:pointer;font:inherit;font-size:13px;padding:6px 12px;border-radius:8px}[data-scalebun-bugreport] .sbbr-cancel{border:1px solid #e5e7eb;background:#fff}[data-scalebun-bugreport] .sbbr-send{font-weight:600;border:none;background:#ef4444;color:#fff}@media(prefers-color-scheme:dark){[data-scalebun-bugreport] .sbbr-panel{background:#17161c;color:#ececf1;border-color:#2e2c36;box-shadow:0 8px 30px rgba(0,0,0,.5)}[data-scalebun-bugreport] .sbbr-field{background:#111016;color:#ececf1;border-color:#2e2c36}[data-scalebun-bugreport] .sbbr-field::placeholder{color:#8b8796}[data-scalebun-bugreport] .sbbr-status{color:#a5a1b0}[data-scalebun-bugreport] .sbbr-cancel{background:#221f2b;color:#ececf1;border-color:#2e2c36}}`}function By(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,Ny(n.position));let t=document.createElement("button");t.type="button",t.className="sbbr-launch",t.textContent=n.label;let r=document.createElement("div");r.className="sbbr-panel",r.innerHTML=`
|
|
3
3
|
<div class="sbbr-title">Report a bug</div>
|
|
4
4
|
<textarea data-scalebun-msg class="sbbr-field" placeholder="What went wrong?" rows="4"></textarea>
|