@scalebun/web 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/scalebun.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,6 @@ import { ScaleBun } from '@scalebun/web';
|
|
|
18
18
|
|
|
19
19
|
await ScaleBun.init({
|
|
20
20
|
clientKey: 'your-client-key',
|
|
21
|
-
apiBaseUrl: 'https://ingest.your-scalebun-host.com/api/v1',
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
// Track product events
|
|
@@ -42,7 +41,6 @@ A prebuilt browser bundle is published for `unpkg`/`jsDelivr`. Configure via `da
|
|
|
42
41
|
<script
|
|
43
42
|
src="https://unpkg.com/@scalebun/web/dist/scalebun.min.js"
|
|
44
43
|
data-client-key="your-client-key"
|
|
45
|
-
data-api-base-url="https://ingest.your-scalebun-host.com/api/v1"
|
|
46
44
|
></script>
|
|
47
45
|
```
|
|
48
46
|
|
package/dist/scalebun.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var Bh=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>{for(var t in e)Bh(n,t,{get:e[t],enumerable:!0})};function $(){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 qa(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem($a);if(n)return n;let e=`web_${$()}`;return localStorage.setItem($a,e),e}}catch{}return`web_${$()}`}var $a,za=E(()=>{"use strict";$a="scalebun_device_id"});function Ua(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Os,...e)}}var Os,Ns=E(()=>{"use strict";Os="[scalebun]"});var Va=E(()=>{"use strict"});function Wa(){return{platform:"web",renderer:"dom",sdk:{name:Dh,version:Bs}}}function ja(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=Hh(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function Ka(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function Ga(){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 Hh(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var Dh,Bs,Ya=E(()=>{"use strict";Dh="@scalebun/web",Bs="1.2.2"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function Uh(n){return n.replace(qh,"[email]").replace(zh,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return Uh(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]=$h.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var $h,qh,zh,Fs=E(()=>{"use strict";$h=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,qh=/[\w.+-]+@[\w-]+\.[\w.-]+/g,zh=/\b\d[\d -]{11,18}\d\b/g});function Xa(n){try{let e=Ja()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function Vh(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function Wh(){let n=typeof document!="undefined";return{dom:n,storage:Xa("localStorage"),session:Xa("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:Vh(),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 jh(){return Ds===null&&(Ds=Wh()),Ds}function $t(n){return jh()[n]}var Ja,ht,Ds,Hs=E(()=>{"use strict";Ja=()=>globalThis,ht=n=>typeof Ja()[n]!="undefined";Ds=null});function Pe(n,e,t){if(!$t("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 $s=E(()=>{"use strict";Hs()});var bn,Qa=E(()=>{"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 gt(n){return n.length>Za?n.slice(0,Za):n}function Yh(n){return n.replace(/[?#].*$/,"")}function Xh(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ec(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 Jh(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:Xh(n.level),message:gt(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:gt(j(`${n.method} ${Yh(n.url)}`)),data:ec({status:r,duration:n.duration})}}case"event":return Qh(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:gt(j(n.message))};default:return null}}function Qh(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:gt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ec({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:gt(j(n))}}function tc(n){zs=n}function nc(n){if(!zs)return n;try{return zs(n)}catch{return n}}function rc(n){let e=n.message?{...n,message:gt(j(n.message))}:n,t=nc(e);t&&We.add(t)}function sc(n){let e=Jh(n);if(!e)return;let t=nc(e);t&&We.add(t)}function ic(){We.clear()}var Kh,Gh,Za,qs,We,zs,oc=E(()=>{"use strict";Fs();Kh=50,Gh=200,Za=256;qs=class{constructor(){this.ring=[];this.max=Kh}setMax(e){this.max=Math.max(1,Math.min(Gh,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 qs});function ac(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 cc(){yn=void 0,vn=void 0}var yn,vn,lc=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(qt={...qt,...n})}function bt(){return qt}function dc(){let n=qt.deviceId;qt=n!=null?{deviceId:n}:{}}var qt,uc=E(()=>{"use strict";qt={}});function Zh(){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 Vs(){return Us===null&&(Us=Zh()),Us}function eg(){return Vs()==="browser"}function pc(){return!eg()}var Us,fc=E(()=>{"use strict";Us=null});function wn(n){n&&(Ws=n)}function yt(n){if(Ws)try{n.nonce=Ws}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=yt(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 Ws,mc=E(()=>{"use strict";Ws=null});var q=E(()=>{"use strict";za();Ns();Va();Ya();Fs();$s();Qa();oc();lc();uc();fc();Hs();mc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks);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 vt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ks,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function hc(n=Ut,e=Gs){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,vt(r),it=r,r;let s={id:`sess_${$()}`,startedAt:t,lastSeenAt:t,seq:0};return vt(s),it=s,s}function gc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks)===null){it.lastSeenAt=n,vt(it),js=n;return}}catch{}if(n-js<6e4)return;js=n;let e=xn();e&&(e.lastSeenAt=n,vt(e),it=e)}function Ys(n=1){let e=xn();if(!e){let r=zt;return zt+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),vt(e),t}function bc(n){let e=xn();return e?(e.seq<n&&(e.seq=n,vt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ks,Ut,Gs,it,js,zt,Sn=E(()=>{"use strict";q();Ks="scalebun_session",Ut=30*60*1e3,Gs=4*60*60*1e3;it=null,js=0,zt=0});var Js={};_(Js,{SDK_SIGNING_VERSION:()=>yc,signBody:()=>vc,signatureHeaders:()=>rg});function tg(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 ng(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function vc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await tg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return ng(new Uint8Array(i))}catch{return null}}async function rg(n,e){let t=await vc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":yc}:{}}var yc,Xs,Qs=E(()=>{"use strict";yc="1",Xs=new Map});var wc={};_(wc,{gzipString:()=>sg});async function sg(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 xc=E(()=>{"use strict"});function ag(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(ig,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(wt)||t.createObjectStore(wt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var ig,wt,og,Be,Vt=E(()=>{"use strict";ig="scalebun",wt="queue",og="pending";Be=class{constructor(e=og){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=ag()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(wt,"readonly").objectStore(wt).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(wt,"readwrite");s.objectStore(wt).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 Sc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var cg,lg,xt,Cn=E(()=>{"use strict";cg=1e3,lg=3e4,xt=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(lg,cg*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 St(n,e){if(kc(n)<=2e6)return n.slice();let t=e?n.filter(r=>!e(r)):n.slice();for(;t.length&&kc(t)>2e6;)t.shift();return t}var kc,Rn=E(()=>{"use strict";kc=n=>JSON.stringify(n).length});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 Zs(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=E(()=>{"use strict"});function ei(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function kt(n,e,t){if(!(e>0)||!ei(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 Rc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var _n=E(()=>{"use strict"});var Bc={};_(Bc,{anchorOf:()=>Nc,fieldKeyOf:()=>_c,fieldLabelOf:()=>Oc,formIdOf:()=>On,installFormAnalytics:()=>Ag,isSensitiveField:()=>Pc,isTrackableField:()=>Lc,stepOf:()=>Wt});function Pc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(vg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return wg.test(t)}function Lc(n){if(!n||typeof n.matches!="function"||!n.matches(Sg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return xg.has(e)?!1:!Pc(n)}function _c(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 Oc(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>Tc?`${t.slice(0,Tc-1)}\u2026`:t}function Ig(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 On(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_${Ig(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function Wt(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 Nc(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 Cg(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 Ag(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>=Eg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:On(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:Wt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,kg).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(!Lc(h))return null;let g=h.form;if(!g||Mc(g)||Mc(h))return null;let k=r(g);return k?{form:g,el:h,key:_c(h,g),st:k}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:k}=h,v=g.fields.get(k);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Oc(h.el)},g.fields.set(k,v)),v.focusedAt=at(),g.lastField=k},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 k;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:On(h.form),field_key:h.key,error_type:Cg(h.el),step:Wt(h.form),...(k=Nc(h.el))!=null?k:{}}})},d=(m,h)=>{var g;for(let k of h.fields.values())k.focusedAt!=null&&(k.ms+=at()-k.focusedAt,k.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:On(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:Wt(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:Wt(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 vg,wg,xg,Sg,kg,Eg,Tc,Mc,at,Fc=E(()=>{"use strict";q();vg=new Set(["password","hidden"]),wg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,xg=new Set(["submit","button","reset","image"]),Sg="input, select, textarea",kg=30,Eg=20;Tc=60;Mc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Dc={};_(Dc,{installScrollTracker:()=>Rg});function Rg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Tg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=kt(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Rc(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Tg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Hc=E(()=>{"use strict";_n()});var qc={};_(qc,{ATTENTION_BANDS:()=>Mg,bandFractions:()=>$c,installAttentionTracker:()=>Pg});function $c(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 Pg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Lg(),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,k=$c(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=k[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 Lg(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Mg,ct,zc=E(()=>{"use strict";Mg=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var jc={};_(jc,{describeElement:()=>Bn,installAutocapture:()=>$g});function Bg(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 Bn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:Bg(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Wc(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 Fg(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Uc))return t;return n&&typeof n.closest=="function"?n.closest(Uc):null}function Dg(n){return Ng.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function Hg(n){try{return new URL(n,location.href)}catch{return null}}function Vc(){try{return location.pathname}catch{return""}}function $g(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Fc(),Bc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Hc(),Dc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(zc(),qc)).then(R=>{e&&(s=R.installAttentionTracker())}).catch(()=>{});let i=R=>{var ce;if(!e)return;let A=R.target,O=typeof R.composedPath=="function"?R.composedPath():[],z=Fg(A,O),D=z!=null?z:A&&Dg(A)?A:null;if(!D||Nn(D))return;let te={...Bn(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=Hg(J);if(!Q)return;D.hasAttribute("download")||Og.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=R=>{var z;if(!e)return;let A=R.target;if(!A||typeof A.matches!="function"||!A.matches(_g)||Nn(A))return;let O={...Bn(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?Wc(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=R=>{var O;if(!e)return;let A=R.target;!A||A.tagName!=="FORM"||Nn(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=Vc(),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())},k=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=kt(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(k(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(R=r==null?void 0:r.summary())!=null?R:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},x=new WeakSet,S;typeof IntersectionObserver!="undefined"&&(S=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!x.has(O)&&(x.add(O),S.unobserve(O),Nn(O)||n.onEvent({name:"$impression",props:{...Bn(O),path:location.pathname}}))}},{threshold:[.5]}));let w=()=>{if(!(!S||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{x.has(R)||S.observe(R)})}catch{}},I=()=>{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=Vc(),p=!0,f=!1,g(),w()}};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",k),window.addEventListener("popstate",I);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),I()},history.replaceState=function(...R){M.apply(this,R),I()},I(),()=>{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",k),window.removeEventListener("popstate",I),S==null||S.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Uc,_g,Og,Ng,Wc,Nn,Kc=E(()=>{"use strict";_n();Uc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',_g='select, input[type="checkbox"], input[type="radio"]',Og=/\.(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,Ng=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Wc=n=>n.replace(/\S/g,"*");Nn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function sb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function ml(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:li((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:li((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:li(n)}}function hl(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=sb(e.file),t}function ib(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=ml(r);return o?hl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=ml(e.slice(t+1));if(s&&s.file)return hl(r,s)}return null}function gl(n){var r;if(!n)return[];let e=[],t=n.split(`
|
|
1
|
+
"use strict";(()=>{var Bh=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>{for(var t in e)Bh(n,t,{get:e[t],enumerable:!0})};function $(){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 qa(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem($a);if(n)return n;let e=`web_${$()}`;return localStorage.setItem($a,e),e}}catch{}return`web_${$()}`}var $a,za=E(()=>{"use strict";$a="scalebun_device_id"});function Ua(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Os,...e)}}var Os,Ns=E(()=>{"use strict";Os="[scalebun]"});var Va=E(()=>{"use strict"});function Wa(){return{platform:"web",renderer:"dom",sdk:{name:Dh,version:Bs}}}function ja(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=Hh(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function Ka(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function Ga(){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 Hh(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var Dh,Bs,Ya=E(()=>{"use strict";Dh="@scalebun/web",Bs="1.2.3"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function Uh(n){return n.replace(qh,"[email]").replace(zh,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return Uh(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]=$h.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var $h,qh,zh,Fs=E(()=>{"use strict";$h=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,qh=/[\w.+-]+@[\w-]+\.[\w.-]+/g,zh=/\b\d[\d -]{11,18}\d\b/g});function Xa(n){try{let e=Ja()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function Vh(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function Wh(){let n=typeof document!="undefined";return{dom:n,storage:Xa("localStorage"),session:Xa("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:Vh(),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 jh(){return Ds===null&&(Ds=Wh()),Ds}function $t(n){return jh()[n]}var Ja,ht,Ds,Hs=E(()=>{"use strict";Ja=()=>globalThis,ht=n=>typeof Ja()[n]!="undefined";Ds=null});function Pe(n,e,t){if(!$t("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 $s=E(()=>{"use strict";Hs()});var bn,Qa=E(()=>{"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 gt(n){return n.length>Za?n.slice(0,Za):n}function Yh(n){return n.replace(/[?#].*$/,"")}function Xh(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ec(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 Jh(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:Xh(n.level),message:gt(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:gt(j(`${n.method} ${Yh(n.url)}`)),data:ec({status:r,duration:n.duration})}}case"event":return Qh(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:gt(j(n.message))};default:return null}}function Qh(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:gt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ec({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:gt(j(n))}}function tc(n){zs=n}function nc(n){if(!zs)return n;try{return zs(n)}catch{return n}}function rc(n){let e=n.message?{...n,message:gt(j(n.message))}:n,t=nc(e);t&&We.add(t)}function sc(n){let e=Jh(n);if(!e)return;let t=nc(e);t&&We.add(t)}function ic(){We.clear()}var Kh,Gh,Za,qs,We,zs,oc=E(()=>{"use strict";Fs();Kh=50,Gh=200,Za=256;qs=class{constructor(){this.ring=[];this.max=Kh}setMax(e){this.max=Math.max(1,Math.min(Gh,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 qs});function ac(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 cc(){yn=void 0,vn=void 0}var yn,vn,lc=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(qt={...qt,...n})}function bt(){return qt}function dc(){let n=qt.deviceId;qt=n!=null?{deviceId:n}:{}}var qt,uc=E(()=>{"use strict";qt={}});function Zh(){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 Vs(){return Us===null&&(Us=Zh()),Us}function eg(){return Vs()==="browser"}function pc(){return!eg()}var Us,fc=E(()=>{"use strict";Us=null});function wn(n){n&&(Ws=n)}function yt(n){if(Ws)try{n.nonce=Ws}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=yt(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 Ws,mc=E(()=>{"use strict";Ws=null});var q=E(()=>{"use strict";za();Ns();Va();Ya();Fs();$s();Qa();oc();lc();uc();fc();Hs();mc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks);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 vt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ks,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function hc(n=Ut,e=Gs){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,vt(r),it=r,r;let s={id:`sess_${$()}`,startedAt:t,lastSeenAt:t,seq:0};return vt(s),it=s,s}function gc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks)===null){it.lastSeenAt=n,vt(it),js=n;return}}catch{}if(n-js<6e4)return;js=n;let e=xn();e&&(e.lastSeenAt=n,vt(e),it=e)}function Ys(n=1){let e=xn();if(!e){let r=zt;return zt+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),vt(e),t}function bc(n){let e=xn();return e?(e.seq<n&&(e.seq=n,vt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ks,Ut,Gs,it,js,zt,Sn=E(()=>{"use strict";q();Ks="scalebun_session",Ut=30*60*1e3,Gs=4*60*60*1e3;it=null,js=0,zt=0});var Js={};_(Js,{SDK_SIGNING_VERSION:()=>yc,signBody:()=>vc,signatureHeaders:()=>rg});function tg(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 ng(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function vc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await tg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return ng(new Uint8Array(i))}catch{return null}}async function rg(n,e){let t=await vc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":yc}:{}}var yc,Xs,Qs=E(()=>{"use strict";yc="1",Xs=new Map});var wc={};_(wc,{gzipString:()=>sg});async function sg(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 xc=E(()=>{"use strict"});function ag(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(ig,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(wt)||t.createObjectStore(wt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var ig,wt,og,Be,Vt=E(()=>{"use strict";ig="scalebun",wt="queue",og="pending";Be=class{constructor(e=og){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=ag()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(wt,"readonly").objectStore(wt).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(wt,"readwrite");s.objectStore(wt).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 Sc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var cg,lg,xt,Cn=E(()=>{"use strict";cg=1e3,lg=3e4,xt=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(lg,cg*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 St(n,e){if(kc(n)<=2e6)return n.slice();let t=e?n.filter(r=>!e(r)):n.slice();for(;t.length&&kc(t)>2e6;)t.shift();return t}var kc,Rn=E(()=>{"use strict";kc=n=>JSON.stringify(n).length});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 Zs(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=E(()=>{"use strict"});function ei(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function kt(n,e,t){if(!(e>0)||!ei(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 Rc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var _n=E(()=>{"use strict"});var Bc={};_(Bc,{anchorOf:()=>Nc,fieldKeyOf:()=>_c,fieldLabelOf:()=>Oc,formIdOf:()=>On,installFormAnalytics:()=>Ag,isSensitiveField:()=>Pc,isTrackableField:()=>Lc,stepOf:()=>Wt});function Pc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(vg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return wg.test(t)}function Lc(n){if(!n||typeof n.matches!="function"||!n.matches(Sg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return xg.has(e)?!1:!Pc(n)}function _c(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 Oc(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>Tc?`${t.slice(0,Tc-1)}\u2026`:t}function Ig(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 On(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_${Ig(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function Wt(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 Nc(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 Cg(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 Ag(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>=Eg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:On(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:Wt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,kg).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(!Lc(h))return null;let g=h.form;if(!g||Mc(g)||Mc(h))return null;let k=r(g);return k?{form:g,el:h,key:_c(h,g),st:k}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:k}=h,v=g.fields.get(k);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Oc(h.el)},g.fields.set(k,v)),v.focusedAt=at(),g.lastField=k},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 k;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:On(h.form),field_key:h.key,error_type:Cg(h.el),step:Wt(h.form),...(k=Nc(h.el))!=null?k:{}}})},d=(m,h)=>{var g;for(let k of h.fields.values())k.focusedAt!=null&&(k.ms+=at()-k.focusedAt,k.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:On(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:Wt(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:Wt(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 vg,wg,xg,Sg,kg,Eg,Tc,Mc,at,Fc=E(()=>{"use strict";q();vg=new Set(["password","hidden"]),wg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,xg=new Set(["submit","button","reset","image"]),Sg="input, select, textarea",kg=30,Eg=20;Tc=60;Mc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Dc={};_(Dc,{installScrollTracker:()=>Rg});function Rg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Tg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=kt(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Rc(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Tg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Hc=E(()=>{"use strict";_n()});var qc={};_(qc,{ATTENTION_BANDS:()=>Mg,bandFractions:()=>$c,installAttentionTracker:()=>Pg});function $c(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 Pg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Lg(),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,k=$c(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=k[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 Lg(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Mg,ct,zc=E(()=>{"use strict";Mg=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var jc={};_(jc,{describeElement:()=>Bn,installAutocapture:()=>$g});function Bg(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 Bn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:Bg(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Wc(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 Fg(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Uc))return t;return n&&typeof n.closest=="function"?n.closest(Uc):null}function Dg(n){return Ng.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function Hg(n){try{return new URL(n,location.href)}catch{return null}}function Vc(){try{return location.pathname}catch{return""}}function $g(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Fc(),Bc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Hc(),Dc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(zc(),qc)).then(R=>{e&&(s=R.installAttentionTracker())}).catch(()=>{});let i=R=>{var ce;if(!e)return;let A=R.target,O=typeof R.composedPath=="function"?R.composedPath():[],z=Fg(A,O),D=z!=null?z:A&&Dg(A)?A:null;if(!D||Nn(D))return;let te={...Bn(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=Hg(J);if(!Q)return;D.hasAttribute("download")||Og.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=R=>{var z;if(!e)return;let A=R.target;if(!A||typeof A.matches!="function"||!A.matches(_g)||Nn(A))return;let O={...Bn(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?Wc(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=R=>{var O;if(!e)return;let A=R.target;!A||A.tagName!=="FORM"||Nn(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=Vc(),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())},k=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=kt(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(k(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(R=r==null?void 0:r.summary())!=null?R:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},x=new WeakSet,S;typeof IntersectionObserver!="undefined"&&(S=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!x.has(O)&&(x.add(O),S.unobserve(O),Nn(O)||n.onEvent({name:"$impression",props:{...Bn(O),path:location.pathname}}))}},{threshold:[.5]}));let w=()=>{if(!(!S||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{x.has(R)||S.observe(R)})}catch{}},I=()=>{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=Vc(),p=!0,f=!1,g(),w()}};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",k),window.addEventListener("popstate",I);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),I()},history.replaceState=function(...R){M.apply(this,R),I()},I(),()=>{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",k),window.removeEventListener("popstate",I),S==null||S.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Uc,_g,Og,Ng,Wc,Nn,Kc=E(()=>{"use strict";_n();Uc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',_g='select, input[type="checkbox"], input[type="radio"]',Og=/\.(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,Ng=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Wc=n=>n.replace(/\S/g,"*");Nn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function sb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function ml(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:li((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:li((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:li(n)}}function hl(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=sb(e.file),t}function ib(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=ml(r);return o?hl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=ml(e.slice(t+1));if(s&&s.file)return hl(r,s)}return null}function gl(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=ib((r=t[s])!=null?r:"");i&&e.push(i)}return e}var bl=E(()=>{"use strict"});function ab(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function cb(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>"}@${ab(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=ob))break}return r.join(">")}function lb(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 yl(n,e,t){let r=cb(e),s=r?`${n}|${r}`:`${n}|${lb(t)}`;return Ee(s).toString(36)}var ob,vl=E(()=>{"use strict";Fe();ob=5});function wl(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 xl=E(()=>{"use strict"});var Sl={};_(Sl,{computeFingerprint:()=>yl,extractCauses:()=>wl,parseStack:()=>gl});var kl=E(()=>{"use strict";bl();vl();xl()});function Nl(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 ui(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+=Nl(y),g(y)},a.addEventListener("message",v=>{d++,f+=Nl(v.data)}),a.addEventListener("error",()=>{m=!0});let k=(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=>k(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 Bl=E(()=>{"use strict"});function pi(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 Fl=E(()=>{"use strict"});function Mb(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 fi(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:Mb(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Dl=E(()=>{"use strict"});var Hl={};_(Hl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>Pb,installWebSocket:()=>ui});function Pb(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(ui(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(pi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(fi(e,t,r)),i}var $l=E(()=>{"use strict";Bl();Fl();Dl()});function mi(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 hi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=zl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?ql(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=zl(e);return t&&("query"in t||"operationName"in t)?ql(t):void 0}if(Ul.test(e))return _b(e)}function Xn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Xn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function ql(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=Vl(r);if(s&&(e.operationType=s),!e.operationName){let i=Wl(r);i&&(e.operationName=i)}}return e}function _b(n){let e={},t=Vl(n);t&&(e.operationType=t);let r=Wl(n);return r&&(e.operationName=r),e}function Vl(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Ul.exec(e.slice(0,64));return t?t[1]:void 0}function Wl(n){let e=Lb.exec(n);return e&&e[2]?e[2]:void 0}function zl(n){try{return JSON.parse(n)}catch{return}}var Ul,Lb,jl=E(()=>{"use strict";Ul=/\b(query|mutation|subscription)\b/,Lb=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function gi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function bi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var bE,Kl=E(()=>{"use strict";q();bE=64*1024});var Gl={};_(Gl,{enrichHttpCapture:()=>Ob,graphqlResponseHasErrors:()=>Xn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function Ob(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(mi(n.url,n.reqBody)){let a=(s=hi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Xn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&gi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:bi(n.reqBody,a.bodyMaxBytes)}),gi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:bi(c,a.bodyMaxBytes)})}}catch{}}}var Yl=E(()=>{"use strict";jl();Kl()});function pd(n){if(er.size)for(let e of er)try{e(n)}catch{}}function fd(n){return er.add(n),()=>{er.delete(n)}}var er,ki=E(()=>{"use strict";er=new Set});var nr,rr,sr=E(()=>{"use strict";nr={startChild:()=>nr,finish(){},setData(){}},rr={startSpan:()=>nr,finish(){}}});function wd(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 Ct(){return wd(16)}function je(){return wd(8)}function xd(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Sd(n){var t,r,s;let e=Vb.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 Vb,ir=E(()=>{"use strict";Vb=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var or,kd=E(()=>{"use strict";ir();sr();or=class{constructor(e,t){this.name=e;this.traceId=Ct();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++,nr;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 Ed(n,e){let t=Ct(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ii(a),endMs:Ii(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:Ii(n.loadEventEnd||n.duration),spans:s}}var Ii,Id=E(()=>{"use strict";ir();Ii=n=>Math.round(n)});var Cd={};_(Cd,{Transaction:()=>or,buildPageload:()=>Ed,formatTraceparent:()=>xd,newSpanId:()=>je,newTraceId:()=>Ct,parseTraceparent:()=>Sd});var Ad=E(()=>{"use strict";kd();ir();Id()});var _d={};_(_d,{createBugReportWidget:()=>cy});function oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function ay(n){return`[data-scalebun-bugreport]{position:fixed;${oy(n)}z-index:${iy};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-panel{display:none;width:300px;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}`}function cy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,ay(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>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalebun/web",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "The ScaleBun web SDK — unified-session observability for the browser (errors, network, performance, replay, sessions). Framework-agnostic core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|