@scalebun/web 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";(()=>{var pg=Object.defineProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)pg(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 Za(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Qa);if(n)return n;let e=`web_${H()}`;return localStorage.setItem(Qa,e),e}}catch{}return`web_${H()}`}var Qa,ec=k(()=>{"use strict";Qa="scalebun_device_id"});function tc(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Ns,...e)}}var Ns,Bs=k(()=>{"use strict";Ns="[scalebun]"});var nc=k(()=>{"use strict"});var rc=k(()=>{"use strict"});function sc(){return{platform:"web",renderer:"dom",sdk:{name:mg,version:Fs}}}function ic(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=hg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function oc(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function ac(){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 hg(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 mg,Fs,cc=k(()=>{"use strict";rc();mg="@scalebun/web",Fs="1.4.0"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function vg(n){return n.replace(bg,"[email]").replace(yg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return vg(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]=gg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var gg,bg,yg,Ds=k(()=>{"use strict";gg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,bg=/[\w.+-]+@[\w-]+\.[\w.-]+/g,yg=/\b\d[\d -]{11,18}\d\b/g});function lc(n){try{let e=dc()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function wg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function xg(){let n=typeof document!="undefined";return{dom:n,storage:lc("localStorage"),session:lc("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:wg(),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 Sg(){return qs===null&&(qs=xg()),qs}function gt(n){return Sg()[n]}var dc,ht,qs,Hs=k(()=>{"use strict";dc=()=>globalThis,ht=n=>typeof dc()[n]!="undefined";qs=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 $s=k(()=>{"use strict";Hs()});var vn,uc=k(()=>{"use strict";vn=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>pc?n.slice(0,pc):n}function Ig(n){return n.replace(/[?#].*$/,"")}function Cg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function fc(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 Ag(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:Cg(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} ${Ig(n.url)}`)),data:fc({status:r,duration:n.duration})}}case"event":return Rg(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 Rg(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:fc({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function mc(n){Us=n}function hc(n){if(!Us)return n;try{return Us(n)}catch{return n}}function gc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=hc(e);t&&We.add(t)}function bc(n){let e=Ag(n);if(!e)return;let t=hc(e);t&&We.add(t)}function yc(){We.clear()}var kg,Eg,pc,zs,We,Us,vc=k(()=>{"use strict";Ds();kg=50,Eg=200,pc=256;zs=class{constructor(){this.ring=[];this.max=kg}setMax(e){this.max=Math.max(1,Math.min(Eg,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 zs});function wc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(wn=n.seq),n.frameType==="keyframe"&&n.frameId&&(xn=n.frameId))}function ne(){return wn!=null||xn!=null?{seq:wn,segmentId:xn}:void 0}function xc(){wn=void 0,xn=void 0}var wn,xn,Sc=k(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(zt={...zt,...n})}function yt(){return zt}function kc(){let n=zt.deviceId;zt=n!=null?{deviceId:n}:{}}var zt,Ec=k(()=>{"use strict";zt={}});function Tg(){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 Ws(){return Vs===null&&(Vs=Tg()),Vs}function Mg(){return Ws()==="browser"}function Ic(){return!Mg()}var Vs,Cc=k(()=>{"use strict";Vs=null});function Sn(n){n&&(js=n)}function vt(n){if(js)try{n.nonce=js}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 js,Ac=k(()=>{"use strict";js=null});var $=k(()=>{"use strict";ec();Bs();nc();cc();Ds();$s();uc();vc();Sc();Ec();Cc();Hs();Ac()});function kn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Gs);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(Gs,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function Rc(n=Vt,e=Xs){let t=P(),r=kn();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 Tc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Gs)===null){it.lastSeenAt=n,wt(it),Ks=n;return}}catch{}if(n-Ks<6e4)return;Ks=n;let e=kn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Ys(n=1){let e=kn();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 Mc(n){let e=kn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(Ut<n&&(Ut=n),Ut)}var Gs,Vt,Xs,it,Ks,Ut,En=k(()=>{"use strict";$();Gs="scalebun_session",Vt=30*60*1e3,Xs=4*60*60*1e3;it=null,Ks=0,Ut=0});var Qs={};L(Qs,{SDK_SIGNING_VERSION:()=>Pc,signBody:()=>Lc,signatureHeaders:()=>_g});function Pg(n,e){let t=Js.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Js.delete(e)),Js.set(e,t)),t}function Lg(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Lc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Pg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Lg(new Uint8Array(i))}catch{return null}}async function _g(n,e){let t=await Lc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Pc}:{}}var Pc,Js,Zs=k(()=>{"use strict";Pc="1",Js=new Map});var _c={};L(_c,{gzipString:()=>Og});async function Og(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 Oc=k(()=>{"use strict"});function Fg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Ng,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 Ng,xt,Bg,Be,Wt=k(()=>{"use strict";Ng="scalebun",xt="queue",Bg="pending";Be=class{constructor(e=Bg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Fg()),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 Nc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Dg,qg,St,Rn=k(()=>{"use strict";Dg=1e3,qg=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(qg,Dg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function Tn(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:Hg(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 Hg,Mn=k(()=>{"use strict";Hg=n=>JSON.stringify(n).length+1});function ei(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var _n,ti=k(()=>{"use strict";_n=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:ei(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 ni(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 ri(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ri(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 $c(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var Bn=k(()=>{"use strict"});var Xc={};L(Xc,{anchorOf:()=>Gc,fieldKeyOf:()=>jc,fieldLabelOf:()=>Kc,formIdOf:()=>Fn,installFormAnalytics:()=>ib,isSensitiveField:()=>Vc,isTrackableField:()=>Wc,stepOf:()=>jt});function Vc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Jg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return Qg.test(t)}function Wc(n){if(!n||typeof n.matches!="function"||!n.matches(eb))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Zg.has(e)?!1:!Vc(n)}function jc(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 Kc(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>zc?`${t.slice(0,zc-1)}\u2026`:t}function rb(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 Fn(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_${rb(`${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 Gc(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 sb(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 ib(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>=nb?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Fn(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,tb).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(!Wc(h))return null;let g=h.form;if(!g||Uc(g)||Uc(h))return null;let x=r(g);return x?{form:g,el:h,key:jc(h,g),st:x}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:x}=h,v=g.fields.get(x);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Kc(h.el)},g.fields.set(x,v)),v.focusedAt=at(),g.lastField=x},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 x;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:Fn(h.form),field_key:h.key,error_type:sb(h.el),step:jt(h.form),...(x=Gc(h.el))!=null?x:{}}})},d=(m,h)=>{var g;for(let x of h.fields.values())x.focusedAt!=null&&(x.ms+=at()-x.focusedAt,x.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Fn(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 Jg,Qg,Zg,eb,tb,nb,zc,Uc,at,Yc=k(()=>{"use strict";$();Jg=new Set(["password","hidden"]),Qg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Zg=new Set(["submit","button","reset","image"]),eb="input, select, textarea",tb=30,nb=20;zc=60;Uc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Jc={};L(Jc,{installScrollTracker:()=>ob});function ob(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>ab(),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:$c(d),scrollable:ri(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 ab(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Qc=k(()=>{"use strict";Bn()});var el={};L(el,{ATTENTION_BANDS:()=>cb,bandFractions:()=>Zc,installAttentionTracker:()=>lb});function Zc(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 lb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>db(),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,x=Zc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=x[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 db(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var cb,ct,tl=k(()=>{"use strict";cb=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var il={};L(il,{describeElement:()=>qn,installAutocapture:()=>yb});function mb(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 qn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:mb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?sl(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 hb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(nl))return t;return n&&typeof n.closest=="function"?n.closest(nl):null}function gb(n){return fb.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function bb(n){try{return new URL(n,location.href)}catch{return null}}function rl(){try{return location.pathname}catch{return""}}function yb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Yc(),Xc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Qc(),Jc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(tl(),el)).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=hb(A,O),D=z!=null?z:A&&gb(A)?A:null;if(!D||Dn(D))return;let te={...qn(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=bb(J);if(!Q)return;D.hasAttribute("download")||pb.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(ub)||Dn(A))return;let O={...qn(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?sl(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"||Dn(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=rl(),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())},x=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=Et(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(x(),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()},E=new WeakSet,w;typeof IntersectionObserver!="undefined"&&(w=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!E.has(O)&&(E.add(O),w.unobserve(O),Dn(O)||n.onEvent({name:"$impression",props:{...qn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!w||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{E.has(R)||w.observe(R)})}catch{}},S=()=>{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=rl(),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",x),window.addEventListener("popstate",S);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),S()},history.replaceState=function(...R){M.apply(this,R),S()},S(),()=>{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",x),window.removeEventListener("popstate",S),w==null||w.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var nl,ub,pb,fb,sl,Dn,ol=k(()=>{"use strict";Bn();nl='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',ub='select, input[type="checkbox"], input[type="radio"]',pb=/\.(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,fb=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),sl=n=>n.replace(/\S/g,"*");Dn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function pi(n){return n.replace(/[?#].*$/,"").trim()}function Bb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function Al(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:pi((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:pi((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:pi(n)}}function Rl(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=Bb(e.file),t}function Fb(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=Al(r);return o?Rl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=Al(e.slice(t+1));if(s&&s.file)return Rl(r,s)}return null}function Tl(n){var r;if(!n)return[];let e=[],t=n.split(`
2
- `);for(let s=0;s<t.length&&e.length<50;s++){let i=Fb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var Ml=k(()=>{"use strict"});function qb(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function Hb(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>"}@${qb(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=Db))break}return r.join(">")}function $b(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 Pl(n,e,t){let r=Hb(e),s=r?`${n}|${r}`:`${n}|${$b(t)}`;return Ee(s).toString(36)}var Db,Ll=k(()=>{"use strict";Fe();Db=5});function _l(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 Ol=k(()=>{"use strict"});var Nl={};L(Nl,{computeFingerprint:()=>Pl,extractCauses:()=>_l,parseStack:()=>Tl});var Bl=k(()=>{"use strict";Ml();Ll();Ol()});function Gl(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 mi(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+=Gl(y),g(y)},a.addEventListener("message",v=>{d++,f+=Gl(v.data)}),a.addEventListener("error",()=>{m=!0});let x=(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=>x(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 Xl=k(()=>{"use strict"});function hi(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 Yl=k(()=>{"use strict"});function cy(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 gi(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:cy(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Jl=k(()=>{"use strict"});var Ql={};L(Ql,{installBeacon:()=>gi,installEventSource:()=>hi,installStreams:()=>ly,installWebSocket:()=>mi});function ly(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(mi(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(hi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(gi(e,t,r)),i}var Zl=k(()=>{"use strict";Xl();Yl();Jl()});function bi(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 yi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=td(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?ed(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=td(e);return t&&("query"in t||"operationName"in t)?ed(t):void 0}if(nd.test(e))return uy(e)}function Zn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Zn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function ed(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=rd(r);if(s&&(e.operationType=s),!e.operationName){let i=sd(r);i&&(e.operationName=i)}}return e}function uy(n){let e={},t=rd(n);t&&(e.operationType=t);let r=sd(n);return r&&(e.operationName=r),e}function rd(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=nd.exec(e.slice(0,64));return t?t[1]:void 0}function sd(n){let e=dy.exec(n);return e&&e[2]?e[2]:void 0}function td(n){try{return JSON.parse(n)}catch{return}}var nd,dy,id=k(()=>{"use strict";nd=/\b(query|mutation|subscription)\b/,dy=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function vi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function wi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var uI,od=k(()=>{"use strict";$();uI=64*1024});var ad={};L(ad,{enrichHttpCapture:()=>py,graphqlResponseHasErrors:()=>Zn,looksLikeGraphql:()=>bi,parseGraphqlRequest:()=>yi});async function py(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(bi(n.url,n.reqBody)){let a=(s=yi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Zn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&vi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:wi(n.reqBody,a.bodyMaxBytes)}),vi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:wi(c,a.bodyMaxBytes)})}}catch{}}}var cd=k(()=>{"use strict";id();od()});function Id(n){if(rr.size)for(let e of rr)try{e(n)}catch{}}function Cd(n){return rr.add(n),()=>{rr.delete(n)}}var rr,Ci=k(()=>{"use strict";rr=new Set});var ir,or,ar=k(()=>{"use strict";ir={startChild:()=>ir,finish(){},setData(){}},or={startSpan:()=>ir,finish(){}}});function _d(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 _d(16)}function je(){return _d(8)}function Od(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Nd(n){var t,r,s;let e=Sy.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 Sy,cr=k(()=>{"use strict";Sy=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var lr,Bd=k(()=>{"use strict";cr();ar();lr=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++,ir;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 Fd(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:Ri(a),endMs:Ri(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:Ri(n.loadEventEnd||n.duration),spans:s}}var Ri,Dd=k(()=>{"use strict";cr();Ri=n=>Math.round(n)});var qd={};L(qd,{Transaction:()=>lr,buildPageload:()=>Fd,formatTraceparent:()=>Od,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Nd});var Hd=k(()=>{"use strict";Bd();cr();Dd()});var Gd={};L(Gd,{createBugReportWidget:()=>zy});function Hy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function $y(n){return`[data-scalebun-bugreport]{position:fixed;${Hy(n)}z-index:${qy};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 zy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),e.setAttribute("data-scalebun",""),Ne(document,$y(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=`
1
+ "use strict";(()=>{var mg=Object.defineProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)mg(n,t,{get:e[t],enumerable:!0})};function q(){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 Za(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Qa);if(n)return n;let e=`web_${q()}`;return localStorage.setItem(Qa,e),e}}catch{}return`web_${q()}`}var Qa,ec=k(()=>{"use strict";Qa="scalebun_device_id"});function tc(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Ns,...e)}}var Ns,Bs=k(()=>{"use strict";Ns="[scalebun]"});var nc=k(()=>{"use strict"});var rc=k(()=>{"use strict"});function sc(){return{platform:"web",renderer:"dom",sdk:{name:gg,version:Fs}}}function ic(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=bg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function oc(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function ac(){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 bg(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 gg,Fs,cc=k(()=>{"use strict";rc();gg="@scalebun/web",Fs="1.5.0"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function xg(n){return n.replace(vg,"[email]").replace(wg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return xg(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]=yg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var yg,vg,wg,Ds=k(()=>{"use strict";yg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,vg=/[\w.+-]+@[\w-]+\.[\w.-]+/g,wg=/\b\d[\d -]{11,18}\d\b/g});function lc(n){try{let e=dc()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function Sg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function kg(){let n=typeof document!="undefined";return{dom:n,storage:lc("localStorage"),session:lc("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:Sg(),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 Eg(){return qs===null&&(qs=kg()),qs}function gt(n){return Eg()[n]}var dc,ht,qs,Hs=k(()=>{"use strict";dc=()=>globalThis,ht=n=>typeof dc()[n]!="undefined";qs=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 $s=k(()=>{"use strict";Hs()});var vn,uc=k(()=>{"use strict";vn=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>pc?n.slice(0,pc):n}function Ag(n){return n.replace(/[?#].*$/,"")}function Rg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function fc(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 Tg(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:Rg(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} ${Ag(n.url)}`)),data:fc({status:r,duration:n.duration})}}case"event":return Mg(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 Mg(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:fc({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function mc(n){Us=n}function hc(n){if(!Us)return n;try{return Us(n)}catch{return n}}function gc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=hc(e);t&&We.add(t)}function bc(n){let e=Tg(n);if(!e)return;let t=hc(e);t&&We.add(t)}function yc(){We.clear()}var Ig,Cg,pc,zs,We,Us,vc=k(()=>{"use strict";Ds();Ig=50,Cg=200,pc=256;zs=class{constructor(){this.ring=[];this.max=Ig}setMax(e){this.max=Math.max(1,Math.min(Cg,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 zs});function wc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(wn=n.seq),n.frameType==="keyframe"&&n.frameId&&(xn=n.frameId))}function Z(){return wn!=null||xn!=null?{seq:wn,segmentId:xn}:void 0}function xc(){wn=void 0,xn=void 0}var wn,xn,Sc=k(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(zt={...zt,...n})}function yt(){return zt}function kc(){let n=zt.deviceId;zt=n!=null?{deviceId:n}:{}}var zt,Ec=k(()=>{"use strict";zt={}});function Pg(){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 Ws(){return Vs===null&&(Vs=Pg()),Vs}function Lg(){return Ws()==="browser"}function Ic(){return!Lg()}var Vs,Cc=k(()=>{"use strict";Vs=null});function Sn(n){n&&(js=n)}function vt(n){if(js)try{n.nonce=js}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 js,Ac=k(()=>{"use strict";js=null});var $=k(()=>{"use strict";ec();Bs();nc();cc();Ds();$s();uc();vc();Sc();Ec();Cc();Hs();Ac()});function kn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Gs);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(Gs,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function Rc(n=Vt,e=Xs){let t=P(),r=kn();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_${q()}`,startedAt:t,lastSeenAt:t,seq:0};return wt(s),it=s,s}function Tc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Gs)===null){it.lastSeenAt=n,wt(it),Ks=n;return}}catch{}if(n-Ks<6e4)return;Ks=n;let e=kn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Ys(n=1){let e=kn();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 Mc(n){let e=kn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(Ut<n&&(Ut=n),Ut)}var Gs,Vt,Xs,it,Ks,Ut,En=k(()=>{"use strict";$();Gs="scalebun_session",Vt=30*60*1e3,Xs=4*60*60*1e3;it=null,Ks=0,Ut=0});var Qs={};L(Qs,{SDK_SIGNING_VERSION:()=>Pc,signBody:()=>Lc,signatureHeaders:()=>Ng});function _g(n,e){let t=Js.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Js.delete(e)),Js.set(e,t)),t}function Og(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Lc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await _g(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Og(new Uint8Array(i))}catch{return null}}async function Ng(n,e){let t=await Lc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Pc}:{}}var Pc,Js,Zs=k(()=>{"use strict";Pc="1",Js=new Map});var _c={};L(_c,{gzipString:()=>Bg});async function Bg(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 Oc=k(()=>{"use strict"});function qg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Fg,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 Fg,xt,Dg,Be,Wt=k(()=>{"use strict";Fg="scalebun",xt="queue",Dg="pending";Be=class{constructor(e=Dg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=qg()),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 Nc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Hg,$g,St,Rn=k(()=>{"use strict";Hg=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,Hg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function Tn(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:zg(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 zg,Mn=k(()=>{"use strict";zg=n=>JSON.stringify(n).length+1});function ei(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var _n,ti=k(()=>{"use strict";_n=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:ei(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 ni(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 ri(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ri(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 $c(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var Bn=k(()=>{"use strict"});var Xc={};L(Xc,{anchorOf:()=>Gc,fieldKeyOf:()=>jc,fieldLabelOf:()=>Kc,formIdOf:()=>Fn,installFormAnalytics:()=>ab,isSensitiveField:()=>Vc,isTrackableField:()=>Wc,stepOf:()=>jt});function Vc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Zg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return eb.test(t)}function Wc(n){if(!n||typeof n.matches!="function"||!n.matches(nb))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return tb.has(e)?!1:!Vc(n)}function jc(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 Kc(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>zc?`${t.slice(0,zc-1)}\u2026`:t}function ib(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 Fn(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_${ib(`${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 Gc(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 ob(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 ab(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>=sb?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Fn(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,rb).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(!Wc(h))return null;let g=h.form;if(!g||Uc(g)||Uc(h))return null;let x=r(g);return x?{form:g,el:h,key:jc(h,g),st:x}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:x}=h,v=g.fields.get(x);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Kc(h.el)},g.fields.set(x,v)),v.focusedAt=at(),g.lastField=x},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 x;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:Fn(h.form),field_key:h.key,error_type:ob(h.el),step:jt(h.form),...(x=Gc(h.el))!=null?x:{}}})},d=(m,h)=>{var g;for(let x of h.fields.values())x.focusedAt!=null&&(x.ms+=at()-x.focusedAt,x.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Fn(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 Zg,eb,tb,nb,rb,sb,zc,Uc,at,Yc=k(()=>{"use strict";$();Zg=new Set(["password","hidden"]),eb=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,tb=new Set(["submit","button","reset","image"]),nb="input, select, textarea",rb=30,sb=20;zc=60;Uc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Jc={};L(Jc,{installScrollTracker:()=>cb});function cb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>lb(),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:$c(d),scrollable:ri(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 lb(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Qc=k(()=>{"use strict";Bn()});var el={};L(el,{ATTENTION_BANDS:()=>db,bandFractions:()=>Zc,installAttentionTracker:()=>ub});function Zc(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 ub(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>pb(),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,x=Zc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=x[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 pb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var db,ct,tl=k(()=>{"use strict";db=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var il={};L(il,{describeElement:()=>qn,installAutocapture:()=>wb});function gb(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 qn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:gb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?sl(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 bb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(nl))return t;return n&&typeof n.closest=="function"?n.closest(nl):null}function yb(n){return hb.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function vb(n){try{return new URL(n,location.href)}catch{return null}}function rl(){try{return location.pathname}catch{return""}}function wb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Yc(),Xc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Qc(),Jc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(tl(),el)).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=bb(A,O),D=z!=null?z:A&&yb(A)?A:null;if(!D||Dn(D))return;let ne={...qn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:ne});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=vb(J);if(!Q)return;D.hasAttribute("download")||mb.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(fb)||Dn(A))return;let O={...qn(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?sl(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"||Dn(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=rl(),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())},x=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=Et(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(x(),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()},E=new WeakSet,w;typeof IntersectionObserver!="undefined"&&(w=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!E.has(O)&&(E.add(O),w.unobserve(O),Dn(O)||n.onEvent({name:"$impression",props:{...qn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!w||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{E.has(R)||w.observe(R)})}catch{}},S=()=>{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=rl(),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",x),window.addEventListener("popstate",S);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),S()},history.replaceState=function(...R){M.apply(this,R),S()},S(),()=>{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",x),window.removeEventListener("popstate",S),w==null||w.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var nl,fb,mb,hb,sl,Dn,ol=k(()=>{"use strict";Bn();nl='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',fb='select, input[type="checkbox"], input[type="radio"]',mb=/\.(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,hb=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),sl=n=>n.replace(/\S/g,"*");Dn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function pi(n){return n.replace(/[?#].*$/,"").trim()}function Db(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function Al(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:pi((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:pi((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:pi(n)}}function Rl(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=Db(e.file),t}function qb(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=Al(r);return o?Rl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=Al(e.slice(t+1));if(s&&s.file)return Rl(r,s)}return null}function Tl(n){var r;if(!n)return[];let e=[],t=n.split(`
2
+ `);for(let s=0;s<t.length&&e.length<50;s++){let i=qb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var Ml=k(()=>{"use strict"});function $b(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function zb(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>=Hb))break}return r.join(">")}function Ub(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 Pl(n,e,t){let r=zb(e),s=r?`${n}|${r}`:`${n}|${Ub(t)}`;return Ee(s).toString(36)}var Hb,Ll=k(()=>{"use strict";Fe();Hb=5});function _l(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 Ol=k(()=>{"use strict"});var Nl={};L(Nl,{computeFingerprint:()=>Pl,extractCauses:()=>_l,parseStack:()=>Tl});var Bl=k(()=>{"use strict";Ml();Ll();Ol()});function Gl(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 mi(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+=Gl(y),g(y)},a.addEventListener("message",v=>{d++,f+=Gl(v.data)}),a.addEventListener("error",()=>{m=!0});let x=(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=>x(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 Xl=k(()=>{"use strict"});function hi(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 Yl=k(()=>{"use strict"});function dy(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 gi(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:dy(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Jl=k(()=>{"use strict"});var Ql={};L(Ql,{installBeacon:()=>gi,installEventSource:()=>hi,installStreams:()=>uy,installWebSocket:()=>mi});function uy(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(mi(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(hi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(gi(e,t,r)),i}var Zl=k(()=>{"use strict";Xl();Yl();Jl()});function bi(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 yi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=td(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?ed(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=td(e);return t&&("query"in t||"operationName"in t)?ed(t):void 0}if(nd.test(e))return fy(e)}function Zn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Zn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function ed(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=rd(r);if(s&&(e.operationType=s),!e.operationName){let i=sd(r);i&&(e.operationName=i)}}return e}function fy(n){let e={},t=rd(n);t&&(e.operationType=t);let r=sd(n);return r&&(e.operationName=r),e}function rd(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=nd.exec(e.slice(0,64));return t?t[1]:void 0}function sd(n){let e=py.exec(n);return e&&e[2]?e[2]:void 0}function td(n){try{return JSON.parse(n)}catch{return}}var nd,py,id=k(()=>{"use strict";nd=/\b(query|mutation|subscription)\b/,py=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function vi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function wi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var fI,od=k(()=>{"use strict";$();fI=64*1024});var ad={};L(ad,{enrichHttpCapture:()=>my,graphqlResponseHasErrors:()=>Zn,looksLikeGraphql:()=>bi,parseGraphqlRequest:()=>yi});async function my(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(bi(n.url,n.reqBody)){let a=(s=yi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Zn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&vi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:wi(n.reqBody,a.bodyMaxBytes)}),vi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:wi(c,a.bodyMaxBytes)})}}catch{}}}var cd=k(()=>{"use strict";id();od()});function Id(n){if(rr.size)for(let e of rr)try{e(n)}catch{}}function Cd(n){return rr.add(n),()=>{rr.delete(n)}}var rr,Ci=k(()=>{"use strict";rr=new Set});var ir,or,ar=k(()=>{"use strict";ir={startChild:()=>ir,finish(){},setData(){}},or={startSpan:()=>ir,finish(){}}});function _d(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 _d(16)}function je(){return _d(8)}function Od(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Nd(n){var t,r,s;let e=Ey.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 Ey,cr=k(()=>{"use strict";Ey=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var lr,Bd=k(()=>{"use strict";cr();ar();lr=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++,ir;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 Fd(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:Ri(a),endMs:Ri(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:Ri(n.loadEventEnd||n.duration),spans:s}}var Ri,Dd=k(()=>{"use strict";cr();Ri=n=>Math.round(n)});var qd={};L(qd,{Transaction:()=>lr,buildPageload:()=>Fd,formatTraceparent:()=>Od,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Nd});var Hd=k(()=>{"use strict";Bd();cr();Dd()});var Yd={};L(Yd,{createBugReportWidget:()=>Vy});function zy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function Uy(n){return`[data-scalebun-bugreport]{position:fixed;${zy(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 Vy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),e.setAttribute("data-scalebun",""),Ne(document,Uy(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>
5
5
  <input data-scalebun-email class="sbbr-field sbbr-email" type="email" placeholder="Your email (optional)" />
@@ -7,8 +7,8 @@
7
7
  <div class="sbbr-actions">
8
8
  <button type="button" data-scalebun-cancel class="sbbr-btn sbbr-cancel">Cancel</button>
9
9
  <button type="button" data-scalebun-send class="sbbr-btn sbbr-send">Send</button>
10
- </div>`,e.appendChild(t),e.appendChild(r),document.body.appendChild(e);let s=r.querySelector("[data-scalebun-msg]"),i=r.querySelector("[data-scalebun-email]"),o=r.querySelector("[data-scalebun-status]"),a=r.querySelector("[data-scalebun-send]"),c=r.querySelector("[data-scalebun-cancel]"),l=!1,u=m=>{l=m,r.classList.toggle("sbbr-open",m),e.classList.toggle("sbbr-expanded",m),m&&s.focus()},d=()=>u(!l),p=()=>u(!1),f=async()=>{let m=s.value.trim();if(!m){o.textContent="Please describe the bug.";return}a.disabled=!0,o.textContent="Sending\u2026";let h=null,g;try{let x=await n.onSubmit({message:m,email:i.value.trim()||void 0});x&&typeof x=="object"?g=x.e:h=x!=null?x:null}catch{h=null,g="send"}a.disabled=!1,h?(o.textContent="Thanks \u2014 your report was sent.",s.value="",i.value="",setTimeout(()=>{l&&u(!1),o.textContent=""},1500)):o.textContent=g?Kd[g]:Kd.send};return t.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",f),{destroy:()=>{t.removeEventListener("click",d),c.removeEventListener("click",p),a.removeEventListener("click",f),e.remove()}}}var Kd,qy,Xd=k(()=>{"use strict";$();Kd={init:"Reporting isn\u2019t ready yet. Reload the page and try again.",off:"Bug reporting is turned off for this site.",empty:"Please describe the bug.",consent:"Reporting is paused until you accept the privacy notice on this page.",send:"Couldn\u2019t reach the server. Check your connection and try again."},qy=2147483e3});var ou={};L(ou,{normalizeConfig:()=>Bi});function nu(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Ie(e.cooldownHours),maxImpressions:Ie(e.maxImpressions),maxImpressionsPerSession:Ie(e.maxImpressionsPerSession),samplePct:Ie(e.samplePct)});return Object.keys(t).length?t:void 0}function ru(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Ie(e.seconds),sessions:Ie(e.sessions),slowMs:Ie(e.slowMs),screen:U(e.screen),delaySeconds:Ie(e.delaySeconds)});return Object.keys(t).length?t:void 0}function su(n){let e=_e(n),t=Ke({platforms:Ni(e.platforms),minAppVersion:U(e.minAppVersion),segments:Ni(e.segments),userProps:e.userProps&&typeof e.userProps=="object"&&!Array.isArray(e.userProps)?e.userProps:void 0});return Object.keys(t).length?t:void 0}function Xy(n){var t;let e=[];for(let r of Oi(n)){let s=_e(r),i=U(s.key),o=U(s.kind);!i||!o||!Gy.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Ni(s.choices),scaleMax:Ie(s.scaleMax),required:typeof s.required=="boolean"?s.required:void 0,pageBreakBefore:s.pageBreakBefore===!0?!0:void 0}))}return e.length?e:void 0}function Yy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!Ky.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function iu(n){let e=_e(n),t=U(e.body);if(!t)return null;let r=_e(e.secondaryCta),s=e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,i=e.ext&&typeof e.ext=="object"&&!Array.isArray(e.ext)?e.ext:void 0;return Ke({title:U(e.title),body:t,imageUrl:U(e.imageUrl),cta:Yy(e.cta),secondaryCta:U(r.label)?{label:U(r.label),action:"dismiss"}:void 0,dark:dt(e.dark),rtl:dt(e.rtl),coupon:U(e.coupon),style:s,ext:i})}function Jy(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=iu(e.variantB);return Ke({enabled:dt(e.enabled),split:Ie(e.split),variantB:t!=null?t:void 0})}function Qy(n){var s,i,o;let e=_e(n),t=U(e.id),r=U(e.type);return!t||!r?null:Ke({id:t,type:r,name:(s=U(e.name))!=null?s:t,question:(i=U(e.question))!=null?i:"",questions:Xy(e.questions),scale:Ie(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:ru(e.triggerConfig),targeting:su(e.targeting),throttle:nu(e.throttle),enabled:(o=dt(e.enabled))!=null?o:!0,revision:U(e.revision),style:e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,startScreen:U(e.startScreen),thankYouScreen:U(e.thankYouScreen)})}function Zy(n){let e=_e(n),t=U(e.id),r=iu(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&jy.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Ie(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:ru(e.triggerConfig),targeting:su(e.targeting),throttle:nu(e.throttle),spec:r,revision:U(e.revision),experiment:Jy(e.experiment),variantId:U(e.variantId),variantKey:U(e.variantKey),preview:dt(e.preview),previewId:U(e.previewId),isTest:dt(e.isTest),testRunId:U(e.testRunId),createdAt:U(e.createdAt)})}function Bi(n){var t,r;let e=_e(n);return{configVersion:(t=Ie(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Oi(e.campaigns).map(Qy).filter(s=>s!==null),inAppMessages:Oi(e.inAppMessages).map(Zy).filter(s=>s!==null)}}var _e,Oi,U,Ie,dt,Ni,Ke,jy,Ky,Gy,Fi=k(()=>{"use strict";_e=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Oi=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Ie=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,Ni=n=>{if(!Array.isArray(n))return;let e=n.filter(t=>typeof t=="string");return e.length?e:void 0},Ke=n=>{for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n},jy=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],Ky=new Set(["dismiss","link","custom"]),Gy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var ev,tn,au=k(()=>{"use strict";ev={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},tn=class{constructor(e){this.fire=e;this.items=[];this.timers=new Set;this.currentScreen=""}setItems(e){this.items=e,this.scheduleTimers()}onScreenView(e,t=0){let r=this.currentScreen;if(r&&r!==e)for(let s of this.items)s.trigger==="screen_exit"&&this.candidate(s,r,t);this.currentScreen=e;for(let s of this.items)s.trigger==="screen_view"&&this.candidate(s,e,t)}onSignal(e,t=0){let r=ev[e];if(r)for(let s of this.items)s.trigger&&r.includes(s.trigger)&&this.candidate(s,this.currentScreen,t)}onCustomEvent(e,t=0){var r,s,i;for(let o of this.items)o.trigger==="custom_event"&&((s=(r=o.triggerConfig)==null?void 0:r.event)!=null?s:e)===e?this.candidate(o,this.currentScreen,t):o.trigger==="after_purchase"&&e==="purchase"?this.candidate(o,this.currentScreen,t):o.trigger==="failed_action"&&(((i=o.triggerConfig)==null?void 0:i.action)===e||e==="failed_action")&&this.candidate(o,this.currentScreen,t)}onLifecycle(e,t,r=0){var s;for(let i of this.items)if(i.trigger===e){if(e==="n_sessions"){let o=(s=i.triggerConfig)==null?void 0:s.sessions;if(typeof o=="number"&&o!==t)continue}this.candidate(i,this.currentScreen,r)}}candidate(e,t,r=0){var o,a,c;if(e.targetScreen&&t&&e.targetScreen!==t)return;let s=(c=(a=(o=e.triggerConfig)==null?void 0:o.delaySeconds)!=null?a:e.delaySeconds)!=null?c:0,i=Math.max(0,s-r/1e3);if(i>0){let l=setTimeout(()=>{this.timers.delete(l),this.fire(e)},i*1e3);this.timers.add(l)}else this.fire(e)}scheduleTimers(){var e;for(let t of this.items){let r=(e=t.triggerConfig)==null?void 0:e.seconds;if(t.trigger==="time_in_app"&&typeof r=="number"&&r>0){let s=setTimeout(()=>{this.timers.delete(s),this.candidate(t,this.currentScreen)},r*1e3);this.timers.add(s)}}}stop(){for(let e of this.timers)clearTimeout(e);this.timers.clear()}}});var mu={};L(mu,{clearEngageState:()=>sv,hasTestSeen:()=>$i,markTestSeen:()=>zi,passesThrottle:()=>Ar,readState:()=>Di,recordCompleted:()=>Tr,recordShown:()=>Rr});function nn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Di(n){let e=nn();if(!e)return{...Ir};try{let t=e.getItem(lu(n));if(!t)return{...Ir};let r=JSON.parse(t);return{impressions:typeof r.impressions=="number"?r.impressions:0,lastShownAt:typeof r.lastShownAt=="number"?r.lastShownAt:0,completed:r.completed===!0,revision:typeof r.revision=="string"?r.revision:void 0}}catch{return{...Ir}}}function du(n,e){let t=nn();if(t)try{t.setItem(lu(n),JSON.stringify(e))}catch{}}function uu(n){let e=Di(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...Ir,revision:n.revision}:e}function Hi(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function pu(n){let e=Hi();if(!e)return{sid:n,counts:{}};try{let t=e.getItem(qi);if(!t)return{sid:n,counts:{}};let r=JSON.parse(t);return r.sid!==n||!r.counts||typeof r.counts!="object"?{sid:n,counts:{}}:{sid:n,counts:r.counts}}catch{return{sid:n,counts:{}}}}function nv(n){let e=Hi();if(e)try{e.setItem(qi,JSON.stringify(n))}catch{}}function fu(n,e){let t=pu(e).counts[n.id];return!t||n.revision&&t.rev&&t.rev!==n.revision?0:typeof t.n=="number"?t.n:0}function Ar(n,e,t=""){var o;let r=n.throttle,s=uu(n);if(s.completed)return!1;let i=(o=r==null?void 0:r.maxImpressionsPerSession)!=null?o:r?0:tv;return i>0&&fu(n,t)>=i?!1:r?!(r.showOnce&&s.impressions>0||typeof r.maxImpressions=="number"&&s.impressions>=r.maxImpressions||typeof r.cooldownHours=="number"&&e-s.lastShownAt<r.cooldownHours*36e5):!0}function Rr(n,e,t=""){let r=uu(n);du(n.id,{impressions:r.impressions+1,lastShownAt:e,completed:r.completed,revision:n.revision});let s=pu(t);s.counts[n.id]={n:fu(n,t)+1,rev:n.revision},nv(s)}function Tr(n){var t;let e=Di(n.id);du(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function $i(n){var t;let e=nn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(Cr))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function zi(n){var t;let e=nn();if(e)try{let r=JSON.parse((t=e.getItem(Cr))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>rv;)r.shift();e.setItem(Cr,JSON.stringify(r))}catch{}}function sv(){var e;let n=nn();if(n)try{let t=[];for(let r=0;r<n.length;r++){let s=n.key(r);s&&(s.startsWith(cu)||s==="scalebun_engage_sessions"||s===Cr)&&t.push(s)}for(let r of t)n.removeItem(r);(e=Hi())==null||e.removeItem(qi)}catch{}}var cu,lu,Ir,tv,qi,Cr,rv,Ui=k(()=>{"use strict";cu="scalebun_engage_throttle:";lu=n=>`${cu}${n}`,Ir={impressions:0,lastShownAt:0,completed:!1};tv=1,qi="scalebun_engage_session_shows";Cr="scalebun_engage_test_seen",rv=50});function yu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:bu.test(e)||lv.test(e)||dv.test(e)||uv.has(e.toLowerCase())}function Vi(n,e={}){let t={};if(!n||typeof n!="object"||Array.isArray(n))return t;let r=n;for(let s of Object.keys(r)){if(!gu.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}yu(r[s])&&(t[s]=r[s].trim())}return t}function pv(n){let e=fv(n);if(!e)return null;let t=r=>{let s=r/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*t(e[0])+.7152*t(e[1])+.0722*t(e[2])}function fv(n){let e=n.trim();if(bu.test(e)){let r=e.slice(1);return(r.length===3||r.length===4)&&(r=r.slice(0,3).split("").map(s=>s+s).join("")),r.length>=6?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]:null}let t=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})/i.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Wi(n,e){if(e&&yu(e))return e;let t=pv(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function yv(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(hu)){let s=t[r];typeof s=="string"&&hu[r].includes(s)&&(e[r]=s)}return e}function vu(n,e={}){var u,d;let t=e.dark?ov:iv,r=e.dark?cv:av,s=Vi(n),i={};for(let p of gu)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=Wi(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...mv,...yv(n)},c=hv[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=gv[a.radius],i.maxWidth=bv[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var gu,iv,ov,av,cv,bu,lv,dv,uv,hu,mv,hv,gv,bv,ji=k(()=>{"use strict";gu=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],iv={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},ov={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},av={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},cv={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},bu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,lv=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,dv=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,uv=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);hu={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},mv={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},hv={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},gv={sharp:"4px",soft:"16px",round:"26px"},bv={narrow:"340px",standard:"420px",wide:"540px"}});var wu=k(()=>{"use strict"});var Xi={};L(Xi,{CssomRecorder:()=>Gi,adoptedSheetId:()=>Mr});function Mr(n){let e=xu.get(n);return e==null&&(e=vv++,xu.set(n,e)),e}function Su(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var xu,vv,Ki,Gi,Pr=k(()=>{"use strict";xu=new WeakMap,vv=1;Ki="__scalebun_cssom_patched__",Gi=class{constructor(e,t){this.reg=e;this.onMutations=t;this.installed=!1;this.pending=[];this.scheduled=!1}install(){if(typeof CSSStyleSheet=="undefined")return;let e=CSSStyleSheet.prototype;if(e[Ki])return;let t=this;this.origInsert=e.insertRule,e.insertRule=function(r,s){let i=t.origInsert.call(this,r,s),o=t.ref(this);return o&&t.record({op:"sheet",sheet:o,action:"insert",rule:r,index:i}),i},this.origDelete=e.deleteRule,e.deleteRule=function(r){t.origDelete.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"delete",index:r})},typeof e.replaceSync=="function"&&(this.origReplaceSync=e.replaceSync,e.replaceSync=function(r){t.origReplaceSync.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"replace",rules:Su(this)})}),typeof e.replace=="function"&&(this.origReplace=e.replace,e.replace=function(r){let s=t.origReplace.call(this,r);return Promise.resolve(s).then(()=>{let i=t.ref(this);i&&t.record({op:"sheet",sheet:i,action:"replace",rules:Su(this)})}),s}),e[Ki]=!0,this.installed=!0}disconnect(){if(!this.installed)return;let e=CSSStyleSheet.prototype;this.origInsert&&(e.insertRule=this.origInsert),this.origDelete&&(e.deleteRule=this.origDelete),this.origReplaceSync&&(e.replaceSync=this.origReplaceSync),this.origReplace&&(e.replace=this.origReplace),delete e[Ki],this.installed=!1,this.pending=[]}ref(e){let t=e.ownerNode;if(t){let r=this.reg.getId(t);return r!=null?{node:r}:null}return{adopted:Mr(e)}}record(e){this.pending.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){if(this.scheduled=!1,!this.pending.length)return;let e=this.pending;this.pending=[],this.onMutations(e)}}});var Dr={};L(Dr,{MAX_INLINED_CSS_BYTES:()=>ku,NO_MASK_TEXT_PARENTS:()=>_r,SENSITIVE_ATTRS:()=>Or,UNRESOLVED_SHEET_ATTR:()=>Eu,absUrl:()=>qe,absolutizeAttrValue:()=>Fr,absolutizeCssUrls:()=>rn,absolutizeSrcset:()=>Au,isMaskedSubtree:()=>Nr,isPasswordField:()=>Rt,maskSecret:()=>Tt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Xe,serializeShadow:()=>Br,takeSnapshot:()=>kv});function Sv(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${Yi},${e.join(",")}`:Yi;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return Yi}}function Nr(n,e){if(!n||!e)return!1;try{return!!n.closest(e)}catch{return!1}}function Ze(n={}){var e,t;return{maskAllText:(e=n.maskAllText)!=null?e:!0,maskAllInputs:(t=n.maskAllInputs)!=null?t:!0,maskSel:Sv(n.maskSelectors),cssBudget:{used:0}}}function kv(n,e,t={}){var r;return(r=Xe(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Xe(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Lr(n,e,t)},a=Cu(n,n.baseURI);return a.length&&(o.adoptedStyles=a),o}case 10:{let i=n;return{t:"dt",id:e.add(n),name:i.name,publicId:i.publicId,systemId:i.systemId}}case 1:{let i=n;if(Ev(i))return Cv(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===wv?"svg":i.namespaceURI===xv?"math":void 0,l=a==="style"?Av(i,e):Lr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:Iu(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Br(d,e,t)),u}case 3:{let i=(s=(r=n.parentNode)==null?void 0:r.nodeName)!=null?s:"",o=n.data,c=(t.maskAllText||Nr(n.parentElement,t.maskSel))&&!_r.has(i)?Ge(o):o;return{t:"tx",id:e.add(n),value:c}}case 8:return{t:"cm",id:e.add(n),value:n.data};case 4:return{t:"tx",id:e.add(n),value:n.data};default:return null}}function Lr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Xe(s,e,t);i&&r.push(i)}),r}function Ev(n){var t;if(n.tagName.toLowerCase()!=="link")return!1;let e=((t=n.getAttribute("rel"))!=null?t:"").toLowerCase();return e.split(/\s+/).includes("stylesheet")&&!e.includes("alternate")}function Iv(n){var e;try{let t=(e=n.sheet)==null?void 0:e.cssRules;return!t||t.length===0?null:Array.from(t).map(r=>r.cssText).join("")}catch{return null}}function Cv(n,e,t,r){let s=e.add(n),i=Iv(n);if(i&&r.used+i.length<=ku){r.used+=i.length;let a=rn(i,n.ownerDocument.baseURI),c=n.ownerDocument.createTextNode(""),l={},u=n.getAttribute("media");u&&(l.media=u);let d=n.getAttribute("href");return d&&(l["data-scalebun-href"]=qe(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=Iu(n,t);return o[Eu]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function Av(n,e){var s,i,o;let t="";try{let a=(s=n.sheet)==null?void 0:s.cssRules;a&&a.length&&(t=Array.from(a).map(c=>c.cssText).join(""))}catch{}if(t||(t=(i=n.textContent)!=null?i:""),!t)return[];t=rn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function Rt(n){var t,r;let e=(t=n.tagName)==null?void 0:t.toLowerCase();return e!=="input"&&e!=="textarea"?!1:(((r=n.getAttribute)==null?void 0:r.call(n,"type"))||"").toLowerCase()==="password"}function Iu(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Or.has(l.name)?Ge(l.value):l.value;let r=n.tagName.toLowerCase();if(r==="input"||r==="textarea"){let l=(o=(i=n.value)!=null?i:t.value)!=null?o:"";Rt(n)?t.value=Tt(l):t.value=e.maskAllInputs?Ge(l):l}t.loading==="lazy"&&(r==="img"||r==="iframe")&&(t.loading="eager");let s=(c=(a=n.ownerDocument)==null?void 0:a.baseURI)!=null?c:"";for(let l of Tv){let u=t[l];u!=null&&(t[l]=Fr(l,u,r,s))}return t}function Br(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Lr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=Cu(n,i);return o.length&&(s.adoptedStyles=o),s}function Cu(n,e){try{let t=n.adoptedStyleSheets;if(!t||!t.length)return[];let r=[];for(let s of t)try{let i=Array.from(s.cssRules).map(o=>o.cssText).join("");i&&r.push({id:Mr(s),css:rn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Tt(n){return"*".repeat(n.length)}function qe(n,e){let t=n.trim();if(!t||!e||Rv.test(t))return n;try{return new URL(t,e).href}catch{return n}}function rn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${qe(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${qe(i,e)}${s}`),t}function Fr(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return qe(e,r);case"srcset":return Au(e,r);case"style":return rn(e,r);case"href":return t==="link"||t==="use"||t==="image"?qe(e,r):e;case"xlink:href":return t==="use"||t==="image"?qe(e,r):e;case"data":return t==="object"?qe(e,r):e;default:return e}}function Au(n,e){return!n||!e||/data:/i.test(n)?n:n.split(",").map(t=>{let r=t.trim();if(!r)return r;let s=r.search(/\s/);return s===-1?qe(r,e):qe(r.slice(0,s),e)+r.slice(s)}).join(", ")}var _r,Or,wv,xv,Yi,ku,Eu,Rv,Tv,et=k(()=>{"use strict";Pr();_r=new Set(["STYLE","SCRIPT"]),Or=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),wv="http://www.w3.org/2000/svg",xv="http://www.w3.org/1998/Math/MathML",Yi='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';ku=2*1024*1024,Eu="data-scalebun-sheet-unresolved";Rv=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;Tv=["src","srcset","poster","style","href","xlink:href","data"]});var qr={};L(qr,{NodeRegistry:()=>sn});var sn,on=k(()=>{"use strict";sn=class{constructor(e=1){this.idToNode=new Map;this.nodeToId=new WeakMap;this.counter=e}add(e){let t=this.nodeToId.get(e);if(t!=null)return t;let r=this.counter++;return this.nodeToId.set(e,r),this.idToNode.set(r,e),r}set(e,t){this.nodeToId.set(t,e),this.idToNode.set(e,t),e>=this.counter&&(this.counter=e+1)}getId(e){return this.nodeToId.get(e)}getNode(e){return this.idToNode.get(e)}has(e){return this.nodeToId.has(e)}remove(e){let t=this.nodeToId.get(e);t!=null&&(this.nodeToId.delete(e),this.idToNode.delete(t))}get size(){return this.idToNode.size}}});var Ji={};L(Ji,{captureScreenshot:()=>Mv,startVoiceRecording:()=>_v});async function Mv(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Dr)),Promise.resolve().then(()=>(on(),qr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:Tu}),contentType:Tu,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Lv(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of Pv)if(!(r&&!((t=e.isTypeSupported)!=null&&t.call(e,r))))try{let s=new e(n,r?{mimeType:r}:void 0),i=[];return s.ondataavailable=o=>{o.data&&o.data.size&&i.push(o.data)},s.start(),{rec:s,mime:r||s.mimeType||"",chunks:i}}catch{}return null}async function _v(){var h,g,x;if(typeof navigator=="undefined"||!((h=navigator.mediaDevices)!=null&&h.getUserMedia)||typeof MediaRecorder=="undefined")return null;let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return null}let e=Lv(n);if(!e){for(let v of n.getTracks())v.stop();return null}let{rec:t,mime:r,chunks:s}=e,i=Date.now(),o,a,c;try{let v=(g=globalThis.AudioContext)!=null?g:globalThis.webkitAudioContext;if(v&&typeof requestAnimationFrame=="function"){a=new v;let y=a.createAnalyser();y.fftSize=512,a.createMediaStreamSource(n).connect(y);let b=new Float32Array(y.fftSize),E=()=>{y.getFloatTimeDomainData(b);let w=0;for(let I=0;I<b.length;I++)w+=b[I]*b[I];o==null||o(Math.sqrt(w/b.length)),c=requestAnimationFrame(E)};c=requestAnimationFrame(E)}}catch{}let l="",u,d=(x=globalThis.SpeechRecognition)!=null?x:globalThis.webkitSpeechRecognition,p;if(typeof d=="function")try{let v=new d;v.continuous=!0,v.interimResults=!0,v.onresult=y=>{let b=y.results,E="";for(let w=0;w<b.length;w++)E+=b[w][0].transcript;l=E,u==null||u(l)};try{let y=d.available;if(typeof y=="function"){let b=typeof navigator!="undefined"&&navigator.language||"en-US";await y({langs:[b],processLocally:!0})==="available"&&(v.processLocally=!0)}}catch{}v.start(),p=v}catch{}let f=()=>{try{p==null||p.stop()}catch{}c!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c);try{a==null||a.close()}catch{}for(let v of n.getTracks())v.stop()},m=setTimeout(()=>{t.state!=="inactive"&&t.stop()},3e4);return{onInterim(v){u=v},onLevel(v){o=v},cancel(){clearTimeout(m);try{t.state!=="inactive"&&t.stop()}catch{}f()},stop(){return clearTimeout(m),new Promise(v=>{var y;t.onstop=()=>{f();let b=Math.min(29999,Date.now()-i);if(!s.length){v(null);return}let E=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:E}),contentType:E,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var Tu,Pv,Qi=k(()=>{"use strict";wu();Tu="application/scalebun-snapshot+json";Pv=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Ov(n){var e,t;if(n.questions&&n.questions.length)return n.questions;switch(n.type){case"NPS":return[{key:"score",kind:"scale",scaleMax:(e=n.scale)!=null?e:10,label:n.question}];case"CSAT":case"RATINGS_PROMPT":return[{key:"score",kind:"scale",scaleMax:(t=n.scale)!=null?t:5,label:n.question}];case"FEEDBACK":return[{key:"text",kind:"text",label:n.question}];default:return[{key:"text",kind:"text",label:n.question}]}}function Bv(n){let e=[];for(let t of n)(!e.length||t.pageBreakBefore&&e[e.length-1].length)&&e.push([]),e[e.length-1].push(t);return e.length?e:[[]]}function Mu(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage",""),t.setAttribute("data-scalebun","");let r=t.attachShadow({mode:"open"}),s=((Se=n.style)==null?void 0:Se.dark)===!0,i=((le=n.style)==null?void 0:le.rtl)===!0,o=vu(n.style,{dark:s});t.setAttribute("dir",i?"rtl":"ltr");for(let[q,V]of Object.entries(o.appearance))t.setAttribute(`data-${q}`,V);document.body.appendChild(t);let a=Ov(n),c=new Map,l=!1,u=()=>{var q;l||(l=!0,(q=e.onStarted)==null||q.call(e))};Ne(r,`:host{${o.vars}}
11
- ${Fv}`);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true"),p.setAttribute("aria-label",n.name||"Survey"),d.appendChild(p),r.appendChild(d);let f=document.createElement("div");p.appendChild(f);let m=["text","screenshot","voice"],h=new Map,g=Bv(a),x=0,v=g.length-1,y=q=>c.has(q.key)||m.includes(q.kind),b=q=>{var V;return((V=g[q])!=null?V:[]).every(K=>K.required===!1?!0:y(K))},E=()=>{A.disabled=!b(x),A.textContent=x===v?"Submit":"Next",R.style.display=x>0?"":"none",I.textContent=g.length>1?`Page ${x+1} of ${g.length}`:""},w=()=>{var q,V;S.replaceChildren();for(let K of(q=g[x])!=null?q:[]){let de=document.createElement("div");de.className="qb";let me=document.createElement("div");me.className="q",me.textContent=K.label||n.question,de.appendChild(me),Dv(de,K,se=>{c.set(K.key,se),u(),E()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),E()},c.get(K.key)),S.appendChild(de)}E(),(V=S.querySelector("textarea, .opt, .emoji"))==null||V.focus()},I=document.createElement("div");I.className="pg",f.appendChild(I);let S=document.createElement("div");f.appendChild(S);let C=document.createElement("div");C.className="foot";let M=document.createElement("button");M.className="x",M.textContent="Dismiss";let R=document.createElement("button");R.className="back",R.type="button",R.textContent="Back",R.style.display="none";let A=document.createElement("button");A.className="go",A.textContent="Submit",C.append(M,R,A),f.appendChild(C),w();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",te=()=>{if(e.onSubmit(qv(a,c,[...h.values()])),!D){O();return}f.remove();let q=document.createElement("div");q.className="thanks";let V=document.createElement("div");V.className="q",V.textContent=D,q.appendChild(V),p.appendChild(q),setTimeout(()=>d.addEventListener("click",O),0),setTimeout(O,2200)},J=()=>{if(x<v){x+=1,u(),w();return}te()},Q=()=>{x!==0&&(x-=1,w())},fe=q=>{q.key==="Escape"&&z()};M.addEventListener("click",z),A.addEventListener("click",J),R.addEventListener("click",Q),d.addEventListener("click",q=>{q.target===d&&z()}),document.addEventListener("keydown",fe);let ce=typeof n.startScreen=="string"?n.startScreen.trim():"",xe=()=>{var q;(q=S.querySelector("textarea, .opt, .emoji"))==null||q.focus()};if(ce){f.style.display="none";let q=document.createElement("div"),V=document.createElement("div");V.className="q",V.textContent=ce;let K=document.createElement("div");K.className="lede",K.textContent=`${a.length} quick question${a.length===1?"":"s"}`;let de=document.createElement("div");de.className="foot";let me=document.createElement("button");me.className="x",me.textContent="Dismiss";let se=document.createElement("button");se.className="go",se.textContent="Start",de.append(me,se),q.append(V,K,de),p.insertBefore(q,f),me.addEventListener("click",z),se.addEventListener("click",()=>{q.remove(),f.style.display="",u(),xe()}),se.focus()}else xe();return{close:O}}function Dv(n,e,t,r,s){var i,o;if(e.kind==="screenshot"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F4F7} Attach screenshot",c.addEventListener("click",async()=>{c.disabled=!0;try{let{captureScreenshot:l}=await Promise.resolve().then(()=>(Qi(),Ji)),u=await l(!0);u?(r(u),c.textContent="\u2713 Screenshot attached",c.setAttribute("data-done","true")):c.textContent="Screenshot unavailable"}finally{c.disabled=!1}}),a.appendChild(c),n.appendChild(a);return}if(e.kind==="voice"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F399} Record voice";let l=document.createElement("textarea");l.placeholder="Transcript (editable)\u2026",l.style.display="none";let u=null;c.addEventListener("click",async()=>{if(u){let d=u;u=null,c.disabled=!0;let p=await d.stop();c.disabled=!1,p?(p.transcript=l.value||p.transcript,p.transcriptApproved=!0,r(p),c.textContent="\u2713 Voice attached",c.setAttribute("data-done","true")):c.textContent="\u{1F399} Record voice"}else{c.disabled=!0;let{startVoiceRecording:d}=await Promise.resolve().then(()=>(Qi(),Ji));if(u=await d(),c.disabled=!1,!u){c.textContent="Mic unavailable";return}l.style.display="block",u.onInterim(p=>{l.value=p}),c.textContent="\u23F9 Stop"}}),a.appendChild(c),n.appendChild(a),n.appendChild(l);return}if(e.kind==="text"){let a=document.createElement("textarea");typeof s=="string"&&(a.value=s),a.addEventListener("input",()=>t(a.value)),n.appendChild(a);return}if(e.kind==="scale"){let a=(i=e.scaleMax)!=null?i:5,c=a>=10?0:1,l=document.createElement("div");l.className="row";let u=[];for(let d=c;d<=a;d++){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=String(d),p.setAttribute("aria-pressed",s===d?"true":"false"),p.addEventListener("click",()=>{u.forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d)}),u.push(p),l.appendChild(p)}n.appendChild(l);return}if(e.kind==="emoji"){let a=document.createElement("div");a.className="row";let c=[];Nv.forEach((l,u)=>{let d=document.createElement("button");d.className="emoji",d.type="button",d.textContent=l,d.setAttribute("aria-pressed",s===u+1?"true":"false"),d.setAttribute("aria-label",`${u+1}`),d.addEventListener("click",()=>{c.forEach(p=>p.setAttribute("aria-pressed","false")),d.setAttribute("aria-pressed","true"),t(u+1)}),c.push(d),a.appendChild(d)}),n.appendChild(a);return}if(e.kind==="boolean"||e.kind==="single"||e.kind==="multi"){let a=e.kind==="boolean"?["Yes","No"]:(o=e.choices)!=null?o:[],c=e.kind==="multi",l=new Set(c&&Array.isArray(s)?s:[]),u=document.createElement("div");u.className="row";for(let d of a){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=d,p.setAttribute("aria-pressed",(c?l.has(d):s===d)?"true":"false"),p.addEventListener("click",()=>{c?(l.has(d)?l.delete(d):l.add(d),p.setAttribute("aria-pressed",l.has(d)?"true":"false"),t([...l])):(u.querySelectorAll(".opt").forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d))}),u.appendChild(p)}n.appendChild(u)}}function qv(n,e,t){let r=[],s,i;for(let o of n){let a=e.get(o.key);if(a==null)continue;let c=Array.isArray(a)?a.join(", "):a;r.push({key:o.key,value:c}),s===void 0&&typeof a=="number"&&(s=a),i===void 0&&typeof a=="string"&&(i=a)}return{score:s,text:i,answers:r,...t.length?{attachments:t}:{}}}var Nv,Fv,Pu=k(()=>{"use strict";$();ji();Nv=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];Fv=`
10
+ </div>`,e.appendChild(t),e.appendChild(r),document.body.appendChild(e);let s=r.querySelector("[data-scalebun-msg]"),i=r.querySelector("[data-scalebun-email]"),o=r.querySelector("[data-scalebun-status]"),a=r.querySelector("[data-scalebun-send]"),c=r.querySelector("[data-scalebun-cancel]"),l=!1,u=m=>{l=m,r.classList.toggle("sbbr-open",m),e.classList.toggle("sbbr-expanded",m),m&&s.focus()},d=()=>u(!l),p=()=>u(!1),f=async()=>{let m=s.value.trim();if(!m){o.textContent="Please describe the bug.";return}a.disabled=!0,o.textContent="Sending\u2026";let h=null,g;try{let x=await n.onSubmit({message:m,email:i.value.trim()||void 0});x&&typeof x=="object"?g=x.e:h=x!=null?x:null}catch{h=null,g="send"}a.disabled=!1,h?(o.textContent="Thanks \u2014 your report was sent.",s.value="",i.value="",setTimeout(()=>{l&&u(!1),o.textContent=""},1500)):o.textContent=g?Xd[g]:Xd.send};return t.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",f),{destroy:()=>{t.removeEventListener("click",d),c.removeEventListener("click",p),a.removeEventListener("click",f),e.remove()}}}var Xd,$y,Jd=k(()=>{"use strict";$();Xd={init:"Reporting isn\u2019t ready yet. Reload the page and try again.",off:"Bug reporting is turned off for this site.",empty:"Please describe the bug.",consent:"Reporting is paused until you accept the privacy notice on this page.",send:"Couldn\u2019t reach the server. Check your connection and try again."},$y=2147483e3});var cu={};L(cu,{normalizeConfig:()=>Bi});function su(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Ie(e.cooldownHours),maxImpressions:Ie(e.maxImpressions),maxImpressionsPerSession:Ie(e.maxImpressionsPerSession),samplePct:Ie(e.samplePct)});return Object.keys(t).length?t:void 0}function iu(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Ie(e.seconds),sessions:Ie(e.sessions),slowMs:Ie(e.slowMs),screen:U(e.screen),delaySeconds:Ie(e.delaySeconds)});return Object.keys(t).length?t:void 0}function ou(n){let e=_e(n),t=Ke({platforms:Ni(e.platforms),minAppVersion:U(e.minAppVersion),segments:Ni(e.segments),userProps:e.userProps&&typeof e.userProps=="object"&&!Array.isArray(e.userProps)?e.userProps:void 0});return Object.keys(t).length?t:void 0}function Jy(n){var t;let e=[];for(let r of Oi(n)){let s=_e(r),i=U(s.key),o=U(s.kind);!i||!o||!Yy.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Ni(s.choices),scaleMax:Ie(s.scaleMax),required:typeof s.required=="boolean"?s.required:void 0,pageBreakBefore:s.pageBreakBefore===!0?!0:void 0}))}return e.length?e:void 0}function Qy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!Xy.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function au(n){let e=_e(n),t=U(e.body);if(!t)return null;let r=_e(e.secondaryCta),s=e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,i=e.ext&&typeof e.ext=="object"&&!Array.isArray(e.ext)?e.ext:void 0;return Ke({title:U(e.title),body:t,imageUrl:U(e.imageUrl),cta:Qy(e.cta),secondaryCta:U(r.label)?{label:U(r.label),action:"dismiss"}:void 0,dark:dt(e.dark),rtl:dt(e.rtl),coupon:U(e.coupon),style:s,ext:i})}function Zy(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=au(e.variantB);return Ke({enabled:dt(e.enabled),split:Ie(e.split),variantB:t!=null?t:void 0})}function ev(n){var s,i,o;let e=_e(n),t=U(e.id),r=U(e.type);return!t||!r?null:Ke({id:t,type:r,name:(s=U(e.name))!=null?s:t,question:(i=U(e.question))!=null?i:"",questions:Jy(e.questions),scale:Ie(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:iu(e.triggerConfig),targeting:ou(e.targeting),throttle:su(e.throttle),enabled:(o=dt(e.enabled))!=null?o:!0,revision:U(e.revision),style:e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,startScreen:U(e.startScreen),thankYouScreen:U(e.thankYouScreen)})}function tv(n){let e=_e(n),t=U(e.id),r=au(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&Gy.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Ie(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:iu(e.triggerConfig),targeting:ou(e.targeting),throttle:su(e.throttle),spec:r,revision:U(e.revision),experiment:Zy(e.experiment),variantId:U(e.variantId),variantKey:U(e.variantKey),preview:dt(e.preview),previewId:U(e.previewId),isTest:dt(e.isTest),testRunId:U(e.testRunId),createdAt:U(e.createdAt)})}function Bi(n){var t,r;let e=_e(n);return{configVersion:(t=Ie(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Oi(e.campaigns).map(ev).filter(s=>s!==null),inAppMessages:Oi(e.inAppMessages).map(tv).filter(s=>s!==null)}}var _e,Oi,U,Ie,dt,Ni,Ke,Gy,Xy,Yy,Fi=k(()=>{"use strict";_e=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Oi=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Ie=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,Ni=n=>{if(!Array.isArray(n))return;let e=n.filter(t=>typeof t=="string");return e.length?e:void 0},Ke=n=>{for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n},Gy=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],Xy=new Set(["dismiss","link","custom"]),Yy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var nv,tn,lu=k(()=>{"use strict";nv={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},tn=class{constructor(e){this.fire=e;this.items=[];this.timers=new Set;this.currentScreen=""}setItems(e){this.items=e,this.scheduleTimers()}onScreenView(e,t=0){let r=this.currentScreen;if(r&&r!==e)for(let s of this.items)s.trigger==="screen_exit"&&this.candidate(s,r,t);this.currentScreen=e;for(let s of this.items)s.trigger==="screen_view"&&this.candidate(s,e,t)}onSignal(e,t=0){let r=nv[e];if(r)for(let s of this.items)s.trigger&&r.includes(s.trigger)&&this.candidate(s,this.currentScreen,t)}onCustomEvent(e,t=0){var r,s,i;for(let o of this.items)o.trigger==="custom_event"&&((s=(r=o.triggerConfig)==null?void 0:r.event)!=null?s:e)===e?this.candidate(o,this.currentScreen,t):o.trigger==="after_purchase"&&e==="purchase"?this.candidate(o,this.currentScreen,t):o.trigger==="failed_action"&&(((i=o.triggerConfig)==null?void 0:i.action)===e||e==="failed_action")&&this.candidate(o,this.currentScreen,t)}onLifecycle(e,t,r=0){var s;for(let i of this.items)if(i.trigger===e){if(e==="n_sessions"){let o=(s=i.triggerConfig)==null?void 0:s.sessions;if(typeof o=="number"&&o!==t)continue}this.candidate(i,this.currentScreen,r)}}candidate(e,t,r=0){var o,a,c;if(e.targetScreen&&t&&e.targetScreen!==t)return;let s=(c=(a=(o=e.triggerConfig)==null?void 0:o.delaySeconds)!=null?a:e.delaySeconds)!=null?c:0,i=Math.max(0,s-r/1e3);if(i>0){let l=setTimeout(()=>{this.timers.delete(l),this.fire(e)},i*1e3);this.timers.add(l)}else this.fire(e)}scheduleTimers(){var e;for(let t of this.items){let r=(e=t.triggerConfig)==null?void 0:e.seconds;if(t.trigger==="time_in_app"&&typeof r=="number"&&r>0){let s=setTimeout(()=>{this.timers.delete(s),this.candidate(t,this.currentScreen)},r*1e3);this.timers.add(s)}}}stop(){for(let e of this.timers)clearTimeout(e);this.timers.clear()}}});var gu={};L(gu,{clearEngageState:()=>ov,hasTestSeen:()=>$i,markTestSeen:()=>zi,passesThrottle:()=>Ar,readState:()=>Di,recordCompleted:()=>Tr,recordShown:()=>Rr});function nn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Di(n){let e=nn();if(!e)return{...Ir};try{let t=e.getItem(uu(n));if(!t)return{...Ir};let r=JSON.parse(t);return{impressions:typeof r.impressions=="number"?r.impressions:0,lastShownAt:typeof r.lastShownAt=="number"?r.lastShownAt:0,completed:r.completed===!0,revision:typeof r.revision=="string"?r.revision:void 0}}catch{return{...Ir}}}function pu(n,e){let t=nn();if(t)try{t.setItem(uu(n),JSON.stringify(e))}catch{}}function fu(n){let e=Di(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...Ir,revision:n.revision}:e}function Hi(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function mu(n){let e=Hi();if(!e)return{sid:n,counts:{}};try{let t=e.getItem(qi);if(!t)return{sid:n,counts:{}};let r=JSON.parse(t);return r.sid!==n||!r.counts||typeof r.counts!="object"?{sid:n,counts:{}}:{sid:n,counts:r.counts}}catch{return{sid:n,counts:{}}}}function sv(n){let e=Hi();if(e)try{e.setItem(qi,JSON.stringify(n))}catch{}}function hu(n,e){let t=mu(e).counts[n.id];return!t||n.revision&&t.rev&&t.rev!==n.revision?0:typeof t.n=="number"?t.n:0}function Ar(n,e,t=""){var o;let r=n.throttle,s=fu(n);if(s.completed)return!1;let i=(o=r==null?void 0:r.maxImpressionsPerSession)!=null?o:r?0:rv;return i>0&&hu(n,t)>=i?!1:r?!(r.showOnce&&s.impressions>0||typeof r.maxImpressions=="number"&&s.impressions>=r.maxImpressions||typeof r.cooldownHours=="number"&&e-s.lastShownAt<r.cooldownHours*36e5):!0}function Rr(n,e,t=""){let r=fu(n);pu(n.id,{impressions:r.impressions+1,lastShownAt:e,completed:r.completed,revision:n.revision});let s=mu(t);s.counts[n.id]={n:hu(n,t)+1,rev:n.revision},sv(s)}function Tr(n){var t;let e=Di(n.id);pu(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function $i(n){var t;let e=nn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(Cr))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function zi(n){var t;let e=nn();if(e)try{let r=JSON.parse((t=e.getItem(Cr))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>iv;)r.shift();e.setItem(Cr,JSON.stringify(r))}catch{}}function ov(){var e;let n=nn();if(n)try{let t=[];for(let r=0;r<n.length;r++){let s=n.key(r);s&&(s.startsWith(du)||s==="scalebun_engage_sessions"||s===Cr)&&t.push(s)}for(let r of t)n.removeItem(r);(e=Hi())==null||e.removeItem(qi)}catch{}}var du,uu,Ir,rv,qi,Cr,iv,Ui=k(()=>{"use strict";du="scalebun_engage_throttle:";uu=n=>`${du}${n}`,Ir={impressions:0,lastShownAt:0,completed:!1};rv=1,qi="scalebun_engage_session_shows";Cr="scalebun_engage_test_seen",iv=50});function wu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:vu.test(e)||uv.test(e)||pv.test(e)||fv.has(e.toLowerCase())}function Vi(n,e={}){let t={};if(!n||typeof n!="object"||Array.isArray(n))return t;let r=n;for(let s of Object.keys(r)){if(!yu.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}wu(r[s])&&(t[s]=r[s].trim())}return t}function mv(n){let e=hv(n);if(!e)return null;let t=r=>{let s=r/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*t(e[0])+.7152*t(e[1])+.0722*t(e[2])}function hv(n){let e=n.trim();if(vu.test(e)){let r=e.slice(1);return(r.length===3||r.length===4)&&(r=r.slice(0,3).split("").map(s=>s+s).join("")),r.length>=6?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]:null}let t=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})/i.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Wi(n,e){if(e&&wu(e))return e;let t=mv(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function wv(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(bu)){let s=t[r];typeof s=="string"&&bu[r].includes(s)&&(e[r]=s)}return e}function xu(n,e={}){var u,d;let t=e.dark?cv:av,r=e.dark?dv:lv,s=Vi(n),i={};for(let p of yu)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=Wi(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...gv,...wv(n)},c=bv[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=yv[a.radius],i.maxWidth=vv[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var yu,av,cv,lv,dv,vu,uv,pv,fv,bu,gv,bv,yv,vv,ji=k(()=>{"use strict";yu=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],av={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},cv={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},lv={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},dv={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},vu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,uv=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,pv=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,fv=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);bu={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},gv={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},bv={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},yv={sharp:"4px",soft:"16px",round:"26px"},vv={narrow:"340px",standard:"420px",wide:"540px"}});var Su=k(()=>{"use strict"});var Xi={};L(Xi,{CssomRecorder:()=>Gi,adoptedSheetId:()=>Mr});function Mr(n){let e=ku.get(n);return e==null&&(e=xv++,ku.set(n,e)),e}function Eu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var ku,xv,Ki,Gi,Pr=k(()=>{"use strict";ku=new WeakMap,xv=1;Ki="__scalebun_cssom_patched__",Gi=class{constructor(e,t){this.reg=e;this.onMutations=t;this.installed=!1;this.pending=[];this.scheduled=!1}install(){if(typeof CSSStyleSheet=="undefined")return;let e=CSSStyleSheet.prototype;if(e[Ki])return;let t=this;this.origInsert=e.insertRule,e.insertRule=function(r,s){let i=t.origInsert.call(this,r,s),o=t.ref(this);return o&&t.record({op:"sheet",sheet:o,action:"insert",rule:r,index:i}),i},this.origDelete=e.deleteRule,e.deleteRule=function(r){t.origDelete.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"delete",index:r})},typeof e.replaceSync=="function"&&(this.origReplaceSync=e.replaceSync,e.replaceSync=function(r){t.origReplaceSync.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"replace",rules:Eu(this)})}),typeof e.replace=="function"&&(this.origReplace=e.replace,e.replace=function(r){let s=t.origReplace.call(this,r);return Promise.resolve(s).then(()=>{let i=t.ref(this);i&&t.record({op:"sheet",sheet:i,action:"replace",rules:Eu(this)})}),s}),e[Ki]=!0,this.installed=!0}disconnect(){if(!this.installed)return;let e=CSSStyleSheet.prototype;this.origInsert&&(e.insertRule=this.origInsert),this.origDelete&&(e.deleteRule=this.origDelete),this.origReplaceSync&&(e.replaceSync=this.origReplaceSync),this.origReplace&&(e.replace=this.origReplace),delete e[Ki],this.installed=!1,this.pending=[]}ref(e){let t=e.ownerNode;if(t){let r=this.reg.getId(t);return r!=null?{node:r}:null}return{adopted:Mr(e)}}record(e){this.pending.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){if(this.scheduled=!1,!this.pending.length)return;let e=this.pending;this.pending=[],this.onMutations(e)}}});var Dr={};L(Dr,{MAX_INLINED_CSS_BYTES:()=>Iu,NO_MASK_TEXT_PARENTS:()=>_r,SENSITIVE_ATTRS:()=>Or,UNRESOLVED_SHEET_ATTR:()=>Cu,absUrl:()=>qe,absolutizeAttrValue:()=>Fr,absolutizeCssUrls:()=>rn,absolutizeSrcset:()=>Tu,isMaskedSubtree:()=>Nr,isPasswordField:()=>Rt,maskSecret:()=>Tt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Xe,serializeShadow:()=>Br,takeSnapshot:()=>Iv});function Ev(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${Yi},${e.join(",")}`:Yi;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return Yi}}function Nr(n,e){if(!n||!e)return!1;try{return!!n.closest(e)}catch{return!1}}function Ze(n={}){var e,t;return{maskAllText:(e=n.maskAllText)!=null?e:!0,maskAllInputs:(t=n.maskAllInputs)!=null?t:!0,maskSel:Ev(n.maskSelectors),cssBudget:{used:0}}}function Iv(n,e,t={}){var r;return(r=Xe(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Xe(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Lr(n,e,t)},a=Ru(n,n.baseURI);return a.length&&(o.adoptedStyles=a),o}case 10:{let i=n;return{t:"dt",id:e.add(n),name:i.name,publicId:i.publicId,systemId:i.systemId}}case 1:{let i=n;if(Cv(i))return Rv(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===Sv?"svg":i.namespaceURI===kv?"math":void 0,l=a==="style"?Tv(i,e):Lr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:Au(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Br(d,e,t)),u}case 3:{let i=(s=(r=n.parentNode)==null?void 0:r.nodeName)!=null?s:"",o=n.data,c=(t.maskAllText||Nr(n.parentElement,t.maskSel))&&!_r.has(i)?Ge(o):o;return{t:"tx",id:e.add(n),value:c}}case 8:return{t:"cm",id:e.add(n),value:n.data};case 4:return{t:"tx",id:e.add(n),value:n.data};default:return null}}function Lr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Xe(s,e,t);i&&r.push(i)}),r}function Cv(n){var t;if(n.tagName.toLowerCase()!=="link")return!1;let e=((t=n.getAttribute("rel"))!=null?t:"").toLowerCase();return e.split(/\s+/).includes("stylesheet")&&!e.includes("alternate")}function Av(n){var e;try{let t=(e=n.sheet)==null?void 0:e.cssRules;return!t||t.length===0?null:Array.from(t).map(r=>r.cssText).join("")}catch{return null}}function Rv(n,e,t,r){let s=e.add(n),i=Av(n);if(i&&r.used+i.length<=Iu){r.used+=i.length;let a=rn(i,n.ownerDocument.baseURI),c=n.ownerDocument.createTextNode(""),l={},u=n.getAttribute("media");u&&(l.media=u);let d=n.getAttribute("href");return d&&(l["data-scalebun-href"]=qe(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=Au(n,t);return o[Cu]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function Tv(n,e){var s,i,o;let t="";try{let a=(s=n.sheet)==null?void 0:s.cssRules;a&&a.length&&(t=Array.from(a).map(c=>c.cssText).join(""))}catch{}if(t||(t=(i=n.textContent)!=null?i:""),!t)return[];t=rn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function Rt(n){var t,r;let e=(t=n.tagName)==null?void 0:t.toLowerCase();return e!=="input"&&e!=="textarea"?!1:(((r=n.getAttribute)==null?void 0:r.call(n,"type"))||"").toLowerCase()==="password"}function Au(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Or.has(l.name)?Ge(l.value):l.value;let r=n.tagName.toLowerCase();if(r==="input"||r==="textarea"){let l=(o=(i=n.value)!=null?i:t.value)!=null?o:"";Rt(n)?t.value=Tt(l):t.value=e.maskAllInputs?Ge(l):l}t.loading==="lazy"&&(r==="img"||r==="iframe")&&(t.loading="eager");let s=(c=(a=n.ownerDocument)==null?void 0:a.baseURI)!=null?c:"";for(let l of Pv){let u=t[l];u!=null&&(t[l]=Fr(l,u,r,s))}return t}function Br(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Lr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=Ru(n,i);return o.length&&(s.adoptedStyles=o),s}function Ru(n,e){try{let t=n.adoptedStyleSheets;if(!t||!t.length)return[];let r=[];for(let s of t)try{let i=Array.from(s.cssRules).map(o=>o.cssText).join("");i&&r.push({id:Mr(s),css:rn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Tt(n){return"*".repeat(n.length)}function qe(n,e){let t=n.trim();if(!t||!e||Mv.test(t))return n;try{return new URL(t,e).href}catch{return n}}function rn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${qe(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${qe(i,e)}${s}`),t}function Fr(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return qe(e,r);case"srcset":return Tu(e,r);case"style":return rn(e,r);case"href":return t==="link"||t==="use"||t==="image"?qe(e,r):e;case"xlink:href":return t==="use"||t==="image"?qe(e,r):e;case"data":return t==="object"?qe(e,r):e;default:return e}}function Tu(n,e){return!n||!e||/data:/i.test(n)?n:n.split(",").map(t=>{let r=t.trim();if(!r)return r;let s=r.search(/\s/);return s===-1?qe(r,e):qe(r.slice(0,s),e)+r.slice(s)}).join(", ")}var _r,Or,Sv,kv,Yi,Iu,Cu,Mv,Pv,et=k(()=>{"use strict";Pr();_r=new Set(["STYLE","SCRIPT"]),Or=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),Sv="http://www.w3.org/2000/svg",kv="http://www.w3.org/1998/Math/MathML",Yi='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';Iu=2*1024*1024,Cu="data-scalebun-sheet-unresolved";Mv=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;Pv=["src","srcset","poster","style","href","xlink:href","data"]});var qr={};L(qr,{NodeRegistry:()=>sn});var sn,on=k(()=>{"use strict";sn=class{constructor(e=1){this.idToNode=new Map;this.nodeToId=new WeakMap;this.counter=e}add(e){let t=this.nodeToId.get(e);if(t!=null)return t;let r=this.counter++;return this.nodeToId.set(e,r),this.idToNode.set(r,e),r}set(e,t){this.nodeToId.set(t,e),this.idToNode.set(e,t),e>=this.counter&&(this.counter=e+1)}getId(e){return this.nodeToId.get(e)}getNode(e){return this.idToNode.get(e)}has(e){return this.nodeToId.has(e)}remove(e){let t=this.nodeToId.get(e);t!=null&&(this.nodeToId.delete(e),this.idToNode.delete(t))}get size(){return this.idToNode.size}}});var Ji={};L(Ji,{captureScreenshot:()=>Lv,startVoiceRecording:()=>Nv});async function Lv(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Dr)),Promise.resolve().then(()=>(on(),qr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:Pu}),contentType:Pu,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Ov(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of _v)if(!(r&&!((t=e.isTypeSupported)!=null&&t.call(e,r))))try{let s=new e(n,r?{mimeType:r}:void 0),i=[];return s.ondataavailable=o=>{o.data&&o.data.size&&i.push(o.data)},s.start(),{rec:s,mime:r||s.mimeType||"",chunks:i}}catch{}return null}async function Nv(){var h,g,x;if(typeof navigator=="undefined"||!((h=navigator.mediaDevices)!=null&&h.getUserMedia)||typeof MediaRecorder=="undefined")return null;let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return null}let e=Ov(n);if(!e){for(let v of n.getTracks())v.stop();return null}let{rec:t,mime:r,chunks:s}=e,i=Date.now(),o,a,c;try{let v=(g=globalThis.AudioContext)!=null?g:globalThis.webkitAudioContext;if(v&&typeof requestAnimationFrame=="function"){a=new v;let y=a.createAnalyser();y.fftSize=512,a.createMediaStreamSource(n).connect(y);let b=new Float32Array(y.fftSize),E=()=>{y.getFloatTimeDomainData(b);let w=0;for(let I=0;I<b.length;I++)w+=b[I]*b[I];o==null||o(Math.sqrt(w/b.length)),c=requestAnimationFrame(E)};c=requestAnimationFrame(E)}}catch{}let l="",u,d=(x=globalThis.SpeechRecognition)!=null?x:globalThis.webkitSpeechRecognition,p;if(typeof d=="function")try{let v=new d;v.continuous=!0,v.interimResults=!0,v.onresult=y=>{let b=y.results,E="";for(let w=0;w<b.length;w++)E+=b[w][0].transcript;l=E,u==null||u(l)};try{let y=d.available;if(typeof y=="function"){let b=typeof navigator!="undefined"&&navigator.language||"en-US";await y({langs:[b],processLocally:!0})==="available"&&(v.processLocally=!0)}}catch{}v.start(),p=v}catch{}let f=()=>{try{p==null||p.stop()}catch{}c!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c);try{a==null||a.close()}catch{}for(let v of n.getTracks())v.stop()},m=setTimeout(()=>{t.state!=="inactive"&&t.stop()},3e4);return{onInterim(v){u=v},onLevel(v){o=v},cancel(){clearTimeout(m);try{t.state!=="inactive"&&t.stop()}catch{}f()},stop(){return clearTimeout(m),new Promise(v=>{var y;t.onstop=()=>{f();let b=Math.min(29999,Date.now()-i);if(!s.length){v(null);return}let E=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:E}),contentType:E,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var Pu,_v,Qi=k(()=>{"use strict";Su();Pu="application/scalebun-snapshot+json";_v=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Bv(n){var e,t;if(n.questions&&n.questions.length)return n.questions;switch(n.type){case"NPS":return[{key:"score",kind:"scale",scaleMax:(e=n.scale)!=null?e:10,label:n.question}];case"CSAT":case"RATINGS_PROMPT":return[{key:"score",kind:"scale",scaleMax:(t=n.scale)!=null?t:5,label:n.question}];case"FEEDBACK":return[{key:"text",kind:"text",label:n.question}];default:return[{key:"text",kind:"text",label:n.question}]}}function Dv(n){let e=[];for(let t of n)(!e.length||t.pageBreakBefore&&e[e.length-1].length)&&e.push([]),e[e.length-1].push(t);return e.length?e:[[]]}function Lu(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage",""),t.setAttribute("data-scalebun","");let r=t.attachShadow({mode:"open"}),s=((Se=n.style)==null?void 0:Se.dark)===!0,i=((le=n.style)==null?void 0:le.rtl)===!0,o=xu(n.style,{dark:s});t.setAttribute("dir",i?"rtl":"ltr");for(let[H,V]of Object.entries(o.appearance))t.setAttribute(`data-${H}`,V);document.body.appendChild(t);let a=Bv(n),c=new Map,l=!1,u=()=>{var H;l||(l=!0,(H=e.onStarted)==null||H.call(e))};Ne(r,`:host{${o.vars}}
11
+ ${qv}`);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true"),p.setAttribute("aria-label",n.name||"Survey"),d.appendChild(p),r.appendChild(d);let f=document.createElement("div");p.appendChild(f);let m=["text","screenshot","voice"],h=new Map,g=Dv(a),x=0,v=g.length-1,y=H=>c.has(H.key)||m.includes(H.kind),b=H=>{var V;return((V=g[H])!=null?V:[]).every(K=>K.required===!1?!0:y(K))},E=()=>{A.disabled=!b(x),A.textContent=x===v?"Submit":"Next",R.style.display=x>0?"":"none",I.textContent=g.length>1?`Page ${x+1} of ${g.length}`:""},w=()=>{var H,V;S.replaceChildren();for(let K of(H=g[x])!=null?H:[]){let de=document.createElement("div");de.className="qb";let me=document.createElement("div");me.className="q",me.textContent=K.label||n.question,de.appendChild(me),Hv(de,K,se=>{c.set(K.key,se),u(),E()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),E()},c.get(K.key)),S.appendChild(de)}E(),(V=S.querySelector("textarea, .opt, .emoji"))==null||V.focus()},I=document.createElement("div");I.className="pg",f.appendChild(I);let S=document.createElement("div");f.appendChild(S);let C=document.createElement("div");C.className="foot";let M=document.createElement("button");M.className="x",M.textContent="Dismiss";let R=document.createElement("button");R.className="back",R.type="button",R.textContent="Back",R.style.display="none";let A=document.createElement("button");A.className="go",A.textContent="Submit",C.append(M,R,A),f.appendChild(C),w();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",ne=()=>{if(e.onSubmit($v(a,c,[...h.values()])),!D){O();return}f.remove();let H=document.createElement("div");H.className="thanks";let V=document.createElement("div");V.className="q",V.textContent=D,H.appendChild(V),p.appendChild(H),setTimeout(()=>d.addEventListener("click",O),0),setTimeout(O,2200)},J=()=>{if(x<v){x+=1,u(),w();return}ne()},Q=()=>{x!==0&&(x-=1,w())},fe=H=>{H.key==="Escape"&&z()};M.addEventListener("click",z),A.addEventListener("click",J),R.addEventListener("click",Q),d.addEventListener("click",H=>{H.target===d&&z()}),document.addEventListener("keydown",fe);let ce=typeof n.startScreen=="string"?n.startScreen.trim():"",xe=()=>{var H;(H=S.querySelector("textarea, .opt, .emoji"))==null||H.focus()};if(ce){f.style.display="none";let H=document.createElement("div"),V=document.createElement("div");V.className="q",V.textContent=ce;let K=document.createElement("div");K.className="lede",K.textContent=`${a.length} quick question${a.length===1?"":"s"}`;let de=document.createElement("div");de.className="foot";let me=document.createElement("button");me.className="x",me.textContent="Dismiss";let se=document.createElement("button");se.className="go",se.textContent="Start",de.append(me,se),H.append(V,K,de),p.insertBefore(H,f),me.addEventListener("click",z),se.addEventListener("click",()=>{H.remove(),f.style.display="",u(),xe()}),se.focus()}else xe();return{close:O}}function Hv(n,e,t,r,s){var i,o;if(e.kind==="screenshot"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F4F7} Attach screenshot",c.addEventListener("click",async()=>{c.disabled=!0;try{let{captureScreenshot:l}=await Promise.resolve().then(()=>(Qi(),Ji)),u=await l(!0);u?(r(u),c.textContent="\u2713 Screenshot attached",c.setAttribute("data-done","true")):c.textContent="Screenshot unavailable"}finally{c.disabled=!1}}),a.appendChild(c),n.appendChild(a);return}if(e.kind==="voice"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F399} Record voice";let l=document.createElement("textarea");l.placeholder="Transcript (editable)\u2026",l.style.display="none";let u=null;c.addEventListener("click",async()=>{if(u){let d=u;u=null,c.disabled=!0;let p=await d.stop();c.disabled=!1,p?(p.transcript=l.value||p.transcript,p.transcriptApproved=!0,r(p),c.textContent="\u2713 Voice attached",c.setAttribute("data-done","true")):c.textContent="\u{1F399} Record voice"}else{c.disabled=!0;let{startVoiceRecording:d}=await Promise.resolve().then(()=>(Qi(),Ji));if(u=await d(),c.disabled=!1,!u){c.textContent="Mic unavailable";return}l.style.display="block",u.onInterim(p=>{l.value=p}),c.textContent="\u23F9 Stop"}}),a.appendChild(c),n.appendChild(a),n.appendChild(l);return}if(e.kind==="text"){let a=document.createElement("textarea");typeof s=="string"&&(a.value=s),a.addEventListener("input",()=>t(a.value)),n.appendChild(a);return}if(e.kind==="scale"){let a=(i=e.scaleMax)!=null?i:5,c=a>=10?0:1,l=document.createElement("div");l.className="row";let u=[];for(let d=c;d<=a;d++){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=String(d),p.setAttribute("aria-pressed",s===d?"true":"false"),p.addEventListener("click",()=>{u.forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d)}),u.push(p),l.appendChild(p)}n.appendChild(l);return}if(e.kind==="emoji"){let a=document.createElement("div");a.className="row";let c=[];Fv.forEach((l,u)=>{let d=document.createElement("button");d.className="emoji",d.type="button",d.textContent=l,d.setAttribute("aria-pressed",s===u+1?"true":"false"),d.setAttribute("aria-label",`${u+1}`),d.addEventListener("click",()=>{c.forEach(p=>p.setAttribute("aria-pressed","false")),d.setAttribute("aria-pressed","true"),t(u+1)}),c.push(d),a.appendChild(d)}),n.appendChild(a);return}if(e.kind==="boolean"||e.kind==="single"||e.kind==="multi"){let a=e.kind==="boolean"?["Yes","No"]:(o=e.choices)!=null?o:[],c=e.kind==="multi",l=new Set(c&&Array.isArray(s)?s:[]),u=document.createElement("div");u.className="row";for(let d of a){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=d,p.setAttribute("aria-pressed",(c?l.has(d):s===d)?"true":"false"),p.addEventListener("click",()=>{c?(l.has(d)?l.delete(d):l.add(d),p.setAttribute("aria-pressed",l.has(d)?"true":"false"),t([...l])):(u.querySelectorAll(".opt").forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d))}),u.appendChild(p)}n.appendChild(u)}}function $v(n,e,t){let r=[],s,i;for(let o of n){let a=e.get(o.key);if(a==null)continue;let c=Array.isArray(a)?a.join(", "):a;r.push({key:o.key,value:c}),s===void 0&&typeof a=="number"&&(s=a),i===void 0&&typeof a=="string"&&(i=a)}return{score:s,text:i,answers:r,...t.length?{attachments:t}:{}}}var Fv,qv,_u=k(()=>{"use strict";$();ji();Fv=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];qv=`
12
12
  :host{all:initial}
13
13
  .ov{position:fixed;inset:0;display:flex;align-items:flex-end;justify-content:center;
14
14
  background:var(--sb-backdrop);font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;pointer-events:auto}
@@ -70,7 +70,7 @@ textarea{width:100%;min-height:72px;border:1px solid var(--sb-border);border-rad
70
70
  .lede{font-size:13px;color:var(--sb-muted);margin:-8px 0 16px}
71
71
  .thanks{text-align:center;padding:6px 0 2px}
72
72
  .thanks .q{margin-bottom:0}
73
- `});function $v(n){switch(n){case"modal":return".ov{align-items:center;justify-content:center}.card{max-width:380px;border-radius:16px;margin:16px}";case"fullscreen":return".ov{align-items:stretch;justify-content:stretch}.card{border-radius:0;width:100%}";case"bottom_sheet":return".ov{align-items:flex-end;justify-content:center}.card{width:100%;max-width:480px;border-radius:16px 16px 0 0}";case"top_banner":return".ov{align-items:flex-start;justify-content:stretch}.card{width:100%;border-radius:0}";case"bottom_banner":return".ov{align-items:flex-end;justify-content:stretch}.card{width:100%;border-radius:0}";case"toast":return".ov{align-items:flex-end;justify-content:flex-end}.card{max-width:320px;border-radius:12px;margin:16px}";case"tooltip":return".ov{align-items:flex-start;justify-content:center}.card{max-width:280px;border-radius:12px;margin:12px}"}}function Zi(n,e,t){var y,b,E,w,I,S;let r=document.createElement("div");r.setAttribute("data-scalebun-engage",""),r.setAttribute("data-scalebun","");let s=r.attachShadow({mode:"open"});document.body.appendChild(r);let i=e.dark===!0,o=(b=(y=e.style)==null?void 0:y.cardBg)!=null?b:i?"#1f2937":"#ffffff",a=(w=(E=e.style)==null?void 0:E.text)!=null?w:i?"#f9fafb":"#111827",c=(S=(I=e.style)==null?void 0:I.accent)!=null?S:"#111827",l=Hv.includes(n),u=vt(document.createElement("style"));u.textContent=`
73
+ `});function Uv(n){switch(n){case"modal":return".ov{align-items:center;justify-content:center}.card{max-width:380px;border-radius:16px;margin:16px}";case"fullscreen":return".ov{align-items:stretch;justify-content:stretch}.card{border-radius:0;width:100%}";case"bottom_sheet":return".ov{align-items:flex-end;justify-content:center}.card{width:100%;max-width:480px;border-radius:16px 16px 0 0}";case"top_banner":return".ov{align-items:flex-start;justify-content:stretch}.card{width:100%;border-radius:0}";case"bottom_banner":return".ov{align-items:flex-end;justify-content:stretch}.card{width:100%;border-radius:0}";case"toast":return".ov{align-items:flex-end;justify-content:flex-end}.card{max-width:320px;border-radius:12px;margin:16px}";case"tooltip":return".ov{align-items:flex-start;justify-content:center}.card{max-width:280px;border-radius:12px;margin:12px}"}}function Zi(n,e,t){var y,b,E,w,I,S;let r=document.createElement("div");r.setAttribute("data-scalebun-engage",""),r.setAttribute("data-scalebun","");let s=r.attachShadow({mode:"open"});document.body.appendChild(r);let i=e.dark===!0,o=(b=(y=e.style)==null?void 0:y.cardBg)!=null?b:i?"#1f2937":"#ffffff",a=(w=(E=e.style)==null?void 0:E.text)!=null?w:i?"#f9fafb":"#111827",c=(S=(I=e.style)==null?void 0:I.accent)!=null?S:"#111827",l=zv.includes(n),u=vt(document.createElement("style"));u.textContent=`
74
74
  :host{all:initial}
75
75
  .ov{position:fixed;inset:0;display:flex;z-index:2147483600;
76
76
  background:${l?"rgba(0,0,0,.28)":"transparent"};
@@ -87,7 +87,7 @@ img{width:100%;border-radius:8px;margin-bottom:10px;display:block}
87
87
  .x{position:absolute;top:8px;right:10px;background:none;border:none;color:${a};opacity:.5;font-size:18px;cursor:pointer;line-height:1}
88
88
  .sec{background:none;border:none;color:${a};opacity:.7;font-size:13px;cursor:pointer}
89
89
  .cta{background:${c};color:#fff;border:none;border-radius:9px;padding:9px 16px;font-size:14px;font-weight:600;cursor:pointer}
90
- ${$v(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-label",e.title||"Message"),e.rtl&&p.setAttribute("dir","rtl"),d.appendChild(p),s.appendChild(d);let f=()=>{r.remove(),document.removeEventListener("keydown",h)},m=()=>{t.onDismiss(),f()},h=C=>{C.key==="Escape"&&m()},g=document.createElement("button");if(g.className="x",g.textContent="\xD7",g.setAttribute("aria-label","Close"),g.addEventListener("click",m),p.appendChild(g),e.imageUrl){let C=document.createElement("img");C.src=e.imageUrl,C.alt="",p.appendChild(C)}if(e.title){let C=document.createElement("div");C.className="t",C.textContent=e.title,p.appendChild(C)}let x=document.createElement("div");if(x.className="b",x.textContent=e.body,p.appendChild(x),e.coupon){let C=document.createElement("div");C.className="coupon",C.textContent=e.coupon,p.appendChild(C)}let v=document.createElement("div");if(v.className="acts",e.secondaryCta){let C=document.createElement("button");C.className="sec",C.textContent=e.secondaryCta.label,C.addEventListener("click",m),v.appendChild(C)}if(e.cta){let C=document.createElement("button");C.className="cta",C.textContent=e.cta.label,C.addEventListener("click",()=>{t.onClick(e.cta),f()}),v.appendChild(C)}return v.childNodes.length&&p.appendChild(v),l&&d.addEventListener("click",C=>{C.target===d&&m()}),document.addEventListener("keydown",h),{close:f}}var Hv,Lu=k(()=>{"use strict";$();Hv=["modal","fullscreen","bottom_sheet"]});function eo(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(_u,n)}function Ou(n){return eo(n)?_u[n]:null}function Nu(n){let e=ut(n),r=[e.outcomes,e.rewards,e.segments].flatMap(s=>(Array.isArray(s)?s:[]).map(i=>{var a,c;let o=ut(i);return be((c=(a=o.id)!=null?a:o.value)!=null?c:o.code)}));return[...new Set(r.filter(Boolean))]}function Bu(n){var t;let e={campaignId:n.campaignId,gameKey:n.gameKey,attemptId:n.attemptId,attempt:Math.max(1,Math.floor(n.attempt)),...n.payload?{input:n.payload}:{},...(t=n.allowedOutcomeIds)!=null&&t.length?{allowedOutcomeIds:n.allowedOutcomeIds}:{}};switch(n.variantKey){case"spin_wheel":case"scratch_card":case"slot_reward":case"mystery_box":return{...e,variantKey:n.variantKey,action:"play"};case"progress_unlock":case"streak_reward":return{...e,variantKey:n.variantKey,action:"load"};case"daily_check_in":return{...e,variantKey:n.variantKey,action:"check_in"};case"quiz_card":return{...e,variantKey:n.variantKey,action:"submit_quiz"}}}function to(n,e){var f;let t=ut(e);if(be(t.attemptId)!==n.attemptId)throw new Error("Game result attemptId does not match the request");if(t.status==="unavailable")return{attemptId:n.attemptId,status:"unavailable",...typeof t.retryable=="boolean"?{retryable:t.retryable}:{},...be(t.message)?{message:be(t.message)}:{}};if(t.status!=="resolved")throw new Error("Game result status is invalid");let r=ut(t.outcome),s=be(r.id);if(!s)throw new Error("Game result outcome.id is required");let i=be(r.segmentId),o=r.segmentIndex;if(o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0))throw new Error("Game result segmentIndex is invalid");let a=(f=n.allowedOutcomeIds)!=null?f:[],c=typeof o=="number"?a[o]:void 0;if(a.length>0&&!a.includes(i||c||s))throw new Error("Game result is not one of the authored outcomes");let l=Array.isArray(r.symbols)?r.symbols.map(be).filter(Boolean):void 0;if(r.symbols!==void 0&&(!l||l.length===0||l.length>3))throw new Error("Game result symbols are invalid");let u=r.state;if(u!==void 0&&(u===null||typeof u!="object"||Array.isArray(u)))throw new Error("Game result state is invalid");let d=r.value,p=typeof d=="string"||typeof d=="number"||typeof d=="boolean";return{attemptId:n.attemptId,status:"resolved",outcome:{id:s,...be(r.label)?{label:be(r.label)}:{},...i?{segmentId:i}:{},...typeof o=="number"?{segmentIndex:o}:{},...l?{symbols:l}:{},...u?{state:u}:{},...p?{value:d}:{},...be(r.receiptId)?{receiptId:be(r.receiptId)}:{}}}}function Fu(n,e){var a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R;let t=ut(e),r=ut((c=(a=t.resultState)!=null?a:t.result)!=null?c:t.reward),s=be((g=(h=(m=(f=(p=(d=(u=(l=t.rewardValue)!=null?l:t.prize)!=null?u:t.rewardResult)!=null?d:t.resultReward)!=null?p:t.reward)!=null?f:r.label)!=null?m:r.title)!=null?h:r.name)!=null?g:t.resultState),i=be((E=(b=(y=(v=(x=t.outcomeId)!=null?x:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?E:r.value),o=null;switch(n.variantKey){case"spin_wheel":{let A=[t.winningIndex,t.resultIndex,t.selectedIndex,r.index].find(D=>typeof D=="number"&&Number.isInteger(D)&&D>=0),O=typeof A=="number"&&Array.isArray(t.segments)?ut(t.segments[A]):{},z=be((R=(M=(C=(S=(I=(w=t.winningId)!=null?w:t.segmentId)!=null?I:r.segmentId)!=null?S:r.id)!=null?C:O.id)!=null?M:O.value)!=null?R:O.code);if(!z&&A===void 0&&!s)return null;o={id:i||z||`preview_segment_${A}`,...s?{label:s}:{},...z?{segmentId:z}:{},...typeof A=="number"?{segmentIndex:A}:{}};break}case"slot_reward":{let A=Array.isArray(t.resultSymbols)?t.resultSymbols.map(be).filter(Boolean):[];if(A.length===0)return null;o={id:i||`preview_${A.join("_")}`,symbols:A,...s?{label:s}:{}};break}case"scratch_card":case"mystery_box":if(!s&&!i)return null;o={id:i||"preview_reward",...s?{label:s}:{}};break;case"progress_unlock":case"streak_reward":case"daily_check_in":o={id:i||"preview_state",...s?{label:s}:{},state:{...t}};break;case"quiz_card":if(!i&&!s)return null;o={id:i||"preview_quiz",...s?{label:s}:{}};break}return to(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function Du(n,e,t,r){let s=`${e}:${Math.max(1,Math.floor(t))}`,i=n.get(s);if(i)return i;let o=`scalebun_game_${Date.now().toString(36)}_${r().toString(36)}`;return n.set(s,o),o}var _u,ut,be,no=k(()=>{"use strict";_u={spin_wheel:"play",scratch_card:"play",slot_reward:"play",mystery_box:"play",progress_unlock:"load",streak_reward:"load",daily_check_in:"check_in",quiz_card:"submit_quiz"},ut=n=>n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},be=n=>typeof n=="string"?n.trim():""});function Hu(n){if(!eo(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=zv(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=Bu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:Du(t,e,r,()=>Uv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:Nu(n.ext)});if(n.preview){let a=Fu(o,n.ext);return a?qu(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?qu(to(o,await n.handler(o))):{ok:!1,message:"Rewards are unavailable right now.",retryable:!1}}catch{return{ok:!1,message:"Rewards are unavailable right now.",retryable:!0}}}}function qu(n){var t;if(n.status==="unavailable")return{ok:!1,...n.message?{message:n.message}:{message:"Rewards are unavailable right now."},retryable:n.retryable!==!1};let e=n.outcome;return{ok:!0,...e.label?{label:e.label}:{},...typeof e.segmentIndex=="number"?{index:e.segmentIndex}:{},...(t=e.symbols)!=null&&t.length?{symbols:e.symbols}:{},...e.state?{state:e.state}:{}}}var zv,Uv,$u=k(()=>{"use strict";no();zv=n=>typeof n=="string"?n.trim():"",Uv=0});var Mt,ro=k(()=>{"use strict";Mt=class{constructor(){this.slots=new Map;this.waiters=new Map}register(e,t){this.slots.set(e,t);let r=this.waiters.get(e);if(r){this.waiters.delete(e);for(let s of r)try{s(t)}catch{}}}unregister(e){this.slots.delete(e)}get(e){return this.slots.get(e)}whenAvailable(e,t){let r=this.slots.get(e);if(r)return t(r),()=>{};let s=this.waiters.get(e);return s||this.waiters.set(e,s=new Set),s.add(t),()=>{var i;return(i=this.waiters.get(e))==null?void 0:i.delete(t)}}clear(){this.slots.clear(),this.waiters.clear()}}});var zu={};L(zu,{engageSlots:()=>Pt,hasInAppSlot:()=>so,registerInAppSlot:()=>Vv,slotNameFor:()=>Hr});function Vv(n,e){return!n||!e?()=>{}:(Pt.register(n,e),()=>Pt.unregister(n))}function Hr(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function so(n){let e=Hr(n);return!!e&&!!Pt.get(e)}var Pt,io=k(()=>{"use strict";ro();Pt=new Mt});function Lt(n){var e,t,r,s,i;return n.surface==="banner"?((e=n.surfaceOptions)==null?void 0:e.placement)==="bottom"?"bottom-banner":"top-banner":n.surface==="panel"?((t=n.surfaceOptions)==null?void 0:t.placement)==="left"?"side-left":"side-right":n.surface==="slideover"?((r=n.surfaceOptions)==null?void 0:r.placement)==="left"?"side-left":"side-right":n.surface==="inline"?`inline:${(i=(s=n.surfaceOptions)==null?void 0:s.slot)!=null?i:"default"}`:Yv[n.surface]}function Qv(n){var o,a,c,l,u;let e=[],t=(d,p)=>e.push({path:d,message:p});if(!n||typeof n!="object")return[{path:"",message:"variant is not an object"}];if((!n.id||!Jv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),jv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),Kv.includes(n.priority)||t("priority",`unknown priority "${n.priority}"`),!Array.isArray(n.platforms)||n.platforms.length===0)t("platforms","at least one platform required");else for(let d of n.platforms)Wv.includes(d)||t("platforms",`unknown platform "${d}"`);!Array.isArray(n.blocks)||n.blocks.length===0?t("blocks","at least one block required"):n.blocks.forEach((d,p)=>{(!d||!Xv.includes(d.kind))&&t(`blocks[${p}].kind`,`unknown block kind "${d==null?void 0:d.kind}"`)}),!Array.isArray(n.triggers)||n.triggers.length===0?t("triggers","at least one trigger required"):n.triggers.forEach((d,p)=>{(!d||!Gv.includes(d.type))&&t(`triggers[${p}].type`,`unknown trigger "${d==null?void 0:d.type}"`),((d==null?void 0:d.type)==="element"||(d==null?void 0:d.type)==="hover")&&!d.match&&t(`triggers[${p}].match`,`${d.type} trigger requires a selector`),(d==null?void 0:d.type)==="idle"&&(typeof d.arg!="number"||d.arg<=0)&&t(`triggers[${p}].arg`,"idle trigger requires a positive ms arg")}),["popover","coachmark","hotspot","toolbar"].includes(n.surface)&&((o=n.targeting)!=null&&o.element||((a=n.triggers)!=null?a:[]).some(p=>p.match&&(p.type==="element"||p.type==="hover"))||t("targeting.element",`${n.surface} requires an anchor selector`));let s=(l=(c=n.contract)==null?void 0:c.requiredBlocks)!=null?l:[],i=new Set(((u=n.blocks)!=null?u:[]).map(d=>d==null?void 0:d.kind));for(let d of s)i.has(d)||t("contract.requiredBlocks",`missing required block "${d}"`);return e}function Uu(n){return Qv(n).length===0}var Wv,jv,Kv,Gv,Xv,Yv,oo,ao,Jv,$r=k(()=>{"use strict";Wv=["web","ios","android"],jv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],Kv=["critical","high","normal","low","passive"],Gv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],Xv=["heading","text","richtext","markdown","image","illustration","video","lottie","code","playground","embed","chart","sparkline","stat","table","form","nps","rating","poll","quiz","emoji","steps","checklist","progress","timeline","list","feature-grid","plan-cards","cta","shortcut","avatar","testimonial","social-proof","callout","badge","divider","spacer","countdown","carousel","qr","confetti","product-grid","spinwheel","scratch","slot"],Yv={takeover:"takeover",modal:"modal",banner:"top-banner",toast:"toast",slideover:"side-right",panel:"side-left",popover:"anchored",coachmark:"anchored",tour:"anchored",hotspot:"anchored",toolbar:"anchored",launcher:"launcher",palette:"palette",center:"center",inline:"inline:default",checklist:"launcher"},oo={takeover:"focus-stealing",modal:"focus-stealing",banner:"ambient",toast:"ambient",slideover:"ambient",panel:"ambient",popover:"ambient",coachmark:"ambient",tour:"ambient",hotspot:"ambient",toolbar:"ambient",launcher:"always-available",palette:"on-demand",center:"none",inline:"in-flow",checklist:"ambient"},ao={takeover:5,modal:3,tour:2,banner:1,toast:.5,slideover:0,panel:0,popover:0,coachmark:0,hotspot:0,toolbar:0,inline:0,center:0,launcher:0,palette:0,checklist:0};Jv=/^[a-z0-9][a-z0-9_-]*$/i});var zr,co=k(()=>{"use strict";zr=`
90
+ ${Uv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-label",e.title||"Message"),e.rtl&&p.setAttribute("dir","rtl"),d.appendChild(p),s.appendChild(d);let f=()=>{r.remove(),document.removeEventListener("keydown",h)},m=()=>{t.onDismiss(),f()},h=C=>{C.key==="Escape"&&m()},g=document.createElement("button");if(g.className="x",g.textContent="\xD7",g.setAttribute("aria-label","Close"),g.addEventListener("click",m),p.appendChild(g),e.imageUrl){let C=document.createElement("img");C.src=e.imageUrl,C.alt="",p.appendChild(C)}if(e.title){let C=document.createElement("div");C.className="t",C.textContent=e.title,p.appendChild(C)}let x=document.createElement("div");if(x.className="b",x.textContent=e.body,p.appendChild(x),e.coupon){let C=document.createElement("div");C.className="coupon",C.textContent=e.coupon,p.appendChild(C)}let v=document.createElement("div");if(v.className="acts",e.secondaryCta){let C=document.createElement("button");C.className="sec",C.textContent=e.secondaryCta.label,C.addEventListener("click",m),v.appendChild(C)}if(e.cta){let C=document.createElement("button");C.className="cta",C.textContent=e.cta.label,C.addEventListener("click",()=>{t.onClick(e.cta),f()}),v.appendChild(C)}return v.childNodes.length&&p.appendChild(v),l&&d.addEventListener("click",C=>{C.target===d&&m()}),document.addEventListener("keydown",h),{close:f}}var zv,Ou=k(()=>{"use strict";$();zv=["modal","fullscreen","bottom_sheet"]});function eo(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(Nu,n)}function Bu(n){return eo(n)?Nu[n]:null}function Fu(n){let e=ut(n),r=[e.outcomes,e.rewards,e.segments].flatMap(s=>(Array.isArray(s)?s:[]).map(i=>{var a,c;let o=ut(i);return be((c=(a=o.id)!=null?a:o.value)!=null?c:o.code)}));return[...new Set(r.filter(Boolean))]}function Du(n){var t;let e={campaignId:n.campaignId,gameKey:n.gameKey,attemptId:n.attemptId,attempt:Math.max(1,Math.floor(n.attempt)),...n.payload?{input:n.payload}:{},...(t=n.allowedOutcomeIds)!=null&&t.length?{allowedOutcomeIds:n.allowedOutcomeIds}:{}};switch(n.variantKey){case"spin_wheel":case"scratch_card":case"slot_reward":case"mystery_box":return{...e,variantKey:n.variantKey,action:"play"};case"progress_unlock":case"streak_reward":return{...e,variantKey:n.variantKey,action:"load"};case"daily_check_in":return{...e,variantKey:n.variantKey,action:"check_in"};case"quiz_card":return{...e,variantKey:n.variantKey,action:"submit_quiz"}}}function to(n,e){var f;let t=ut(e);if(be(t.attemptId)!==n.attemptId)throw new Error("Game result attemptId does not match the request");if(t.status==="unavailable")return{attemptId:n.attemptId,status:"unavailable",...typeof t.retryable=="boolean"?{retryable:t.retryable}:{},...be(t.message)?{message:be(t.message)}:{}};if(t.status!=="resolved")throw new Error("Game result status is invalid");let r=ut(t.outcome),s=be(r.id);if(!s)throw new Error("Game result outcome.id is required");let i=be(r.segmentId),o=r.segmentIndex;if(o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0))throw new Error("Game result segmentIndex is invalid");let a=(f=n.allowedOutcomeIds)!=null?f:[],c=typeof o=="number"?a[o]:void 0;if(a.length>0&&!a.includes(i||c||s))throw new Error("Game result is not one of the authored outcomes");let l=Array.isArray(r.symbols)?r.symbols.map(be).filter(Boolean):void 0;if(r.symbols!==void 0&&(!l||l.length===0||l.length>3))throw new Error("Game result symbols are invalid");let u=r.state;if(u!==void 0&&(u===null||typeof u!="object"||Array.isArray(u)))throw new Error("Game result state is invalid");let d=r.value,p=typeof d=="string"||typeof d=="number"||typeof d=="boolean";return{attemptId:n.attemptId,status:"resolved",outcome:{id:s,...be(r.label)?{label:be(r.label)}:{},...i?{segmentId:i}:{},...typeof o=="number"?{segmentIndex:o}:{},...l?{symbols:l}:{},...u?{state:u}:{},...p?{value:d}:{},...be(r.receiptId)?{receiptId:be(r.receiptId)}:{}}}}function qu(n,e){var a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R;let t=ut(e),r=ut((c=(a=t.resultState)!=null?a:t.result)!=null?c:t.reward),s=be((g=(h=(m=(f=(p=(d=(u=(l=t.rewardValue)!=null?l:t.prize)!=null?u:t.rewardResult)!=null?d:t.resultReward)!=null?p:t.reward)!=null?f:r.label)!=null?m:r.title)!=null?h:r.name)!=null?g:t.resultState),i=be((E=(b=(y=(v=(x=t.outcomeId)!=null?x:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?E:r.value),o=null;switch(n.variantKey){case"spin_wheel":{let A=[t.winningIndex,t.resultIndex,t.selectedIndex,r.index].find(D=>typeof D=="number"&&Number.isInteger(D)&&D>=0),O=typeof A=="number"&&Array.isArray(t.segments)?ut(t.segments[A]):{},z=be((R=(M=(C=(S=(I=(w=t.winningId)!=null?w:t.segmentId)!=null?I:r.segmentId)!=null?S:r.id)!=null?C:O.id)!=null?M:O.value)!=null?R:O.code);if(!z&&A===void 0&&!s)return null;o={id:i||z||`preview_segment_${A}`,...s?{label:s}:{},...z?{segmentId:z}:{},...typeof A=="number"?{segmentIndex:A}:{}};break}case"slot_reward":{let A=Array.isArray(t.resultSymbols)?t.resultSymbols.map(be).filter(Boolean):[];if(A.length===0)return null;o={id:i||`preview_${A.join("_")}`,symbols:A,...s?{label:s}:{}};break}case"scratch_card":case"mystery_box":if(!s&&!i)return null;o={id:i||"preview_reward",...s?{label:s}:{}};break;case"progress_unlock":case"streak_reward":case"daily_check_in":o={id:i||"preview_state",...s?{label:s}:{},state:{...t}};break;case"quiz_card":if(!i&&!s)return null;o={id:i||"preview_quiz",...s?{label:s}:{}};break}return to(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function Hu(n,e,t,r){let s=`${e}:${Math.max(1,Math.floor(t))}`,i=n.get(s);if(i)return i;let o=`scalebun_game_${Date.now().toString(36)}_${r().toString(36)}`;return n.set(s,o),o}var Nu,ut,be,no=k(()=>{"use strict";Nu={spin_wheel:"play",scratch_card:"play",slot_reward:"play",mystery_box:"play",progress_unlock:"load",streak_reward:"load",daily_check_in:"check_in",quiz_card:"submit_quiz"},ut=n=>n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},be=n=>typeof n=="string"?n.trim():""});function zu(n){if(!eo(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=Vv(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=Du({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:Hu(t,e,r,()=>Wv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:Fu(n.ext)});if(n.preview){let a=qu(o,n.ext);return a?$u(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?$u(to(o,await n.handler(o))):{ok:!1,message:"Rewards are unavailable right now.",retryable:!1}}catch{return{ok:!1,message:"Rewards are unavailable right now.",retryable:!0}}}}function $u(n){var t;if(n.status==="unavailable")return{ok:!1,...n.message?{message:n.message}:{message:"Rewards are unavailable right now."},retryable:n.retryable!==!1};let e=n.outcome;return{ok:!0,...e.label?{label:e.label}:{},...typeof e.segmentIndex=="number"?{index:e.segmentIndex}:{},...(t=e.symbols)!=null&&t.length?{symbols:e.symbols}:{},...e.state?{state:e.state}:{}}}var Vv,Wv,Uu=k(()=>{"use strict";no();Vv=n=>typeof n=="string"?n.trim():"",Wv=0});var Mt,ro=k(()=>{"use strict";Mt=class{constructor(){this.slots=new Map;this.waiters=new Map}register(e,t){this.slots.set(e,t);let r=this.waiters.get(e);if(r){this.waiters.delete(e);for(let s of r)try{s(t)}catch{}}}unregister(e){this.slots.delete(e)}get(e){return this.slots.get(e)}whenAvailable(e,t){let r=this.slots.get(e);if(r)return t(r),()=>{};let s=this.waiters.get(e);return s||this.waiters.set(e,s=new Set),s.add(t),()=>{var i;return(i=this.waiters.get(e))==null?void 0:i.delete(t)}}clear(){this.slots.clear(),this.waiters.clear()}}});var Vu={};L(Vu,{engageSlots:()=>Pt,hasInAppSlot:()=>so,registerInAppSlot:()=>jv,slotNameFor:()=>Hr});function jv(n,e){return!n||!e?()=>{}:(Pt.register(n,e),()=>Pt.unregister(n))}function Hr(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function so(n){let e=Hr(n);return!!e&&!!Pt.get(e)}var Pt,io=k(()=>{"use strict";ro();Pt=new Mt});function Lt(n){var e,t,r,s,i;return n.surface==="banner"?((e=n.surfaceOptions)==null?void 0:e.placement)==="bottom"?"bottom-banner":"top-banner":n.surface==="panel"?((t=n.surfaceOptions)==null?void 0:t.placement)==="left"?"side-left":"side-right":n.surface==="slideover"?((r=n.surfaceOptions)==null?void 0:r.placement)==="left"?"side-left":"side-right":n.surface==="inline"?`inline:${(i=(s=n.surfaceOptions)==null?void 0:s.slot)!=null?i:"default"}`:Qv[n.surface]}function ew(n){var o,a,c,l,u;let e=[],t=(d,p)=>e.push({path:d,message:p});if(!n||typeof n!="object")return[{path:"",message:"variant is not an object"}];if((!n.id||!Zv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),Gv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),Xv.includes(n.priority)||t("priority",`unknown priority "${n.priority}"`),!Array.isArray(n.platforms)||n.platforms.length===0)t("platforms","at least one platform required");else for(let d of n.platforms)Kv.includes(d)||t("platforms",`unknown platform "${d}"`);!Array.isArray(n.blocks)||n.blocks.length===0?t("blocks","at least one block required"):n.blocks.forEach((d,p)=>{(!d||!Jv.includes(d.kind))&&t(`blocks[${p}].kind`,`unknown block kind "${d==null?void 0:d.kind}"`)}),!Array.isArray(n.triggers)||n.triggers.length===0?t("triggers","at least one trigger required"):n.triggers.forEach((d,p)=>{(!d||!Yv.includes(d.type))&&t(`triggers[${p}].type`,`unknown trigger "${d==null?void 0:d.type}"`),((d==null?void 0:d.type)==="element"||(d==null?void 0:d.type)==="hover")&&!d.match&&t(`triggers[${p}].match`,`${d.type} trigger requires a selector`),(d==null?void 0:d.type)==="idle"&&(typeof d.arg!="number"||d.arg<=0)&&t(`triggers[${p}].arg`,"idle trigger requires a positive ms arg")}),["popover","coachmark","hotspot","toolbar"].includes(n.surface)&&((o=n.targeting)!=null&&o.element||((a=n.triggers)!=null?a:[]).some(p=>p.match&&(p.type==="element"||p.type==="hover"))||t("targeting.element",`${n.surface} requires an anchor selector`));let s=(l=(c=n.contract)==null?void 0:c.requiredBlocks)!=null?l:[],i=new Set(((u=n.blocks)!=null?u:[]).map(d=>d==null?void 0:d.kind));for(let d of s)i.has(d)||t("contract.requiredBlocks",`missing required block "${d}"`);return e}function Wu(n){return ew(n).length===0}var Kv,Gv,Xv,Yv,Jv,Qv,oo,ao,Zv,$r=k(()=>{"use strict";Kv=["web","ios","android"],Gv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],Xv=["critical","high","normal","low","passive"],Yv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],Jv=["heading","text","richtext","markdown","image","illustration","video","lottie","code","playground","embed","chart","sparkline","stat","table","form","nps","rating","poll","quiz","emoji","steps","checklist","progress","timeline","list","feature-grid","plan-cards","cta","shortcut","avatar","testimonial","social-proof","callout","badge","divider","spacer","countdown","carousel","qr","confetti","product-grid","spinwheel","scratch","slot"],Qv={takeover:"takeover",modal:"modal",banner:"top-banner",toast:"toast",slideover:"side-right",panel:"side-left",popover:"anchored",coachmark:"anchored",tour:"anchored",hotspot:"anchored",toolbar:"anchored",launcher:"launcher",palette:"palette",center:"center",inline:"inline:default",checklist:"launcher"},oo={takeover:"focus-stealing",modal:"focus-stealing",banner:"ambient",toast:"ambient",slideover:"ambient",panel:"ambient",popover:"ambient",coachmark:"ambient",tour:"ambient",hotspot:"ambient",toolbar:"ambient",launcher:"always-available",palette:"on-demand",center:"none",inline:"in-flow",checklist:"ambient"},ao={takeover:5,modal:3,tour:2,banner:1,toast:.5,slideover:0,panel:0,popover:0,coachmark:0,hotspot:0,toolbar:0,inline:0,center:0,launcher:0,palette:0,checklist:0};Zv=/^[a-z0-9][a-z0-9_-]*$/i});var zr,co=k(()=>{"use strict";zr=`
91
91
  /* Text must be BREAKABLE. Real in-app copy carries runs with no space in them \u2014 a support URL, a
92
92
  deploy hash, a pasted id, a German compound \u2014 and nothing here could break one, so it ran
93
93
  straight out of its container. Sweeping the catalog with a single long URL took the count from 6
@@ -305,7 +305,7 @@ ${$v(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
305
305
  .scalebun-poll-pct{ position:relative; z-index:1; font-size:12px; color:var(--scalebun-muted); }
306
306
  .scalebun-quiz-opt.correct{ border-color:#2fa96b; background:color-mix(in srgb, #2fa96b 14%, transparent); }
307
307
  .scalebun-quiz-opt.incorrect{ border-color:#e0483d; background:color-mix(in srgb, #e0483d 14%, transparent); }
308
- `});var Vu,Wu=k(()=>{"use strict";Vu=`
308
+ `});var ju,Ku=k(()=>{"use strict";ju=`
309
309
  /* shared close button */
310
310
  .scalebun-x{ background:none; border:0; color:var(--scalebun-muted); cursor:pointer; font-size:16px; line-height:1;
311
311
  padding:4px 6px; border-radius:6px; }
@@ -533,9 +533,9 @@ ${$v(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
533
533
  .scalebun-launcher-item{ text-align:left; background:none; border:0; color:var(--scalebun-fg); cursor:pointer; font:inherit;
534
534
  font-size:13.5px; padding:9px 12px; border-radius:8px; }
535
535
  .scalebun-launcher-item:hover{ background:color-mix(in srgb, var(--scalebun-fg) 7%, transparent); }
536
- `});var ju,lo,Ku,Gu,Xu,Yu,Ju,Qu,Zu=k(()=>{"use strict";ju=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),lo=n=>Array.isArray(n)?n:[],Ku=n=>lo(n).map(e=>typeof e=="string"?{id:e,label:e}:e),Gu=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-nps";for(let r=0;r<=10;r++){let s=e.doc.createElement("button");s.type="button",s.className="scalebun-nps-btn",s.textContent=String(r),s.addEventListener("click",()=>{var i;return(i=e.onInteraction)==null?void 0:i.call(e,`nps:${r}`)}),t.appendChild(s)}return t},Xu=(n,e)=>{var s;let t=Number((s=n.props)==null?void 0:s.max)||5,r=e.doc.createElement("div");r.className="scalebun-rating";for(let i=1;i<=t;i++){let o=e.doc.createElement("button");o.type="button",o.className="scalebun-star",o.setAttribute("aria-label",`${i} of ${t}`),o.textContent="\u2605",o.addEventListener("click",()=>{var a;Array.from(r.children).forEach((c,l)=>c.classList.toggle("on",l<i)),(a=e.onInteraction)==null||a.call(e,`rating:${i}`)}),r.appendChild(o)}return r},Yu=(n,e)=>{var s,i;let t=lo((s=n.props)==null?void 0:s.emojis).length?lo((i=n.props)==null?void 0:i.emojis):["\u{1F61E}","\u{1F610}","\u{1F642}","\u{1F604}"],r=e.doc.createElement("div");r.className="scalebun-emoji";for(let o of t){let a=e.doc.createElement("button");a.type="button",a.className="scalebun-emoji-btn",a.textContent=o,a.addEventListener("click",()=>{var c;return(c=e.onInteraction)==null?void 0:c.call(e,`emoji:${o}`)}),r.appendChild(a)}return r},Ju=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=ju((o=n.props)==null?void 0:o.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(c=(a=n.props)==null?void 0:a.results)!=null?c:void 0,i=s?Object.values(s).reduce((d,p)=>d+p,0)||1:0;for(let d of Ku((l=n.props)==null?void 0:l.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-poll-opt";let f=e.doc.createElement("span");if(f.className="scalebun-poll-label",f.textContent=d.label,p.appendChild(f),s){let m=Math.round(((u=s[d.id])!=null?u:0)/i*100),h=e.doc.createElement("span");h.className="scalebun-poll-bar",h.style.width=`${m}%`;let g=e.doc.createElement("span");g.className="scalebun-poll-pct",g.textContent=`${m}%`,p.append(h,g),p.disabled=!0}p.addEventListener("click",()=>{var m;return(m=e.onInteraction)==null?void 0:m.call(e,`poll_vote:${d.id}`)}),t.appendChild(p)}return t},Qu=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=ju((c=n.props)==null?void 0:c.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(l=n.props)==null?void 0:l.outcome,i=new Map,o=!1,a=(d,p)=>{for(let[f,m]of i)m.disabled=!0,p&&f===p?m.classList.add("correct"):f===d&&f!==p&&m.classList.add("incorrect")};for(let d of Ku((u=n.props)==null?void 0:u.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-quiz-opt",p.textContent=d.label,i.set(d.id,p),p.addEventListener("click",()=>{var f;if((f=e.onInteraction)==null||f.call(e,`quiz_answer:${d.id}`),!(!e.requestOutcome||o)){o=!0;for(let m of i.values())m.disabled=!0;e.requestOutcome(1,{answeredId:d.id}).then(m=>{var g,x;if(!m.ok){o=!1;for(let y of i.values())y.disabled=!1;let v=e.doc.createElement("div");v.className="scalebun-quiz-note",v.textContent=(g=m.message)!=null?g:"Could not check that answer.",t.appendChild(v);return}let h=(x=m.state)!=null?x:{};a(d.id,typeof h.correctId=="string"?h.correctId:void 0)})}}),t.appendChild(p)}return s!=null&&s.answeredId&&a(s.answeredId,s.correctId),t}});function tp(n,e,t){e.split(`
537
- `).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function Vr(n,e){let t=[];for(let r of n){let s=Ur[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,Zv,ew,tw,ep,nw,rw,sw,iw,ow,aw,cw,lw,dw,Ur,Wr=k(()=>{"use strict";Zu();ye=(n,e="")=>typeof n=="string"?n:n==null?e:String(n);ve=(n,e,t)=>{let r=n.createElement(e);return r.className=t,r},Zv=(n,e)=>{var r;let t=ve(e.doc,"h2","scalebun-h");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},ew=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return tp(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},tw=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return tp(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},ep=(n,e)=>{var s,i;let t=e.doc.createElement("img");t.className="scalebun-img";let r=ye((s=n.props)==null?void 0:s.src);return r?(t.src=r,t.alt=ye((i=n.props)==null?void 0:i.alt),t.loading="lazy",t.decoding="async",t):null},nw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-checklist");return r.setAttribute("role","list"),t.forEach((i,o)=>{var f,m;let a=i&&typeof i=="object"?i:{},c=typeof i=="string"?i:ye((m=(f=a.label)!=null?f:a.text)!=null?m:a.title),l=a.done===!0||a.checked===!0||a.complete===!0,u=e.doc.createElement("li");u.className="scalebun-checklist-item",u.setAttribute("data-done",l?"true":"false");let d=e.doc.createElement("span");d.className="scalebun-checklist-mark",d.setAttribute("aria-hidden","true"),d.textContent=l?"\u2713":"";let p=e.doc.createElement("span");p.className="scalebun-checklist-label",p.textContent=c,u.appendChild(d),u.appendChild(p),u.setAttribute("aria-label",`${c} \u2014 ${l?"done":"not done"}`),u.addEventListener("click",()=>{var h;return(h=e.onInteraction)==null?void 0:h.call(e,`checklist_item:${o}`)}),r.appendChild(u)}),r},rw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-list");return t.forEach((i,o)=>{var l;let a=e.doc.createElement("li"),c=typeof i=="string"?i:ye((l=i==null?void 0:i.text)!=null?l:i==null?void 0:i.label);a.textContent=c,a.addEventListener("click",()=>{var u;return(u=e.onInteraction)==null?void 0:u.call(e,`list_item:${o}`)}),r.appendChild(a)}),r},sw=(n,e)=>{var s,i;let t=ve(e.doc,"div","scalebun-callout");if((s=n.props)!=null&&s.icon){let o=ve(e.doc,"span","scalebun-callout-ic");o.textContent=ye(n.props.icon),t.appendChild(o)}let r=ve(e.doc,"span","scalebun-callout-t");return r.textContent=ye((i=n.props)==null?void 0:i.text),t.appendChild(r),t},iw=(n,e)=>{var r;let t=ve(e.doc,"span","scalebun-badge");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},ow=(n,e)=>{var i;let t=Math.max(0,Math.min(100,Number((i=n.props)==null?void 0:i.value)||0)),r=ve(e.doc,"div","scalebun-progress"),s=ve(e.doc,"div","scalebun-progress-fill");return s.style.width=`${t}%`,r.appendChild(s),r},aw=(n,e)=>ve(e.doc,"hr","scalebun-divider"),cw=(n,e)=>{var s;let t=ve(e.doc,"div","scalebun-spacer"),r=Number((s=n.props)==null?void 0:s.height);return!Number.isNaN(r)&&r>0&&(t.style.height=`${r}px`),t},lw=new Set(["primary","secondary","link","ghost","dismiss"]),dw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.actions)?n.props.actions:[];if(t.length===0)return null;let r=ve(e.doc,"div","scalebun-cta-row");for(let i of t){let o=lw.has(ye(i.variant))?ye(i.variant):"primary",a=e.doc.createElement("button");a.type="button",a.className=`scalebun-btn scalebun-btn-${o}`,a.textContent=ye(i.label,"OK"),a.setAttribute("data-action",ye(i.action,"dismiss")),a.addEventListener("click",()=>e.onAction({...i,variant:o})),r.appendChild(a)}return r},Ur={heading:Zv,text:ew,richtext:tw,image:ep,illustration:ep,list:rw,checklist:nw,callout:sw,badge:iw,progress:ow,divider:aw,spacer:cw,cta:dw,nps:Gu,rating:Xu,emoji:Yu,poll:Ju,quiz:Qu}});async function np(n){var e;try{if(typeof navigator!="undefined"&&((e=navigator.clipboard)!=null&&e.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{if(typeof document=="undefined")return!1;let t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),t.select();let r=typeof document.execCommand=="function"?document.execCommand("copy"):!1;return t.remove(),r}catch{return!1}}var rp=k(()=>{"use strict"});function uo(n){return{doc:n.doc,onInteraction:e=>n.hooks.onInteraction(e),...n.hooks.requestOutcome?{requestOutcome:n.hooks.requestOutcome}:{},onAction:e=>{if(e.action==="dismiss"){n.requestClose("cta");return}if(n.hooks.onCtaClick(e.action),e.action==="copy"&&e.deepLink){np(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return Vr(n.variant.blocks,uo(n))}function jr(n,e,t=1e3){let r=!1,s=null,i=null,o=()=>{s!=null&&(clearTimeout(s),s=null)},a=()=>{r||(r=!0,o(),i==null||i.disconnect(),e())},c=()=>{s==null&&!r&&(s=setTimeout(a,t))};return typeof IntersectionObserver=="undefined"?(c(),()=>o()):(i=new IntersectionObserver(l=>{for(let u of l)u.isIntersecting&&u.intersectionRatio>=.5?c():o()},{threshold:[0,.5,1]}),i.observe(n),()=>{o(),i==null||i.disconnect()})}var Te=k(()=>{"use strict";Wr();rp()});function sp(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",zr),n.addStyles("scalebun-surfaces",Vu);let i=n.zone(Lt(e)),o=i.ownerDocument,a=null,c=()=>{},l=!1,u=f=>{l||!a||(l=!0,c(),r.onDismiss(f),a.destroy())};return a=t({variant:e,host:n,doc:o,hooks:r,requestClose:u,metrics:s}),i.appendChild(a.el),(p=a.afterMount)==null||p.call(a),r.onImpression(),c=jr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var ip=k(()=>{"use strict";$r();co();Wu();Te()});var op={};L(op,{markdownRenderer:()=>uw});function po(n,e){var o;let t=[],r=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g,s=0,i;for(;i=r.exec(n);){if(i.index>s&&t.push(e.createTextNode(n.slice(s,i.index))),i[2])t.push(fo(e,"strong",i[2]));else if(i[4])t.push(fo(e,"em",i[4]));else if(i[6])t.push(fo(e,"code",i[6]));else if(i[8]){let a=e.createElement("a");a.textContent=i[8];let c=(o=i[9])!=null?o:"";/^(https?:|\/|#|mailto:)/i.test(c)&&(a.href=c,a.rel="noopener noreferrer",a.target="_blank"),t.push(a)}s=r.lastIndex}return s<n.length&&t.push(e.createTextNode(n.slice(s))),t}function fo(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var uw,ap=k(()=>{"use strict";uw=(n,e)=>{var i,o;let t=typeof((i=n.props)==null?void 0:i.text)=="string"?n.props.text:typeof((o=n.props)==null?void 0:o.markdown)=="string"?n.props.markdown:"",r=e.doc.createElement("div");r.className="scalebun-md";let s=null;for(let a of t.split(`
538
- `)){let c=a.trimEnd(),l=c.match(/^(#{1,4})\s+(.*)$/),u=c.match(/^\s*[-*]\s+(.*)$/);if(l){s=null;let d=e.doc.createElement(`h${l[1].length}`);d.className="scalebun-md-h",po(l[2],e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else if(u){s||(s=e.doc.createElement("ul"),s.className="scalebun-md-ul",r.appendChild(s));let d=e.doc.createElement("li");po(u[1],e.doc).forEach(p=>d.appendChild(p)),s.appendChild(d)}else if(c){s=null;let d=e.doc.createElement("p");d.className="scalebun-md-p",po(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var cp={};L(cp,{codeRenderer:()=>pw});var pw,lp=k(()=>{"use strict";pw=(n,e)=>{var u,d,p;let t=typeof((u=n.props)==null?void 0:u.code)=="string"?n.props.code:typeof((d=n.props)==null?void 0:d.text)=="string"?n.props.text:"",r=typeof((p=n.props)==null?void 0:p.language)=="string"?n.props.language:"",s=e.doc.createElement("div");s.className="scalebun-code";let i=e.doc.createElement("div");i.className="scalebun-code-bar";let o=e.doc.createElement("span");o.className="scalebun-code-lang",o.textContent=r||"code";let a=e.doc.createElement("button");a.type="button",a.className="scalebun-code-copy",a.textContent="Copy",a.addEventListener("click",async()=>{var m,h,g;let f=!1;try{typeof navigator!="undefined"&&navigator.clipboard&&(await navigator.clipboard.writeText(t),f=!0)}catch{f=!1}if(!f){let x=e.doc.createRange();x.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(x)}a.textContent=f?"Copied":"Select all",(g=e.onInteraction)==null||g.call(e,"code_copy"),setTimeout(()=>a.textContent="Copy",1500)}),i.append(o,a);let c=e.doc.createElement("pre");c.className="scalebun-code-pre";let l=e.doc.createElement("code");return l.textContent=t,c.appendChild(l),s.append(i,c),s}});var Kr={};L(Kr,{chartRenderer:()=>hw,sparklineRenderer:()=>fw,statRenderer:()=>mw});function up(n,e,t){let r=n.createElementNS(mo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var mo,dp,fw,mw,hw,Gr=k(()=>{"use strict";mo="http://www.w3.org/2000/svg",dp=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];fw=(n,e)=>{var p;let t=dp((p=n.props)==null?void 0:p.values),r=e.doc.createElement("div");if(r.className="scalebun-spark",t.length<2)return r;let s=160,i=40,o=Math.min(...t),c=Math.max(...t)-o||1,l=t.map((f,m)=>`${m/(t.length-1)*s},${i-(f-o)/c*(i-4)-2}`).join(" "),u=up(e.doc,s,i),d=e.doc.createElementNS(mo,"polyline");return d.setAttribute("points",l),d.setAttribute("fill","none"),d.setAttribute("stroke","var(--scalebun-accent)"),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linejoin","round"),u.appendChild(d),r.appendChild(u),r},mw=(n,e)=>{var i,o,a,c;let t=e.doc.createElement("div");t.className="scalebun-stat";let r=e.doc.createElement("div");if(r.className="scalebun-stat-value",r.textContent=String((o=(i=n.props)==null?void 0:i.value)!=null?o:"\u2014"),t.appendChild(r),((a=n.props)==null?void 0:a.label)!=null){let l=e.doc.createElement("div");l.className="scalebun-stat-label",l.textContent=String(n.props.label),t.appendChild(l)}let s=(c=n.props)==null?void 0:c.delta;if(s!=null){let l=e.doc.createElement("div"),u=Number(s);l.className="scalebun-stat-delta "+(u>=0?"up":"down"),l.textContent=`${u>=0?"\u25B2":"\u25BC"} ${Math.abs(u)}`,t.appendChild(l)}return t},hw=(n,e)=>{var l;let t=dp((l=n.props)==null?void 0:l.values),r=e.doc.createElement("div");if(r.className="scalebun-chart",t.length===0)return r;let s=240,i=100,o=Math.max(...t)||1,a=s/t.length,c=up(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(mo,"rect"),f=u/o*(i-4);p.setAttribute("x",String(d*a+2)),p.setAttribute("y",String(i-f)),p.setAttribute("width",String(a-4)),p.setAttribute("height",String(f)),p.setAttribute("rx","2"),p.setAttribute("fill","var(--scalebun-accent)"),c.appendChild(p)}),r.appendChild(c),r}});var pp={};L(pp,{tableRenderer:()=>gw});var gw,fp=k(()=>{"use strict";gw=(n,e)=>{var o,a;let t=Array.isArray((o=n.props)==null?void 0:o.columns)?n.props.columns.map(String):[],r=Array.isArray((a=n.props)==null?void 0:a.rows)?n.props.rows:[],s=e.doc.createElement("table");if(s.className="scalebun-table",t.length){let c=e.doc.createElement("thead"),l=e.doc.createElement("tr");for(let u of t){let d=e.doc.createElement("th");d.textContent=u,l.appendChild(d)}c.appendChild(l),s.appendChild(c)}let i=e.doc.createElement("tbody");for(let c of r){let l=e.doc.createElement("tr");for(let u of Array.isArray(c)?c:[c]){let d=e.doc.createElement("td");d.textContent=u==null?"":String(u),l.appendChild(d)}i.appendChild(l)}return s.appendChild(i),s}});var mp={};L(mp,{videoRenderer:()=>bw});var bw,hp=k(()=>{"use strict";bw=(n,e)=>{var c,l;let t=typeof((c=n.props)==null?void 0:c.src)=="string"?n.props.src:"",r=typeof((l=n.props)==null?void 0:l.poster)=="string"?n.props.poster:"",s=e.doc.createElement("div");if(s.className="scalebun-video",!t)return s;let i=()=>{var d;s.replaceChildren();let u=e.doc.createElement("video");u.className="scalebun-video-el",u.src=t,u.controls=!0,u.autoplay=!0,u.playsInline=!0,s.appendChild(u),(d=e.onInteraction)==null||d.call(e,"video_play")},o=e.doc.createElement("button");if(o.type="button",o.className="scalebun-video-poster",o.setAttribute("aria-label","Play video"),r){let u=e.doc.createElement("img");u.src=r,u.alt="",u.loading="lazy",o.appendChild(u)}let a=e.doc.createElement("span");return a.className="scalebun-video-play",a.textContent="\u25B6",o.appendChild(a),o.addEventListener("click",i),s.appendChild(o),s}});var gp={};L(gp,{countdownRenderer:()=>vw});function yw(n,e){let t=n==null?void 0:n.target;if(typeof t=="number")return t;if(typeof t=="string"){let s=Date.parse(t);if(!Number.isNaN(s))return s}let r=Number(n==null?void 0:n.durationMs);return e+(Number.isFinite(r)&&r>0?r:24*36e5)}var Xr,vw,bp=k(()=>{"use strict";Xr=n=>String(Math.max(0,n)).padStart(2,"0"),vw=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=yw(n.props,r()),i=[];for(let a of["Days","Hrs","Min","Sec"]){let c=e.doc.createElement("div");c.className="scalebun-cd-cell";let l=e.doc.createElement("div");l.className="scalebun-cd-num",l.textContent="00";let u=e.doc.createElement("div");u.className="scalebun-cd-lab",u.textContent=a,c.append(l,u),t.appendChild(c),i.push([a,l])}let o=()=>{let a=Math.max(0,s-r()),c=Math.floor(a/864e5);a-=c*864e5;let l=Math.floor(a/36e5);a-=l*36e5;let u=Math.floor(a/6e4);a-=u*6e4;let d=Math.floor(a/1e3);i[0][1].textContent=Xr(c),i[1][1].textContent=Xr(l),i[2][1].textContent=Xr(u),i[3][1].textContent=Xr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var yp={};L(yp,{carouselRenderer:()=>ww});var ho,ww,vp=k(()=>{"use strict";ho=n=>typeof n=="string"&&n?n:void 0,ww=(n,e)=>{var c,l;let t=Array.isArray((c=n.props)==null?void 0:c.slides)?n.props.slides:[],r=e.doc.createElement("div");if(r.className="scalebun-carousel",t.length===0)return r;let s=e.doc.createElement("div");s.className="scalebun-car-track";let i=[];for(let u of t){let d=e.doc.createElement("div");d.className="scalebun-car-slide";let p=ho(u.image);if(p){let f=e.doc.createElement("img");f.className="scalebun-car-img",f.src=p,f.alt="",f.loading="lazy",d.appendChild(f)}if(ho(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(ho(u.text)){let f=e.doc.createElement("div");f.className="scalebun-car-text",f.textContent=u.text,d.appendChild(f)}s.appendChild(d),i.push(d)}r.appendChild(s);let o=e.doc.createElement("div");o.className="scalebun-car-dots";let a=t.map((u,d)=>{let p=e.doc.createElement("button");return p.type="button",p.className="scalebun-car-dot"+(d===0?" on":""),p.setAttribute("aria-label",`Slide ${d+1}`),p.addEventListener("click",()=>i[d].scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})),o.appendChild(p),p});if(r.appendChild(o),typeof IntersectionObserver!="undefined"){let u=new IntersectionObserver(d=>{for(let p of d)if(p.isIntersecting){let f=i.indexOf(p.target);a.forEach((m,h)=>m.classList.toggle("on",h===f))}},{root:s,threshold:.6});i.forEach(d=>u.observe(d))}return(l=e.onInteraction)==null||l.call(e,"carousel_view"),r}});var wp={};L(wp,{productGridRenderer:()=>xw});var Yr,xw,xp=k(()=>{"use strict";Yr=n=>n==null?void 0:String(n),xw=(n,e)=>{var s,i;let t=Array.isArray((s=n.props)==null?void 0:s.products)?n.props.products:Array.isArray((i=n.props)==null?void 0:i.items)?n.props.items:[],r=e.doc.createElement("div");return r.className="scalebun-pgrid",t.length===0||t.forEach((o,a)=>{var d;let c=e.doc.createElement("button");c.type="button",c.className="scalebun-pcard";let l=Yr(o.image);if(l){let p=e.doc.createElement("img");p.className="scalebun-pcard-img",p.src=l,p.alt="",p.loading="lazy",c.appendChild(p)}if(o.badge){let p=e.doc.createElement("span");p.className="scalebun-pcard-badge",p.textContent=Yr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=Yr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=Yr(o.price),c.appendChild(p)}c.addEventListener("click",()=>{var p,f;return(f=e.onInteraction)==null?void 0:f.call(e,`product_select:${(p=o.id)!=null?p:a}`)}),r.appendChild(c)}),r}});var kp={};L(kp,{confettiRenderer:()=>kw});function Sw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Sp,kw,Ep=k(()=>{"use strict";Sp=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];kw=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",Sw()||typeof requestAnimationFrame=="undefined")return t.classList.add("scalebun-confetti-static"),t.textContent="\u{1F389}",t;let r=e.doc.createElement("canvas");r.className="scalebun-confetti-canvas",t.appendChild(r);let s=r.getContext("2d");if(!s)return t;let i=Math.min(240,Math.max(40,Number((d=n.props)==null?void 0:d.count)||140)),o=[],a=()=>{let f=r.width;o=Array.from({length:i},(m,h)=>({x:f/2+(h-i/2),y:r.height*.25,vx:(h%20-10)*.6,vy:-4-h%7,rot:h,vr:(h%5-2)*.3,c:Sp[h%Sp.length],s:5+h%4}))};(()=>{var m;let f=(m=t.parentElement)!=null?m:t;r.width=f.clientWidth||360,r.height=f.clientHeight||240})(),a();let l=0,u=()=>{if(!t.isConnected)return;s.clearRect(0,0,r.width,r.height);let f=0;for(let m of o)m.vy+=.16,m.x+=m.vx,m.y+=m.vy,m.rot+=m.vr,m.y<r.height+12&&f++,s.save(),s.translate(m.x,m.y),s.rotate(m.rot),s.fillStyle=m.c,s.fillRect(-m.s/2,-m.s/2,m.s,m.s*.6),s.restore();l++,f>0&&l<240?requestAnimationFrame(u):s.clearRect(0,0,r.width,r.height)};return requestAnimationFrame(u),(p=e.onInteraction)==null||p.call(e,"celebration"),t}});function _t(n,e,t,r={}){var o,a,c;(o=n.querySelector(".scalebun-game-note"))==null||o.remove();let s=e.createElement("div");s.className="scalebun-game-note",s.setAttribute("role","status");let i=e.createElement("span");if(i.textContent=(a=t.message)!=null?a:"Rewards are unavailable right now.",s.appendChild(i),t.retryable&&r.onRetry){let l=e.createElement("button");l.type="button",l.className="scalebun-game-retry",l.textContent=(c=r.retryLabel)!=null?c:"Try again",l.addEventListener("click",()=>{var u;s.remove(),(u=r.onRetry)==null||u.call(r)},{once:!0}),s.appendChild(l)}n.appendChild(s)}function Ot(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Jr=k(()=>{"use strict"});var Ap={};L(Ap,{spinwheelRenderer:()=>Cw});function bo(n,e,t,r){let s=(r-90)*Math.PI/180;return{x:n+t*Math.cos(s),y:e+t*Math.sin(s)}}function Iw(n,e,t,r,s){let i=bo(n,e,t,s),o=bo(n,e,t,r),a=s-r<=180?0:1;return`M ${n} ${e} L ${i.x} ${i.y} A ${t} ${t} 0 ${a} 0 ${o.x} ${o.y} Z`}function Cp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Ip,Ew,go,Cw,Rp=k(()=>{"use strict";Jr();Ip=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],Ew=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};go="http://www.w3.org/2000/svg",Cw=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(Ew).filter(Boolean),r=t.length?t:["10% off","Free ship","Try again","20% off","$5 credit","Jackpot"],s=r.length,i=Math.max(0,Math.min(s-1,Number((y=n.props)==null?void 0:y.resultIndex)||0)),o=e.doc.createElement("div");o.className="scalebun-wheel";let a=220,c=a/2,l=a/2-4,u=360/s,d=e.doc.createElementNS(go,"svg");d.setAttribute("viewBox",`0 0 ${a} ${a}`),d.setAttribute("width",String(a)),d.setAttribute("height",String(a)),d.setAttribute("class","scalebun-wheel-svg"),r.forEach((b,E)=>{let w=e.doc.createElementNS(go,"path");w.setAttribute("d",Iw(c,c,l,E*u,(E+1)*u)),w.setAttribute("fill",Ip[E%Ip.length]),d.appendChild(w);let I=bo(c,c,l*.62,E*u+u/2),S=e.doc.createElementNS(go,"text");S.setAttribute("x",String(I.x)),S.setAttribute("y",String(I.y)),S.setAttribute("fill","#fff"),S.setAttribute("font-size","10"),S.setAttribute("text-anchor","middle"),S.setAttribute("transform",`rotate(${E*u+u/2} ${I.x} ${I.y})`),S.textContent=b.slice(0,12),d.appendChild(S)});let p=e.doc.createElement("div");p.className="scalebun-wheel-pointer";let f=e.doc.createElement("button");f.type="button",f.className="scalebun-wheel-spin",f.textContent="SPIN";let m=!1,h=b=>360*5-(b*u+u/2),g=(b,E)=>{var S;let w=((S=E!=null?E:r[b])!=null?S:"").slice(0,14);if(Cp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=w;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let I=()=>{f.textContent=w};d.addEventListener("transitionend",I,{once:!0}),setTimeout(I,3600)},x=b=>{m=!0,f.disabled=!0,Ot(o),Cp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(E=>{var I,S,C;if(!E.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,_t(o,e.doc,E,{onRetry:()=>x(b+1)}),(I=e.onInteraction)==null||I.call(e,"spin_unavailable");return}let w=Math.max(0,Math.min(s-1,Number((S=E.index)!=null?S:0)));(C=e.onInteraction)==null||C.call(e,`spin:${w}`),g(w,E.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){x(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var Mp={};L(Mp,{scratchRenderer:()=>Aw});function Tp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Aw,Pp=k(()=>{"use strict";Jr();Aw=(n,e)=>{var x,v;let t=typeof((x=n.props)==null?void 0:x.prize)=="string"?n.props.prize:"You won a prize!",r=((v=n.props)==null?void 0:v.reveal)==="box",s=e.doc.createElement("div");s.className=r?"scalebun-scratch scalebun-scratch-box":"scalebun-scratch";let i=e.doc.createElement("div");i.className="scalebun-scratch-prize",i.textContent=t,s.appendChild(i);let o=!1,a=()=>{o||!e.requestOutcome||(o=!0,e.requestOutcome(1).then(y=>{var b;if(y.ok){Ot(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",_t(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(Tp())return s;let y=e.doc.createElement("button");return y.type="button",y.className="scalebun-scratch-lid",y.setAttribute("aria-label","Open the mystery box"),y.textContent="\u{1F381}",y.addEventListener("click",()=>{var b;a(),y.setAttribute("data-open","true"),setTimeout(()=>y.remove(),320),(b=e.onInteraction)==null||b.call(e,"mystery_box_opened")},{once:!0}),s.appendChild(y),s}let c=e.doc.createElement("canvas");c.className="scalebun-scratch-cover";let l=c.getContext("2d");if(Tp()||!l)return c.remove(),s;s.appendChild(c);let u=300,d=90;c.width=u,c.height=d,l.fillStyle="#9aa3b2",l.fillRect(0,0,u,d),l.fillStyle="#6b7280",l.font="13px sans-serif",l.textAlign="center",l.fillText("Scratch here",u/2,d/2+4),l.globalCompositeOperation="destination-out";let p=!1,f=!1,m=(y,b)=>{l.beginPath(),l.arc(y,b,16,0,Math.PI*2),l.fill()},h=y=>{let b=c.getBoundingClientRect();return{x:(y.clientX-b.left)/b.width*u,y:(y.clientY-b.top)/b.height*d}},g=y=>{var E;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))};return c.addEventListener("mousedown",y=>{p=!0;let b=h(y);m(b.x,b.y)}),e.doc.addEventListener("mouseup",()=>p=!1),c.addEventListener("mousemove",g),c.addEventListener("touchmove",y=>{var E;let b=y.touches[0];if(b){let w=h(b);m(w.x,w.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))}}),s}});var Lp={};L(Lp,{slotRenderer:()=>Mw});function Tw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Rw,Mw,_p=k(()=>{"use strict";Jr();Rw=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Mw=(n,e)=>{var p,f,m;let t=(Array.isArray((p=n.props)==null?void 0:p.symbols)?n.props.symbols.map(String):[]).filter(Boolean),r=t.length?t:Rw,s=Array.isArray((f=n.props)==null?void 0:f.result)?n.props.result.slice(0,3).map(String):[r[0],r[0],r[0]],i=e.doc.createElement("div");i.className="scalebun-slot";let o=e.doc.createElement("div");o.className="scalebun-slot-reels";let a=[];for(let h=0;h<3;h++){let g=e.doc.createElement("div");g.className="scalebun-slot-reel";let x=e.doc.createElement("div");x.className="scalebun-slot-strip";for(let v of[...r,...r,(m=s[h])!=null?m:r[0]]){let y=e.doc.createElement("div");y.className="scalebun-slot-cell",y.textContent=v,x.appendChild(y)}g.appendChild(x),a.push(x),o.appendChild(g)}i.appendChild(o);let c=e.doc.createElement("button");c.type="button",c.className="scalebun-slot-spin scalebun-btn scalebun-btn-primary",c.textContent="Spin";let l=!1,u=()=>{a.forEach((g,x)=>{let v=(g.children.length-1)*44;Tw()||(g.style.transition=`transform ${1.6+x*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,Ot(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,_t(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let x=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((E,w)=>{var S,C;let I=E.children[E.children.length-1];I&&(I.textContent=(C=(S=x[w])!=null?S:s[w])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${x.join("")}`),u()})};return c.addEventListener("click",()=>{var h;if(!l){if(e.requestOutcome){d(1);return}l=!0,(h=e.onInteraction)==null||h.call(e,`slot:${s.join("")}`),u()}}),i.appendChild(c),i}});var Op={};L(Op,{qrRenderer:()=>Ow});function Pw(n,e,t){let r=2166136261^e*73856093^t*19349663;for(let s=0;s<n.length;s++)r=(r^n.charCodeAt(s))*16777619;return((r>>>13^r)&1)===1}function Lw(n,e){let t=(r,s)=>n>=r&&n<r+7&&e>=s&&e<s+7;return t(0,0)||t(18,0)||t(0,18)}function _w(n,e){let t=n<7?n:n>=18?n-18:-1,r=e<7?e:e>=18?e-18:-1;if(t<0||r<0)return!1;let s=t===0||t===6||r===0||r===6,i=t>=2&&t<=4&&r>=2&&r<=4;return s||i}var yo,Ow,Np=k(()=>{"use strict";yo="http://www.w3.org/2000/svg";Ow=(n,e)=>{var d;let t=typeof((d=n.props)==null?void 0:d.value)=="string"&&n.props.value?n.props.value:"https://app.example.com",r=e.doc.createElement("div");r.className="scalebun-qr";let s=160,i=2,o=25+i*2,a=s/o,c=e.doc.createElementNS(yo,"svg");c.setAttribute("viewBox",`0 0 ${s} ${s}`),c.setAttribute("width",String(s)),c.setAttribute("height",String(s)),c.setAttribute("class","scalebun-qr-svg");let l=e.doc.createElementNS(yo,"rect");l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("fill","#ffffff"),c.appendChild(l);for(let p=0;p<25;p++)for(let f=0;f<25;f++){let m;if(Lw(f,p)?m=_w(f,p):f===6||p===6?m=(f+p)%2===0:m=Pw(t,f,p),!m)continue;let h=e.doc.createElementNS(yo,"rect");h.setAttribute("x",String((f+i)*a)),h.setAttribute("y",String((p+i)*a)),h.setAttribute("width",String(a+.5)),h.setAttribute("height",String(a+.5)),h.setAttribute("fill","#0b0d12"),c.appendChild(h)}r.appendChild(c);let u=e.doc.createElement("div");return u.className="scalebun-qr-cap",u.textContent=t.length>40?t.slice(0,39)+"\u2026":t,r.appendChild(u),r}});var Bp={};L(Bp,{streakRenderer:()=>Nw});var vo,Nw,Fp=k(()=>{"use strict";vo=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Nw=(n,e)=>{var l;let t=(l=n.props)!=null?l:{},r=t.mode==="checkin",s=Array.isArray(t.labels)?t.labels.map(u=>String(u!=null?u:"")):[],i=Math.max(1,Math.min(31,vo(t.days,s.length||7))),o=Math.max(0,Math.min(i,vo(t.filled,0))),a=r?Math.max(0,Math.min(i,vo(t.today,o+1))):0,c=e.doc.createElement("div");c.className=r?"scalebun-streak scalebun-streak-checkin":"scalebun-streak",c.setAttribute("role","group"),c.setAttribute("aria-label",r?`Checked in ${o} of ${i} days`:`${o} day streak of ${i}`);for(let u=1;u<=i;u++){let d=u<=o,p=u===a&&!d,f=e.doc.createElement(p?"button":"div");f.className="scalebun-streak-day",f.setAttribute("data-done",d?"true":"false"),p&&(f.type="button",f.setAttribute("data-today","true"));let m=e.doc.createElement("span");m.className="scalebun-streak-mark",m.setAttribute("aria-hidden","true"),m.textContent=d?r?"\u2713":"\u{1F525}":"",f.appendChild(m);let h=s[u-1];if(h){let g=e.doc.createElement("span");g.className="scalebun-streak-label",g.textContent=h,f.appendChild(g)}f.setAttribute("aria-label",`${h||`Day ${u}`} \u2014 ${d?"done":p?"today":"not done"}`),p&&f.addEventListener("click",()=>{var g;return(g=e.onInteraction)==null?void 0:g.call(e,`check_in:${u}`)},{once:!0}),c.appendChild(f)}return c}});var Hp={};L(Hp,{nextStepIndex:()=>qp,stepLabels:()=>Dp,stepsRenderer:()=>Fw});function Dp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=He(e.backLabel))!=null?t:"Back",skip:(s=(r=He(e.skipLabel))!=null?r:He(e.secondaryLabel))!=null?s:"Skip",next:(i=He(e.nextLabel))!=null?i:"Next",finish:(a=(o=He(e.finalLabel))!=null?o:He(e.ctaLabel))!=null?a:"Finish"}}function qp(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Bw(n){let e=n==null?void 0:n.steps,r=(Array.isArray(e)?e:[]).map(s=>{var o,a;if(typeof s=="string")return{title:s};let i=s&&typeof s=="object"?s:{};return{title:(o=He(i.title))!=null?o:He(i.label),body:(a=He(i.body))!=null?a:He(i.text)}});return r.length?r:[{}]}var He,Fw,$p=k(()=>{"use strict";He=n=>typeof n=="string"&&n.trim()?n.trim():void 0;Fw=(n,e)=>{let t=n.props,r=Bw(t),s=Dp(t),i=e.doc,o=0,a=i.createElement("div");a.className="scalebun-steps";let c=i.createElement("div");c.className="scalebun-steps-rail",c.setAttribute("role","progressbar"),c.setAttribute("aria-valuemin","1"),c.setAttribute("aria-valuemax",String(r.length));let l=r.map(()=>{let b=i.createElement("span");return b.className="scalebun-steps-dot",c.appendChild(b),b});a.appendChild(c);let u=i.createElement("div");u.className="scalebun-steps-page";let d=i.createElement("div");d.className="scalebun-steps-title";let p=i.createElement("div");p.className="scalebun-steps-body",u.appendChild(d),u.appendChild(p),a.appendChild(u);let f=i.createElement("div");f.className="scalebun-steps-nav";let m=(b,E)=>{let w=i.createElement("button");return w.type="button",w.className=`scalebun-btn ${E}`,w.textContent=b,f.appendChild(w),w},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),x=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var w,I,S;let b=(w=r[o])!=null?w:{};d.textContent=(I=b.title)!=null?I:"",d.style.display=b.title?"":"none",p.textContent=(S=b.body)!=null?S:"",p.style.display=b.body?"":"none";let E=o+1>=r.length;x.textContent=E?s.finish:s.next,h.hidden=o===0,g.hidden=E,c.setAttribute("aria-valuenow",String(o+1)),c.setAttribute("aria-label",`Step ${o+1} of ${r.length}`),l.forEach((C,M)=>{C.setAttribute("data-state",M<o?"done":M===o?"current":"todo"),M===o?C.setAttribute("aria-current","step"):C.removeAttribute("aria-current")})},y=b=>{var w;let E=qp(o,r.length,b);E!==o&&(o=E,v(),(w=e.onInteraction)==null||w.call(e,`step-${o+1}`))};return h.addEventListener("click",()=>y("back")),g.addEventListener("click",()=>{var b;return(b=e.onInteraction)==null?void 0:b.call(e,"step-skip")}),x.addEventListener("click",()=>{var b;if(o+1>=r.length){(b=e.onInteraction)==null||b.call(e,"step-finish");return}y("next")}),v(),a}});async function zp(n){let e=new Set;for(let t of n)wo[t]&&!Ur[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{Ur[t]=await wo[t]()}catch{}}))}var wo,wA,Up=k(()=>{"use strict";Wr();wo={markdown:()=>Promise.resolve().then(()=>(ap(),op)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(lp(),cp)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(fp(),pp)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(hp(),mp)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(bp(),gp)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(vp(),yp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(xp(),wp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(Ep(),kp)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(Rp(),Ap)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(Pp(),Mp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(_p(),Lp)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(Np(),Op)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(Fp(),Bp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>($p(),Hp)).then(n=>n.stepsRenderer)},wA=Object.keys(wo)});var Vp={};L(Vp,{bannerSurface:()=>Dw});function Dw(n){var o,a,c,l,u,d,p;let{doc:e,variant:t}=n,r=((o=t.surfaceOptions)==null?void 0:o.placement)==="bottom",s=e.createElement("div");s.className="scalebun-banner"+(r?" scalebun-banner-bottom":""),s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"region"),s.setAttribute("aria-live",(u=(l=t.a11y)==null?void 0:l.liveRegion)!=null?u:"polite"),(d=t.a11y)!=null&&d.labelledBy&&s.setAttribute("aria-label",t.a11y.labelledBy);let i=e.createElement("div");i.className="scalebun-body";for(let f of oe(n))i.appendChild(f);if(s.appendChild(i),((p=t.dismiss)==null?void 0:p.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}return{el:s,destroy:()=>s.remove()}}var Wp=k(()=>{"use strict";Te()});var jp={};L(jp,{toastSurface:()=>qw});function qw(n){var l,u,d,p,f,m;let{doc:e,variant:t}=n,r=e.createElement("div");r.className="scalebun-toast",r.setAttribute("role",(u=(l=t.a11y)==null?void 0:l.role)!=null?u:"status"),r.setAttribute("aria-live",(p=(d=t.a11y)==null?void 0:d.liveRegion)!=null?p:"polite");let s=e.createElement("div");s.className="scalebun-body";for(let h of oe(n))s.appendChild(h);if(r.appendChild(s),((f=t.dismiss)==null?void 0:f.xButton)!==!1){let h=e.createElement("button");h.type="button",h.className="scalebun-x",h.setAttribute("aria-label","Dismiss"),h.textContent="\xD7",h.addEventListener("click",()=>n.requestClose("x")),r.appendChild(h)}let i=null,o=(m=t.dismiss)==null?void 0:m.autoDismissMs,a=()=>{o&&o>0&&(i=setTimeout(()=>n.requestClose("auto"),o))},c=()=>{i!=null&&(clearTimeout(i),i=null)};return o&&o>0&&(r.addEventListener("mouseenter",c),r.addEventListener("mouseleave",a),a()),{el:r,destroy:()=>{c(),r.remove()}}}var Kp=k(()=>{"use strict";Te()});function $w(n){if(n.hasAttribute("hidden")||n.getAttribute("aria-hidden")==="true"||n.closest("[inert]"))return!1;if(typeof getComputedStyle!="undefined"){let e=getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1}return!0}function Gp(n){return Array.from(n.querySelectorAll(Hw)).filter($w)}function zw(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Nt(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Gp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=zw(n),o=i?s.indexOf(i):-1;r.preventDefault(),r.shiftKey?o=o<=0?s.length-1:o-1:o=o===-1||o>=s.length-1?0:o+1,s[o].focus()};return n.addEventListener("keydown",t),()=>n.removeEventListener("keydown",t)}function Qr(n){let e=Gp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Zr(n,e=document){let t=e.body;if(!t)return()=>{};let r=[];for(let s of Array.from(t.children))s===n||s.contains(n)||(r.push({el:s,hadInert:s.hasAttribute("inert"),ariaWas:s.getAttribute("aria-hidden")}),s.setAttribute("inert",""),s.setAttribute("aria-hidden","true"));return()=>{for(let{el:s,hadInert:i,ariaWas:o}of r)i||s.removeAttribute("inert"),o==null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",o)}}function Bt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var Hw,es=k(()=>{"use strict";Hw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Xp={};L(Xp,{modalSurface:()=>Vw});function Vw(n){var h,g,x,v,y,b,E;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(x=r.role)!=null?x:"dialog"),a.setAttribute("aria-modal","true");let c=(y=(v=t.surfaceOptions)==null?void 0:v.size)!=null?y:"md";a.setAttribute("data-size",c);let l=oe(n),u=l.find(w=>w.classList.contains("scalebun-h"));if(u){let w=`scalebun-mt-${++Uw}`;u.id=w,a.setAttribute("aria-labelledby",w)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x scalebun-modal-x",w.setAttribute("aria-label","Close dialog"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),a.appendChild(w)}for(let w of l)a.appendChild(w);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",w=>{w.target===o&&n.requestClose("backdrop")});let d=w=>{w.key==="Escape"&&s.escClose!==!1&&(w.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Nt(a,e),f=(E=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?E:o,m=Zr(f,e);return{el:o,afterMount:()=>Qr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var Uw,Yp=k(()=>{"use strict";Te();es();Uw=0});var ef={};L(ef,{slideoverSurface:()=>Kw});function Ww(n,e){try{let t=localStorage.getItem(Zp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Qp,Math.max(Jp,r)):e}catch{return e}}function jw(n,e){try{localStorage.setItem(Zp(n),String(Math.round(e)))}catch{}}function Kw(n){var g,x,v,y,b,E,w,I,S,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((x=t.surfaceOptions)==null?void 0:x.resizable)!==!1,a=!!((v=t.surfaceOptions)!=null&&v.pinnable),c=e.createElement("div");c.className="scalebun-slideover "+(s?"scalebun-slideover-bottom":i?"scalebun-slideover-left":"scalebun-slideover-right"),c.setAttribute("role",(b=(y=t.a11y)==null?void 0:y.role)!=null?b:s?"dialog":"complementary"),c.setAttribute("aria-label",(w=(E=t.a11y)==null?void 0:E.labelledBy)!=null?w:t.name);let l=Ww(t.id,(S=(I=t.surfaceOptions)==null?void 0:I.maxWidth)!=null?S:380),u=()=>{s||(c.style.width=`${l}px`)};u();let d=e.createElement("div");if(d.className="scalebun-so-header",a){let M=e.createElement("button");M.type="button",M.className="scalebun-x scalebun-so-pin";let R=`scalebun_inapp_slideover_pin_${t.id}`,A=!1;try{A=localStorage.getItem(R)==="1"}catch{}let O=()=>{c.setAttribute("data-pinned",A?"true":"false"),M.setAttribute("aria-pressed",A?"true":"false"),M.title=A?"Unpin":"Pin",M.textContent=A?"\u{1F4CC}":"\u{1F4CD}"};M.addEventListener("click",()=>{A=!A;try{localStorage.setItem(R,A?"1":"0")}catch{}O()}),O(),d.appendChild(M)}if(((C=t.dismiss)==null?void 0:C.xButton)!==!1){let M=e.createElement("button");M.type="button",M.className="scalebun-x",M.setAttribute("aria-label","Close panel"),M.textContent="\xD7",M.addEventListener("click",()=>n.requestClose("x")),d.appendChild(M)}c.appendChild(d);let p=e.createElement("div");p.className="scalebun-so-body";for(let M of oe(n))p.appendChild(M);c.appendChild(p);let f=null,m=null;if(o){let M=e.createElement("div");M.className="scalebun-so-resize",M.setAttribute("role","separator"),M.setAttribute("aria-orientation","vertical"),M.addEventListener("mousedown",R=>{R.preventDefault();let A=R.clientX,O=l;f=z=>{let D=i?z.clientX-A:A-z.clientX;l=Math.min(Qp,Math.max(Jp,O+D)),u()},m=()=>{jw(t.id,l),h()},e.addEventListener("mousemove",f),e.addEventListener("mouseup",m)}),c.appendChild(M)}let h=()=>{f&&e.removeEventListener("mousemove",f),m&&e.removeEventListener("mouseup",m),f=m=null};return{el:c,destroy:()=>{h(),c.remove()}}}var Jp,Qp,Zp,tf=k(()=>{"use strict";Te();Jp=280,Qp=640,Zp=n=>`scalebun_inapp_slideover_${n}`});function nf(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function an(n,e,t,r=[]){try{for(let s of[...n.querySelectorAll(e)])r.push(s)}catch{}if(t)for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;i&&an(i,e,t,r)}return r}function xo(n,e,t){let r=null;try{r=n.querySelector(e)}catch{return null}if(r)return r;if(!t)return null;for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;if(i){let o=xo(i,e,!0);if(o)return o}}return null}function Gw(n,e,t,r){let s=e.trim(),i=an(n,t!=null?t:"*",r).filter(o=>{var a;return((a=o.textContent)!=null?a:"").trim()===s});return i.length?i.reduce((o,a)=>a.querySelectorAll("*").length<o.querySelectorAll("*").length?a:o):null}function Xw(n,e,t,r){var a,c;let s=e?`[role="${nf(e)}"]`:"button,a,[role],input,select,textarea,summary",i=an(n,s,r);if(!t)return(a=i[0])!=null?a:null;let o=t.trim();return(c=i.find(l=>{var u,d;return((d=(u=l.getAttribute("aria-label"))!=null?u:l.textContent)!=null?d:"").trim()===o}))!=null?c:null}function Yw(n){var e;if(typeof document=="undefined"||!document.evaluate)return null;try{return(e=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue)!=null?e:null}catch{return null}}function Jw(n,e,t){var r;switch(n.kind){case"selector":return xo(e,n.value,t);case"data-attr":return xo(e,`[data-scalebun-anchor="${nf(n.value)}"]`,t);case"nth":return(r=an(e,n.selector,t)[n.index])!=null?r:null;case"text":return Gw(e,n.value,n.scope,t);case"aria":return Xw(e,n.role,n.name,t);case"xpath":return Yw(n.value)}}function rf(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of an(n,"[data-scalebun-anchor]",!0)){let i=(r=s.getAttribute("data-scalebun-anchor"))==null?void 0:r.trim();if(i&&t.add(i),t.size>=e)break}return[...t].sort()}function pt(n,e=typeof document!="undefined"?document:void 0){let t=n.shadowPiercing!==!1,r=0;for(let s=0;s<n.strategies.length;s++){r++;let i=e?Jw(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function sf(n){return n.el!=null&&n.strategyIndex>0}var ts=k(()=>{"use strict"});function So(n,e,t){switch(n){case"top":return e.y-t.y;case"bottom":return t.y+t.height-(e.y+e.height);case"left":return e.x-t.x;case"right":return t.x+t.width-(e.x+e.width)}}function of(n,e,t,r,s){let i=(cn(n)?t.height:t.width)+s;return So(n,e,r)>=i}function ns(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function rs(n){var h,g,x,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(x=n.arrowSize)!=null?x:8,s=n.anchor,i=n.tooltip,o=n.boundary,a=(v=n.preferred)!=null?v:{side:"bottom",align:"center"},c=a.side,l=!1;if(!of(c,s,i,o,e)){let y=Qw[c];(of(y,s,i,o,e)||So(y,s,o)>So(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&cn(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;cn(c)?(p=c==="top"?s.y-i.height-e:s.y+s.height+e,d=u==="start"?s.x:u==="end"?s.x+s.width-i.width:s.x+s.width/2-i.width/2):(d=c==="left"?s.x-i.width-e:s.x+s.width+e,p=u==="start"?s.y:u==="end"?s.y+s.height-i.height:s.y+s.height/2-i.height/2);let f=!1;if(cn(c)){let y=ns(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=ns(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return cn(c)?(m.x=ns(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=ns(s.y+s.height/2-p,r,i.height-r),m.x=c==="left"?i.width:0),{placement:{side:c,align:u},x:d,y:p,arrow:m,flipped:l,shifted:f}}var Qw,cn,ko=k(()=>{"use strict";Qw={top:"bottom",bottom:"top",left:"right",right:"left"},cn=n=>n==="top"||n==="bottom"});var tt,ss=k(()=>{"use strict";tt=class{constructor(){this.mo=null;this.subs=new Set;this.scheduled=!1}start(){this.mo||typeof MutationObserver=="undefined"||typeof document=="undefined"||(this.mo=new MutationObserver(()=>this.notify()),this.mo.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}))}onChange(e){return this.subs.add(e),this.start(),()=>{this.subs.delete(e),this.subs.size||this.dispose()}}notify(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(let e of[...this.subs])try{e()}catch{}}))}dispose(){var e;(e=this.mo)==null||e.disconnect(),this.mo=null,this.subs.clear()}}});function Zw(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function $e(n){let e=[{kind:"selector",value:n}],t=n.match(/^\[data-scalebun-anchor=["']?([^"'\]]+)["']?\]$/);return t&&e.push({kind:"data-attr",value:t[1]}),{strategies:e,shadowPiercing:!0}}function af(n){var r,s,i,o;let e=(r=n==null?void 0:n.strategies)!=null?r:[],t=(s=e.find(a=>a.kind==="selector"))!=null?s:e[0];if(!t)return"";switch(t.kind){case"selector":case"data-attr":case"text":case"xpath":return t.value;case"nth":return`${t.selector}[${t.index}]`;case"aria":return`aria:${(i=t.role)!=null?i:"*"}/${(o=t.name)!=null?o:"*"}`}}var Me,Ft=k(()=>{"use strict";ts();ko();ss();Me=class{constructor(e){this.opts=e;this.raf=null;this.lostTimer=null;this.lastStrategy=-1;this.hadEl=!1;this.missed=!1;var t,r;this.hub=(t=e.hub)!=null?t:new tt,this.ownHub=!e.hub,this.now=(r=e.now)!=null?r:()=>Date.now()}start(){this.reposition(),this.unsubMo=this.hub.onChange(()=>this.reposition()),this.onScrollResize=()=>this.schedule(),typeof window!="undefined"&&(window.addEventListener("scroll",this.onScrollResize,!0),window.addEventListener("resize",this.onScrollResize))}reposition(){var t,r,s,i,o,a;let e=pt(this.opts.spec);if(e.el){this.clearLost(),this.hadEl||(r=(t=this.opts.hooks).onFound)==null||r.call(t,e.el),sf(e)&&e.strategyIndex!==this.lastStrategy&&((i=(s=this.opts.hooks).onHeal)==null||i.call(s,e.strategyIndex)),this.lastStrategy=e.strategyIndex,this.hadEl=!0,this.missed=!1;let c=e.el.getBoundingClientRect(),l=rs({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:Zw(),preferred:this.opts.preferred,offset:this.opts.offset});this.opts.hooks.onReposition(l,e.el)}else this.missed||(this.missed=!0,(a=(o=this.opts.hooks).onMiss)==null||a.call(o)),this.hadEl=!1,this.armLost()}schedule(){if(this.raf!=null)return;let e=()=>{this.raf=null,this.reposition()};this.raf=typeof requestAnimationFrame!="undefined"?requestAnimationFrame(e):setTimeout(e,16)}armLost(){var e;this.lostTimer==null&&(this.lostTimer=setTimeout(()=>{var t,r;this.lostTimer=null,pt(this.opts.spec).el==null&&(this.hadEl=!1,(r=(t=this.opts.hooks).onLost)==null||r.call(t,"not-found"))},(e=this.opts.graceMs)!=null?e:1500))}clearLost(){this.lostTimer!=null&&(clearTimeout(this.lostTimer),this.lostTimer=null)}stop(){var e;(e=this.unsubMo)==null||e.call(this),this.unsubMo=void 0,this.onScrollResize&&typeof window!="undefined"&&(window.removeEventListener("scroll",this.onScrollResize,!0),window.removeEventListener("resize",this.onScrollResize)),this.onScrollResize=void 0,this.raf!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(this.raf),this.raf=null,this.clearLost(),this.ownHub&&this.hub.dispose()}}});var cf={};L(cf,{popoverSurface:()=>nx});function ex(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function tx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function nx(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=ex(n),s=e.createElement("div");s.className="scalebun-popover",s.setAttribute("role",(l=(c=t.a11y)==null?void 0:c.role)!=null?l:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=(u=t.surfaceOptions)==null?void 0:u.maxWidth;if(i&&(s.style.maxWidth=`${i}px`),((d=t.dismiss)==null?void 0:d.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x scalebun-pop-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}let o=e.createElement("div");o.className="scalebun-pop-body";for(let f of oe(n))o.appendChild(f);s.appendChild(o);let a=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||320,height:s.offsetHeight||120}),preferred:{side:tx(n),align:"center"},offset:(p=t.surfaceOptions)==null?void 0:p.offset,hooks:{onReposition:f=>{s.style.top=`${f.y}px`,s.style.left=`${f.x}px`,s.setAttribute("data-placement",f.placement.side)},onHeal:()=>{var f;return(f=n.metrics)==null?void 0:f.recordAnchorRetry()},onMiss:()=>{var f;return(f=n.metrics)==null?void 0:f.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>a==null?void 0:a.start(),destroy:()=>{a==null||a.stop(),s.remove()}}}var lf=k(()=>{"use strict";Te();Ft()});var df={};L(df,{coachmarkSurface:()=>ix});function rx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function sx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ix(n){var p,f,m,h,g,x;let{doc:e,variant:t}=n,r=rx(n),s=((p=t.surfaceOptions)==null?void 0:p.spotlight)!==!1,i=e.createElement("div");i.className="scalebun-coach-root";let o=s?e.createElement("div"):null;o&&(o.className="scalebun-coach-spot",i.appendChild(o));let a=e.createElement("div");a.className="scalebun-coachmark",a.setAttribute("role",(m=(f=t.a11y)==null?void 0:f.role)!=null?m:"dialog"),a.setAttribute("aria-label",t.name),a.style.position="absolute";let c=(h=t.surfaceOptions)==null?void 0:h.maxWidth;if(c&&(a.style.maxWidth=`${c}px`),((g=t.dismiss)==null?void 0:g.xButton)!==!1){let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","Dismiss"),v.textContent="\xD7",v.addEventListener("click",()=>n.requestClose("x")),a.appendChild(v)}let l=e.createElement("div");l.className="scalebun-pop-body";for(let v of oe(n))l.appendChild(v);a.appendChild(l),i.appendChild(a);let u=6,d=r?new Me({spec:$e(r),size:()=>({width:a.offsetWidth||300,height:a.offsetHeight||120}),preferred:{side:sx(n),align:"center"},offset:(x=t.surfaceOptions)==null?void 0:x.offset,hooks:{onReposition:(v,y)=>{if(a.style.top=`${v.y}px`,a.style.left=`${v.x}px`,a.setAttribute("data-placement",v.placement.side),o){let b=y.getBoundingClientRect();o.style.top=`${b.y-u}px`,o.style.left=`${b.x-u}px`,o.style.width=`${b.width+u*2}px`,o.style.height=`${b.height+u*2}px`}},onHeal:()=>{var v;return(v=n.metrics)==null?void 0:v.recordAnchorRetry()},onMiss:()=>{var v;return(v=n.metrics)==null?void 0:v.recordFailedSelector(r)},onLost:v=>{var y;(y=n.metrics)==null||y.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${v}`),n.requestClose("auto")}}}):null;return{el:i,afterMount:()=>d==null?void 0:d.start(),destroy:()=>{d==null||d.stop(),i.remove()}}}var uf=k(()=>{"use strict";Te();Ft()});function Dt(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Dt(l,e));if("any"in n)return n.any.some(l=>Dt(l,e));if("not"in n)return!Dt(n.not,e);if("flag"in n)return!!((i=e.flags)!=null&&i[n.flag])===((o=n.is)!=null?o:!0);let t=(a=e.props)==null?void 0:a[n.prop],r=(c=n.op)!=null?c:"exists",s=typeof t=="number"&&typeof n.value=="number";switch(r){case"exists":return t!=null;case"eq":return t===n.value;case"ne":return t!==n.value;case"gt":return s&&t>n.value;case"lt":return s&&t<n.value;case"gte":return s&&t>=n.value;case"lte":return s&&t<=n.value;case"in":return Array.isArray(n.value)&&n.value.includes(t);default:return!1}}function pf(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Dt(t.when,e))return t.to}return null}var ff=k(()=>{"use strict"});var qt,Eo=k(()=>{"use strict";ff();qt=class{constructor(e){this.deps=e;this.tour=null;this.index=0;this.status="idle";this.startedAt=0;this.token=0;this.stepCleanup=null;this.pendingEvent=null;this.context={}}get state(){var e,t;return{tourId:(t=(e=this.tour)==null?void 0:e.id)!=null?t:null,index:this.index,status:this.status}}start(e,t){var s,i,o,a,c;this.status==="running"&&this.end("abandoned","superseded"),this.tour=e,this.context=(s=t==null?void 0:t.context)!=null?s:{},this.status="running",this.startedAt=this.deps.now();let r=!!(t!=null&&t.resume);this.index=r&&(a=(o=(i=this.deps).loadIndex)==null?void 0:o.call(i,e.id))!=null?a:0,(this.index>=e.steps.length||this.index<0)&&(this.index=0),this.deps.emit("$coachmark_tour_started",{tourId:e.id,version:(c=e.version)!=null?c:1,resumed:r&&this.index>0,steps:e.steps.length}),this.enter(this.index)}next(){this.status==="running"&&this.completeStep("next")}back(){if(this.status==="running"&&this.index>0){let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_back",{tourId:this.tour.id,stepId:e.id,index:this.index}),this.enter(this.index-1)}}skip(){if(this.status!=="running")return;let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_skipped",{tourId:this.tour.id,stepId:e.id,index:this.index,bySystem:!1}),this.enter(this.index+1)}notify(e){this.status==="running"&&this.pendingEvent===e&&this.completeStep("event")}end(e="abandoned",t="api"){var s,i,o;if(this.status!=="running")return;let r=this.tour;if(this.clearStep(),this.status=e,this.deps.hide(),(i=(s=this.deps).persist)==null||i.call(s,r.id,-1),e==="completed")this.deps.emit("$coachmark_tour_completed",{tourId:r.id,version:(o=r.version)!=null?o:1,steps:r.steps.length,totalMs:this.deps.now()-this.startedAt});else{let a=r.steps[this.index];this.deps.emit("$coachmark_tour_abandoned",{tourId:r.id,stepId:a==null?void 0:a.id,index:this.index,method:t})}}async enter(e){var o,a,c,l;this.clearStep();let t=this.tour;if(!t||this.status!=="running")return;if(e>=t.steps.length)return this.end("completed");this.index=e;let r=++this.token,s=t.steps[e];if(s.skipIf&&Dt(s.skipIf,this.context))return this.deps.emit("$coachmark_step_skipped",{tourId:t.id,stepId:s.id,index:e,bySystem:!0,reason:"skipIf"}),void this.enter(e+1);(a=(o=this.deps).persist)==null||a.call(o,t.id,e);let i=null;if(s.anchor){let u=(c=s.waitConditions)!=null?c:["exists","visible"],d=()=>this.deps.resolveAnchor(s.anchor).el,p=await this.deps.waitFor(d,{conditions:u,timeoutMs:(l=s.timeoutMs)!=null?l:5e3},this.deps.hub);if(r!==this.token||this.status!=="running")return;if(!p.ok)return this.deps.emit("$coachmark_anchor_failed",{tourId:t.id,stepId:s.id,index:e,reason:p.reason,strategiesTried:this.deps.resolveAnchor(s.anchor).strategiesTried}),this.applyFallback(s,e);let f=this.deps.resolveAnchor(s.anchor);f.strategyIndex>0&&this.deps.emit("$coachmark_anchor_healed",{tourId:t.id,stepId:s.id,index:e,winningStrategy:f.strategyIndex}),i=p.el}this.paint(s,i,e,!1)}applyFallback(e,t){var s;let r=(s=e.fallback)!=null?s:"modal";if(this.deps.emit("$coachmark_step_fallback",{tourId:this.tour.id,stepId:e.id,index:t,fallback:r,reason:"anchor-fail"}),r==="skip")return void this.enter(t+1);if(r==="end")return this.end("abandoned","anchor-fail");this.paint(e,null,t,!0)}paint(e,t,r,s){this.deps.render({step:e,el:t,index:r,total:this.tour.steps.length,degraded:s,controls:this.controls()}),this.deps.emit("$coachmark_step_entered",{tourId:this.tour.id,stepId:e.id,index:r,anchored:!!t,degraded:s}),this.armAdvance(e,t)}armAdvance(e,t){var s;let r=(s=e.advance)!=null?s:"next";if(this.pendingEvent=null,r!=="next")if(r==="anchor-click"&&t){let i=()=>this.completeStep("click");t.addEventListener("click",i,{once:!0}),this.stepCleanup=()=>t.removeEventListener("click",i)}else if(r==="anchor-gone"&&e.anchor){let i=this.token,o=()=>this.deps.resolveAnchor(e.anchor).el;this.deps.waitFor(o,{conditions:["gone"],timeoutMs:36e5},this.deps.hub).then(a=>{a.ok&&i===this.token&&this.status==="running"&&this.completeStep("gone")})}else if(typeof r=="object"&&"timer"in r){let i=setTimeout(()=>this.completeStep("timer"),r.timer);this.stepCleanup=()=>clearTimeout(i)}else typeof r=="object"&&"event"in r&&(this.pendingEvent=r.event)}completeStep(e){if(this.status!=="running"||!this.tour)return;let t=this.tour.steps[this.index];this.deps.emit("$coachmark_step_completed",{tourId:this.tour.id,stepId:t.id,index:this.index,advanceBy:e});let r=pf(t.next,this.context);if(r){let s=this.tour.steps.findIndex(i=>i.id===r);if(s>=0)return this.deps.emit("$coachmark_branched",{tourId:this.tour.id,fromStep:t.id,toStep:r,index:s}),void this.enter(s)}this.enter(this.index+1)}controls(){return{next:()=>this.next(),back:()=>this.back(),skip:()=>this.skip(),close:()=>this.end("abandoned","dismiss")}}clearStep(){var e;(e=this.stepCleanup)==null||e.call(this),this.stepCleanup=null,this.pendingEvent=null,this.token++}dispose(){this.clearStep(),this.status="idle",this.tour=null}}});function Co(n,e){let t=n.width*n.height;if(t<=0)return 0;let r=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),s=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return r*s/t}function Io(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function mf(n){if(n)return n;let e=typeof window!="undefined"?window.innerWidth:0,t=typeof window!="undefined"?window.innerHeight:0;return{x:0,y:0,width:e,height:t}}function hf(n){if(n.disabled)return!1;let e=n.getBoundingClientRect();if(e.width===0||e.height===0)return!1;let t=typeof document!="undefined"&&document.elementFromPoint?document.elementFromPoint(e.left+e.width/2,e.top+e.height/2):null;return t?n===t||n.contains(t)||t.contains(n):!1}function ox(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&Co(Io(n),mf(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!hf(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(Io(n));if(o!==t.v)return t.v=o,r.n=0,!1;if(r.n+=1,r.n<((i=e.stableFrames)!=null?i:2))return!1}return!0}function ax(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&Co(Io(n),mf(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!hf(n)?"not-clickable":"timeout":"not-found"}function is(n,e,t){return new Promise(r=>{var p,f;let s=!1,i=()=>{},o,a,c={v:""},l={n:0},u=(m,h,g)=>{s||(s=!0,i(),o&&clearTimeout(o),a&&clearInterval(a),r({ok:m,el:h,reason:g}))},d=()=>{if(s)return;let m=n();ox(m,e,c,l)&&u(!0,e.conditions.includes("gone")?null:m)};i=t.onChange(d),a=setInterval(d,(p=e.pollMs)!=null?p:100),o=setTimeout(()=>{let m=n();u(!1,m,ax(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var os=k(()=>{"use strict"});var gf={};L(gf,{tourSurface:()=>lx});function cx(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?$e(n.anchor):void 0,title:n.title,body:n.body,placement:n.anchor?{side:e,align:"center"}:void 0,advance:(t=n.advance)!=null?t:"next",fallback:"modal"}}function lx(n){var u,d;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.steps)!=null?d:[],s=new tt,i=e.createElement("div");i.className="scalebun-tour-root";let o=()=>{},a=p=>{var w;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(w=p.step.title)!=null?w:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let I=e.createElement("h2");I.className="scalebun-h",I.textContent=p.step.title,f.appendChild(I)}if(p.step.body){let I=e.createElement("p");I.className="scalebun-text",I.textContent=p.step.body,f.appendChild(I)}let m=e.createElement("div");m.className="scalebun-tour-nav";let h=e.createElement("span");h.className="scalebun-tour-prog",h.textContent=`${p.index+1} / ${p.total}`,m.appendChild(h);let g=e.createElement("span");g.className="scalebun-tour-btns";let x=(I,S,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${S}`,M.textContent=I,M.addEventListener("click",C),M};p.index>0&&g.appendChild(x("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(x("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(x(p.index+1>=p.total?"Done":"Next","scalebun-btn-primary",p.controls.next)),m.appendChild(g),f.appendChild(m);let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","End tour"),v.textContent="\xD7",v.addEventListener("click",p.controls.close),f.appendChild(v),i.appendChild(f);let y=null,b=null,E=()=>{b==null||b.stop(),b=null,y==null||y.remove(),y=null,f.style.position="fixed",f.style.top="",f.style.left="",f.removeAttribute("data-placement"),f.classList.add("scalebun-tour-center")};if(p.el&&p.step.anchor){let I=af(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let S=6;b=new Me({spec:p.step.anchor,size:()=>({width:f.offsetWidth||300,height:f.offsetHeight||120}),preferred:p.step.placement,hooks:{onReposition:(C,M)=>{f.style.top=`${C.y}px`,f.style.left=`${C.x}px`,f.setAttribute("data-placement",C.placement.side);let R=M.getBoundingClientRect();y.style.top=`${R.y-S}px`,y.style.left=`${R.x-S}px`,y.style.width=`${R.width+S*2}px`,y.style.height=`${R.height+S*2}px`},onHeal:()=>{var C;return(C=n.metrics)==null?void 0:C.recordAnchorRetry()},onMiss:()=>{var C;return(C=n.metrics)==null?void 0:C.recordFailedSelector(I)},onLost:C=>{var M;E(),(M=n.metrics)==null||M.recordFailedSelector(I),n.hooks.onInteraction(`anchor-lost:${C}`)}}}),b.start()}else f.classList.add("scalebun-tour-center");return()=>{b==null||b.stop(),y==null||y.remove(),f.remove()}},c=new qt({hub:s,resolveAnchor:pt,waitFor:is,render:p=>{o(),o=a(p)},hide:()=>{o(),o=()=>{}},emit:p=>n.hooks.onInteraction(p),now:()=>Date.now(),persist:(p,f)=>{try{f<0?localStorage.removeItem(Ao(p)):localStorage.setItem(Ao(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(Ao(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(cx)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var Ao,bf=k(()=>{"use strict";Eo();ts();os();ss();Ft();Ao=n=>`scalebun_inapp_tour_${n}`});var yf={};L(yf,{hotspotSurface:()=>px});function dx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function ux(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function px(n){let{doc:e,variant:t}=n,r=dx(n),s=e.createElement("div");s.className="scalebun-hotspot-root";let i=e.createElement("button");i.type="button",i.className="scalebun-beacon",i.setAttribute("aria-label",t.name),i.setAttribute("aria-expanded","false"),s.appendChild(i);let o=e.createElement("div");o.className="scalebun-beacon-card",o.setAttribute("role","tooltip"),o.hidden=!0;for(let d of oe(n))o.appendChild(d);s.appendChild(o);let a=!1,c=d=>{a!==d&&(a=d,o.hidden=!d,i.setAttribute("aria-expanded",String(d)),d&&n.hooks.onInteraction("hotspot_reveal"))};i.addEventListener("mouseenter",()=>c(!0)),i.addEventListener("focus",()=>c(!0)),i.addEventListener("click",()=>c(!a));let l=!1;o.addEventListener("mouseenter",()=>l=!0),o.addEventListener("mouseleave",()=>{l=!1,c(!1)}),i.addEventListener("mouseleave",()=>setTimeout(()=>!l&&c(!1),120));let u=r?new Me({spec:$e(r),size:()=>({width:o.offsetWidth||240,height:o.offsetHeight||90}),preferred:{side:ux(n),align:"center"},hooks:{onReposition:(d,p)=>{let f=p.getBoundingClientRect();i.style.top=`${f.y-5}px`,i.style.left=`${f.x+f.width-5}px`,o.style.top=`${d.y}px`,o.style.left=`${d.x}px`,o.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:d=>{var p;(p=n.metrics)==null||p.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${d}`),n.requestClose("auto")}}}):null;return{el:s,afterMount:()=>u==null?void 0:u.start(),destroy:()=>{u==null||u.stop(),s.remove()}}}var vf=k(()=>{"use strict";Te();Ft()});var wf={};L(wf,{toolbarSurface:()=>hx});function fx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function mx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function hx(n){var a,c,l,u;let{doc:e,variant:t}=n,r=fx(n),s=e.createElement("div");s.className="scalebun-toolbar-callout",s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=e.createElement("div");i.className="scalebun-pop-body";for(let d of oe(n))i.appendChild(d);if(s.appendChild(i),((l=t.dismiss)==null?void 0:l.xButton)!==!1){let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-pop-x",d.setAttribute("aria-label","Dismiss"),d.textContent="\xD7",d.addEventListener("click",()=>n.requestClose("x")),s.appendChild(d)}let o=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||220,height:s.offsetHeight||80}),preferred:{side:mx(n),align:"center"},offset:(u=t.surfaceOptions)==null?void 0:u.offset,hooks:{onReposition:d=>{s.style.top=`${d.y}px`,s.style.left=`${d.x}px`,s.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>o==null?void 0:o.start(),destroy:()=>{o==null||o.stop(),s.remove()}}}var xf=k(()=>{"use strict";Te();Ft()});var Sf={};L(Sf,{paletteSurface:()=>gx});function gx(n){var x,v,y;let{doc:e,variant:t}=n,r=(v=(x=t.surfaceOptions)==null?void 0:x.commands)!=null?v:[],s=Bt(e),i=e.createElement("div");i.className="scalebun-palette-backdrop";let o=e.createElement("div");o.className="scalebun-palette",o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.name);let a=e.createElement("input");a.className="scalebun-palette-input",a.type="text",a.setAttribute("role","combobox"),a.setAttribute("aria-expanded","true"),a.placeholder="Type a command or search\u2026",o.appendChild(a);let c=e.createElement("ul");c.className="scalebun-palette-list",c.setAttribute("role","listbox"),o.appendChild(c),i.appendChild(o);let l=r.slice(),u=0,d=b=>{if(b){if(n.hooks.onCtaClick(b.action),n.hooks.onInteraction(`palette_select:${b.id}`),b.action==="link"&&b.value)try{typeof window!="undefined"&&window.location.assign(b.value)}catch{}n.requestClose("cta")}},p=()=>{if(c.replaceChildren(),l.length===0){let b=e.createElement("li");b.className="scalebun-palette-empty",b.textContent="No matches",c.appendChild(b);return}l.forEach((b,E)=>{let w=e.createElement("li");w.className="scalebun-palette-item"+(E===u?" active":""),w.setAttribute("role","option"),w.setAttribute("aria-selected",String(E===u));let I=e.createElement("span");if(I.className="scalebun-palette-label",I.textContent=b.label,w.appendChild(I),b.hint){let S=e.createElement("span");S.className="scalebun-palette-hint",S.textContent=b.hint,w.appendChild(S)}w.addEventListener("mousemove",()=>{u=E,f()}),w.addEventListener("click",()=>d(b)),c.appendChild(w)})},f=()=>{Array.from(c.children).forEach((b,E)=>{b.classList.toggle("active",E===u),b.setAttribute("aria-selected",String(E===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(E=>E.label.toLowerCase().includes(b)||E.action.toLowerCase().includes(b)):r.slice(),u=0,p()};a.addEventListener("input",m);let h=b=>{b.key==="Escape"?(b.stopPropagation(),n.requestClose("esc")):b.key==="ArrowDown"?(b.preventDefault(),u=Math.min(l.length-1,u+1),f()):b.key==="ArrowUp"?(b.preventDefault(),u=Math.max(0,u-1),f()):b.key==="Enter"&&(b.preventDefault(),d(l[u]))};o.addEventListener("keydown",h),((y=t.dismiss)==null?void 0:y.backdropClose)!==!1&&i.addEventListener("mousedown",b=>{b.target===i&&n.requestClose("backdrop")});let g=Nt(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var kf=k(()=>{"use strict";es()});var Ef={};L(Ef,{panelSurface:()=>bx});function bx(n){var g,x,v,y,b,E;let{doc:e,variant:t}=n,r=((g=t.surfaceOptions)==null?void 0:g.placement)==="left",s=e.createElement("div");s.className="scalebun-panel "+(r?"scalebun-panel-left":"scalebun-panel-right"),s.setAttribute("role",(v=(x=t.a11y)==null?void 0:x.role)!=null?v:"complementary"),s.setAttribute("aria-label",t.name);let i=e.createElement("div");i.className="scalebun-panel-head";let o=e.createElement("div");if(o.className="scalebun-panel-title",o.textContent=t.name,i.appendChild(o),((y=t.dismiss)==null?void 0:y.xButton)!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Close panel"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),i.appendChild(w)}s.appendChild(i);let a=e.createElement("div");a.className="scalebun-panel-thread",a.setAttribute("role","log"),a.setAttribute("aria-live","polite"),s.appendChild(a);let c=(E=(b=t.blocks.find(w=>w.kind==="text"))==null?void 0:b.props)==null?void 0:E.text;typeof c=="string"&&f("assistant",c);let l=e.createElement("form");l.className="scalebun-panel-composer";let u=e.createElement("textarea");u.className="scalebun-panel-input",u.rows=1,u.placeholder="Ask anything\u2026";let d=e.createElement("button");d.type="submit",d.className="scalebun-btn scalebun-btn-primary scalebun-panel-send",d.textContent="Send",l.append(u,d),s.appendChild(l);let p=null;function f(w,I){let S=e.createElement("div");return S.className=`scalebun-bubble scalebun-bubble-${w}`,S.textContent=I,a.appendChild(S),a.scrollTop=a.scrollHeight,S}let m=w=>{w.preventDefault();let I=u.value.trim();I&&(f("user",I),u.value="",n.hooks.onInteraction(`ai_prompt:${I}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:w=>{var I;p||(p=f("assistant","")),p.textContent=((I=p.textContent)!=null?I:"")+w,a.scrollTop=a.scrollHeight},endAssistant:()=>{p==null||p.classList.remove("streaming"),p=null}};return s.scalebunStream=h,{el:s,destroy:()=>{l.removeEventListener("submit",m),s.remove()}}}var If=k(()=>{"use strict"});var Af={};L(Af,{checklistSurface:()=>yx});function yx(n){var E,w,I,S,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((E=r==null?void 0:r.props)==null?void 0:E.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(I=(w=t.blocks.find(R=>R.kind==="heading"))==null?void 0:w.props)==null?void 0:I.text,o=new Set;try{let R=localStorage.getItem(Cf(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(Cf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(S=t.a11y)==null?void 0:S.role)!=null?C:"complementary"),c.setAttribute("aria-label",t.name);let l=e.createElement("div");l.className="scalebun-cl-head";let u=e.createElement("div");u.className="scalebun-cl-title",u.textContent=typeof i=="string"?i:t.name,l.appendChild(u);let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-cl-dock",d.setAttribute("aria-label","Minimize"),d.textContent="\u2014";let p=!1;if(d.addEventListener("click",()=>{p=!p,c.classList.toggle("collapsed",p),d.textContent=p?"\u25A2":"\u2014"}),l.appendChild(d),((M=t.dismiss)==null?void 0:M.xButton)!==!1){let R=e.createElement("button");R.type="button",R.className="scalebun-x",R.setAttribute("aria-label","Dismiss"),R.textContent="\xD7",R.addEventListener("click",()=>n.requestClose("x")),l.appendChild(R)}c.appendChild(l);let f=e.createElement("div");f.className="scalebun-cl-bar";let m=e.createElement("div");m.className="scalebun-cl-fill",f.appendChild(m);let h=e.createElement("div");h.className="scalebun-cl-count",c.append(f,h);let g=e.createElement("ul");g.className="scalebun-cl-list",c.appendChild(g);let x=!1,v=()=>{let R=s.length||1,A=s.filter(O=>o.has(O.id)).length;m.style.width=`${Math.round(A/R*100)}%`,h.textContent=`${A} of ${s.length} complete`,g.replaceChildren();for(let O of s){let z=e.createElement("li");z.className="scalebun-cl-item"+(o.has(O.id)?" done":"");let D=e.createElement("button");D.type="button",D.className="scalebun-cl-check",D.setAttribute("role","checkbox"),D.setAttribute("aria-checked",String(o.has(O.id))),D.textContent=o.has(O.id)?"\u2713":"",D.addEventListener("click",()=>y(O.id));let te=e.createElement("span");te.className="scalebun-cl-label",te.textContent=O.label,z.append(D,te),g.appendChild(z)}A>=s.length&&s.length>0&&!x?(x=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(x=!1,c.classList.remove("complete"))},y=R=>{o.has(R)?o.delete(R):o.add(R),a(),n.hooks.onInteraction(`checklist_step:${R}`),v()},b=R=>{!o.has(R)&&s.some(A=>A.id===R)&&(o.add(R),a(),v())};return c.scalebunChecklist={completeStep:b},v(),{el:c,destroy:()=>c.remove()}}var Cf,Rf=k(()=>{"use strict";Cf=n=>`scalebun_inapp_checklist_${n}`});var Tf={};L(Tf,{takeoverSurface:()=>wx});function wx(n){var m,h,g,x,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-takeover",o.setAttribute("role",(g=r.role)!=null?g:"dialog"),o.setAttribute("aria-modal","true");let a=e.createElement("div");a.className="scalebun-takeover-inner";let c=oe(n),l=c.find(y=>y.classList.contains("scalebun-h"));if(l){let y=`scalebun-tk-${++vx}`;l.id=y,o.setAttribute("aria-labelledby",y)}else o.setAttribute("aria-label",t.name);if(s.xButton===!0){let y=e.createElement("button");y.type="button",y.className="scalebun-x scalebun-takeover-x",y.setAttribute("aria-label","Close"),y.textContent="\xD7",y.addEventListener("click",()=>n.requestClose("x")),a.appendChild(y)}for(let y of c)a.appendChild(y);o.appendChild(a);let u=y=>{y.key==="Escape"&&s.escClose===!0&&(y.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",u);let d=Nt(o,e),p=(v=(x=n.host.shadowRoot)==null?void 0:x.host)!=null?v:o,f=Zr(p,e);return{el:o,afterMount:()=>Qr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var vx,Mf=k(()=>{"use strict";Te();es();vx=0});var Pf={};L(Pf,{launcherSurface:()=>xx});function xx(n){var u,d,p,f;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.commands)!=null?d:[],s=(f=(p=t.blocks.find(m=>m.kind==="heading"||m.kind==="text"))==null?void 0:p.props)==null?void 0:f.text,i=e.createElement("div");i.className="scalebun-launcher";let o=e.createElement("div");o.className="scalebun-launcher-menu",o.setAttribute("role","menu"),o.hidden=!0;let a=e.createElement("button");a.type="button",a.className="scalebun-launcher-fab",a.setAttribute("aria-label",typeof s=="string"?s:t.name),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),a.textContent="?";let c=!1,l=m=>{c=m,o.hidden=!m,a.setAttribute("aria-expanded",String(m)),a.textContent=m?"\xD7":"?"};a.addEventListener("click",()=>l(!c));for(let m of r){let h=e.createElement("button");h.type="button",h.className="scalebun-launcher-item",h.setAttribute("role","menuitem"),h.textContent=m.label,h.addEventListener("click",()=>{if(n.hooks.onCtaClick(m.action),n.hooks.onInteraction(`launcher_select:${m.id}`),m.action==="link"&&m.value)try{typeof window!="undefined"&&window.location.assign(m.value)}catch{}l(!1)}),o.appendChild(h)}return i.append(o,a),{el:i,destroy:()=>i.remove()}}var Lf=k(()=>{"use strict"});var Nf={};L(Nf,{ShadowHost:()=>ln,applyThemeVars:()=>as,resolveScheme:()=>Of});function Of(n){if(n==="light"||n==="dark")return n;try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function as(n,e){let t=kx[Of(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var Sx,_f,kx,ln,cs=k(()=>{"use strict";$();Sx="scalebun-inapp-host",_f=`
536
+ `});var Gu,lo,Xu,Yu,Ju,Qu,Zu,ep,tp=k(()=>{"use strict";Gu=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),lo=n=>Array.isArray(n)?n:[],Xu=n=>lo(n).map(e=>typeof e=="string"?{id:e,label:e}:e),Yu=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-nps";for(let r=0;r<=10;r++){let s=e.doc.createElement("button");s.type="button",s.className="scalebun-nps-btn",s.textContent=String(r),s.addEventListener("click",()=>{var i;return(i=e.onInteraction)==null?void 0:i.call(e,`nps:${r}`)}),t.appendChild(s)}return t},Ju=(n,e)=>{var s;let t=Number((s=n.props)==null?void 0:s.max)||5,r=e.doc.createElement("div");r.className="scalebun-rating";for(let i=1;i<=t;i++){let o=e.doc.createElement("button");o.type="button",o.className="scalebun-star",o.setAttribute("aria-label",`${i} of ${t}`),o.textContent="\u2605",o.addEventListener("click",()=>{var a;Array.from(r.children).forEach((c,l)=>c.classList.toggle("on",l<i)),(a=e.onInteraction)==null||a.call(e,`rating:${i}`)}),r.appendChild(o)}return r},Qu=(n,e)=>{var s,i;let t=lo((s=n.props)==null?void 0:s.emojis).length?lo((i=n.props)==null?void 0:i.emojis):["\u{1F61E}","\u{1F610}","\u{1F642}","\u{1F604}"],r=e.doc.createElement("div");r.className="scalebun-emoji";for(let o of t){let a=e.doc.createElement("button");a.type="button",a.className="scalebun-emoji-btn",a.textContent=o,a.addEventListener("click",()=>{var c;return(c=e.onInteraction)==null?void 0:c.call(e,`emoji:${o}`)}),r.appendChild(a)}return r},Zu=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=Gu((o=n.props)==null?void 0:o.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(c=(a=n.props)==null?void 0:a.results)!=null?c:void 0,i=s?Object.values(s).reduce((d,p)=>d+p,0)||1:0;for(let d of Xu((l=n.props)==null?void 0:l.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-poll-opt";let f=e.doc.createElement("span");if(f.className="scalebun-poll-label",f.textContent=d.label,p.appendChild(f),s){let m=Math.round(((u=s[d.id])!=null?u:0)/i*100),h=e.doc.createElement("span");h.className="scalebun-poll-bar",h.style.width=`${m}%`;let g=e.doc.createElement("span");g.className="scalebun-poll-pct",g.textContent=`${m}%`,p.append(h,g),p.disabled=!0}p.addEventListener("click",()=>{var m;return(m=e.onInteraction)==null?void 0:m.call(e,`poll_vote:${d.id}`)}),t.appendChild(p)}return t},ep=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=Gu((c=n.props)==null?void 0:c.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(l=n.props)==null?void 0:l.outcome,i=new Map,o=!1,a=(d,p)=>{for(let[f,m]of i)m.disabled=!0,p&&f===p?m.classList.add("correct"):f===d&&f!==p&&m.classList.add("incorrect")};for(let d of Xu((u=n.props)==null?void 0:u.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-quiz-opt",p.textContent=d.label,i.set(d.id,p),p.addEventListener("click",()=>{var f;if((f=e.onInteraction)==null||f.call(e,`quiz_answer:${d.id}`),!(!e.requestOutcome||o)){o=!0;for(let m of i.values())m.disabled=!0;e.requestOutcome(1,{answeredId:d.id}).then(m=>{var g,x;if(!m.ok){o=!1;for(let y of i.values())y.disabled=!1;let v=e.doc.createElement("div");v.className="scalebun-quiz-note",v.textContent=(g=m.message)!=null?g:"Could not check that answer.",t.appendChild(v);return}let h=(x=m.state)!=null?x:{};a(d.id,typeof h.correctId=="string"?h.correctId:void 0)})}}),t.appendChild(p)}return s!=null&&s.answeredId&&a(s.answeredId,s.correctId),t}});function rp(n,e,t){e.split(`
537
+ `).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function Vr(n,e){let t=[];for(let r of n){let s=Ur[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,tw,nw,rw,np,sw,iw,ow,aw,cw,lw,dw,uw,pw,Ur,Wr=k(()=>{"use strict";tp();ye=(n,e="")=>typeof n=="string"?n:n==null?e:String(n);ve=(n,e,t)=>{let r=n.createElement(e);return r.className=t,r},tw=(n,e)=>{var r;let t=ve(e.doc,"h2","scalebun-h");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},nw=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return rp(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},rw=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return rp(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},np=(n,e)=>{var s,i;let t=e.doc.createElement("img");t.className="scalebun-img";let r=ye((s=n.props)==null?void 0:s.src);return r?(t.src=r,t.alt=ye((i=n.props)==null?void 0:i.alt),t.loading="lazy",t.decoding="async",t):null},sw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-checklist");return r.setAttribute("role","list"),t.forEach((i,o)=>{var f,m;let a=i&&typeof i=="object"?i:{},c=typeof i=="string"?i:ye((m=(f=a.label)!=null?f:a.text)!=null?m:a.title),l=a.done===!0||a.checked===!0||a.complete===!0,u=e.doc.createElement("li");u.className="scalebun-checklist-item",u.setAttribute("data-done",l?"true":"false");let d=e.doc.createElement("span");d.className="scalebun-checklist-mark",d.setAttribute("aria-hidden","true"),d.textContent=l?"\u2713":"";let p=e.doc.createElement("span");p.className="scalebun-checklist-label",p.textContent=c,u.appendChild(d),u.appendChild(p),u.setAttribute("aria-label",`${c} \u2014 ${l?"done":"not done"}`),u.addEventListener("click",()=>{var h;return(h=e.onInteraction)==null?void 0:h.call(e,`checklist_item:${o}`)}),r.appendChild(u)}),r},iw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-list");return t.forEach((i,o)=>{var l;let a=e.doc.createElement("li"),c=typeof i=="string"?i:ye((l=i==null?void 0:i.text)!=null?l:i==null?void 0:i.label);a.textContent=c,a.addEventListener("click",()=>{var u;return(u=e.onInteraction)==null?void 0:u.call(e,`list_item:${o}`)}),r.appendChild(a)}),r},ow=(n,e)=>{var s,i;let t=ve(e.doc,"div","scalebun-callout");if((s=n.props)!=null&&s.icon){let o=ve(e.doc,"span","scalebun-callout-ic");o.textContent=ye(n.props.icon),t.appendChild(o)}let r=ve(e.doc,"span","scalebun-callout-t");return r.textContent=ye((i=n.props)==null?void 0:i.text),t.appendChild(r),t},aw=(n,e)=>{var r;let t=ve(e.doc,"span","scalebun-badge");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},cw=(n,e)=>{var i;let t=Math.max(0,Math.min(100,Number((i=n.props)==null?void 0:i.value)||0)),r=ve(e.doc,"div","scalebun-progress"),s=ve(e.doc,"div","scalebun-progress-fill");return s.style.width=`${t}%`,r.appendChild(s),r},lw=(n,e)=>ve(e.doc,"hr","scalebun-divider"),dw=(n,e)=>{var s;let t=ve(e.doc,"div","scalebun-spacer"),r=Number((s=n.props)==null?void 0:s.height);return!Number.isNaN(r)&&r>0&&(t.style.height=`${r}px`),t},uw=new Set(["primary","secondary","link","ghost","dismiss"]),pw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.actions)?n.props.actions:[];if(t.length===0)return null;let r=ve(e.doc,"div","scalebun-cta-row");for(let i of t){let o=uw.has(ye(i.variant))?ye(i.variant):"primary",a=e.doc.createElement("button");a.type="button",a.className=`scalebun-btn scalebun-btn-${o}`,a.textContent=ye(i.label,"OK"),a.setAttribute("data-action",ye(i.action,"dismiss")),a.addEventListener("click",()=>e.onAction({...i,variant:o})),r.appendChild(a)}return r},Ur={heading:tw,text:nw,richtext:rw,image:np,illustration:np,list:iw,checklist:sw,callout:ow,badge:aw,progress:cw,divider:lw,spacer:dw,cta:pw,nps:Yu,rating:Ju,emoji:Qu,poll:Zu,quiz:ep}});async function sp(n){var e;try{if(typeof navigator!="undefined"&&((e=navigator.clipboard)!=null&&e.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{if(typeof document=="undefined")return!1;let t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),t.select();let r=typeof document.execCommand=="function"?document.execCommand("copy"):!1;return t.remove(),r}catch{return!1}}var ip=k(()=>{"use strict"});function uo(n){return{doc:n.doc,onInteraction:e=>n.hooks.onInteraction(e),...n.hooks.requestOutcome?{requestOutcome:n.hooks.requestOutcome}:{},onAction:e=>{if(e.action==="dismiss"){n.requestClose("cta");return}if(n.hooks.onCtaClick(e.action),e.action==="copy"&&e.deepLink){sp(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return Vr(n.variant.blocks,uo(n))}function jr(n,e,t=1e3){let r=!1,s=null,i=null,o=()=>{s!=null&&(clearTimeout(s),s=null)},a=()=>{r||(r=!0,o(),i==null||i.disconnect(),e())},c=()=>{s==null&&!r&&(s=setTimeout(a,t))};return typeof IntersectionObserver=="undefined"?(c(),()=>o()):(i=new IntersectionObserver(l=>{for(let u of l)u.isIntersecting&&u.intersectionRatio>=.5?c():o()},{threshold:[0,.5,1]}),i.observe(n),()=>{o(),i==null||i.disconnect()})}var Te=k(()=>{"use strict";Wr();ip()});function op(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",zr),n.addStyles("scalebun-surfaces",ju);let i=n.zone(Lt(e)),o=i.ownerDocument,a=null,c=()=>{},l=!1,u=f=>{l||!a||(l=!0,c(),r.onDismiss(f),a.destroy())};return a=t({variant:e,host:n,doc:o,hooks:r,requestClose:u,metrics:s}),i.appendChild(a.el),(p=a.afterMount)==null||p.call(a),r.onImpression(),c=jr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var ap=k(()=>{"use strict";$r();co();Ku();Te()});var cp={};L(cp,{markdownRenderer:()=>fw});function po(n,e){var o;let t=[],r=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g,s=0,i;for(;i=r.exec(n);){if(i.index>s&&t.push(e.createTextNode(n.slice(s,i.index))),i[2])t.push(fo(e,"strong",i[2]));else if(i[4])t.push(fo(e,"em",i[4]));else if(i[6])t.push(fo(e,"code",i[6]));else if(i[8]){let a=e.createElement("a");a.textContent=i[8];let c=(o=i[9])!=null?o:"";/^(https?:|\/|#|mailto:)/i.test(c)&&(a.href=c,a.rel="noopener noreferrer",a.target="_blank"),t.push(a)}s=r.lastIndex}return s<n.length&&t.push(e.createTextNode(n.slice(s))),t}function fo(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var fw,lp=k(()=>{"use strict";fw=(n,e)=>{var i,o;let t=typeof((i=n.props)==null?void 0:i.text)=="string"?n.props.text:typeof((o=n.props)==null?void 0:o.markdown)=="string"?n.props.markdown:"",r=e.doc.createElement("div");r.className="scalebun-md";let s=null;for(let a of t.split(`
538
+ `)){let c=a.trimEnd(),l=c.match(/^(#{1,4})\s+(.*)$/),u=c.match(/^\s*[-*]\s+(.*)$/);if(l){s=null;let d=e.doc.createElement(`h${l[1].length}`);d.className="scalebun-md-h",po(l[2],e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else if(u){s||(s=e.doc.createElement("ul"),s.className="scalebun-md-ul",r.appendChild(s));let d=e.doc.createElement("li");po(u[1],e.doc).forEach(p=>d.appendChild(p)),s.appendChild(d)}else if(c){s=null;let d=e.doc.createElement("p");d.className="scalebun-md-p",po(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var dp={};L(dp,{codeRenderer:()=>mw});var mw,up=k(()=>{"use strict";mw=(n,e)=>{var u,d,p;let t=typeof((u=n.props)==null?void 0:u.code)=="string"?n.props.code:typeof((d=n.props)==null?void 0:d.text)=="string"?n.props.text:"",r=typeof((p=n.props)==null?void 0:p.language)=="string"?n.props.language:"",s=e.doc.createElement("div");s.className="scalebun-code";let i=e.doc.createElement("div");i.className="scalebun-code-bar";let o=e.doc.createElement("span");o.className="scalebun-code-lang",o.textContent=r||"code";let a=e.doc.createElement("button");a.type="button",a.className="scalebun-code-copy",a.textContent="Copy",a.addEventListener("click",async()=>{var m,h,g;let f=!1;try{typeof navigator!="undefined"&&navigator.clipboard&&(await navigator.clipboard.writeText(t),f=!0)}catch{f=!1}if(!f){let x=e.doc.createRange();x.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(x)}a.textContent=f?"Copied":"Select all",(g=e.onInteraction)==null||g.call(e,"code_copy"),setTimeout(()=>a.textContent="Copy",1500)}),i.append(o,a);let c=e.doc.createElement("pre");c.className="scalebun-code-pre";let l=e.doc.createElement("code");return l.textContent=t,c.appendChild(l),s.append(i,c),s}});var Kr={};L(Kr,{chartRenderer:()=>bw,sparklineRenderer:()=>hw,statRenderer:()=>gw});function fp(n,e,t){let r=n.createElementNS(mo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var mo,pp,hw,gw,bw,Gr=k(()=>{"use strict";mo="http://www.w3.org/2000/svg",pp=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];hw=(n,e)=>{var p;let t=pp((p=n.props)==null?void 0:p.values),r=e.doc.createElement("div");if(r.className="scalebun-spark",t.length<2)return r;let s=160,i=40,o=Math.min(...t),c=Math.max(...t)-o||1,l=t.map((f,m)=>`${m/(t.length-1)*s},${i-(f-o)/c*(i-4)-2}`).join(" "),u=fp(e.doc,s,i),d=e.doc.createElementNS(mo,"polyline");return d.setAttribute("points",l),d.setAttribute("fill","none"),d.setAttribute("stroke","var(--scalebun-accent)"),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linejoin","round"),u.appendChild(d),r.appendChild(u),r},gw=(n,e)=>{var i,o,a,c;let t=e.doc.createElement("div");t.className="scalebun-stat";let r=e.doc.createElement("div");if(r.className="scalebun-stat-value",r.textContent=String((o=(i=n.props)==null?void 0:i.value)!=null?o:"\u2014"),t.appendChild(r),((a=n.props)==null?void 0:a.label)!=null){let l=e.doc.createElement("div");l.className="scalebun-stat-label",l.textContent=String(n.props.label),t.appendChild(l)}let s=(c=n.props)==null?void 0:c.delta;if(s!=null){let l=e.doc.createElement("div"),u=Number(s);l.className="scalebun-stat-delta "+(u>=0?"up":"down"),l.textContent=`${u>=0?"\u25B2":"\u25BC"} ${Math.abs(u)}`,t.appendChild(l)}return t},bw=(n,e)=>{var l;let t=pp((l=n.props)==null?void 0:l.values),r=e.doc.createElement("div");if(r.className="scalebun-chart",t.length===0)return r;let s=240,i=100,o=Math.max(...t)||1,a=s/t.length,c=fp(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(mo,"rect"),f=u/o*(i-4);p.setAttribute("x",String(d*a+2)),p.setAttribute("y",String(i-f)),p.setAttribute("width",String(a-4)),p.setAttribute("height",String(f)),p.setAttribute("rx","2"),p.setAttribute("fill","var(--scalebun-accent)"),c.appendChild(p)}),r.appendChild(c),r}});var mp={};L(mp,{tableRenderer:()=>yw});var yw,hp=k(()=>{"use strict";yw=(n,e)=>{var o,a;let t=Array.isArray((o=n.props)==null?void 0:o.columns)?n.props.columns.map(String):[],r=Array.isArray((a=n.props)==null?void 0:a.rows)?n.props.rows:[],s=e.doc.createElement("table");if(s.className="scalebun-table",t.length){let c=e.doc.createElement("thead"),l=e.doc.createElement("tr");for(let u of t){let d=e.doc.createElement("th");d.textContent=u,l.appendChild(d)}c.appendChild(l),s.appendChild(c)}let i=e.doc.createElement("tbody");for(let c of r){let l=e.doc.createElement("tr");for(let u of Array.isArray(c)?c:[c]){let d=e.doc.createElement("td");d.textContent=u==null?"":String(u),l.appendChild(d)}i.appendChild(l)}return s.appendChild(i),s}});var gp={};L(gp,{videoRenderer:()=>vw});var vw,bp=k(()=>{"use strict";vw=(n,e)=>{var c,l;let t=typeof((c=n.props)==null?void 0:c.src)=="string"?n.props.src:"",r=typeof((l=n.props)==null?void 0:l.poster)=="string"?n.props.poster:"",s=e.doc.createElement("div");if(s.className="scalebun-video",!t)return s;let i=()=>{var d;s.replaceChildren();let u=e.doc.createElement("video");u.className="scalebun-video-el",u.src=t,u.controls=!0,u.autoplay=!0,u.playsInline=!0,s.appendChild(u),(d=e.onInteraction)==null||d.call(e,"video_play")},o=e.doc.createElement("button");if(o.type="button",o.className="scalebun-video-poster",o.setAttribute("aria-label","Play video"),r){let u=e.doc.createElement("img");u.src=r,u.alt="",u.loading="lazy",o.appendChild(u)}let a=e.doc.createElement("span");return a.className="scalebun-video-play",a.textContent="\u25B6",o.appendChild(a),o.addEventListener("click",i),s.appendChild(o),s}});var yp={};L(yp,{countdownRenderer:()=>xw});function ww(n,e){let t=n==null?void 0:n.target;if(typeof t=="number")return t;if(typeof t=="string"){let s=Date.parse(t);if(!Number.isNaN(s))return s}let r=Number(n==null?void 0:n.durationMs);return e+(Number.isFinite(r)&&r>0?r:24*36e5)}var Xr,xw,vp=k(()=>{"use strict";Xr=n=>String(Math.max(0,n)).padStart(2,"0"),xw=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=ww(n.props,r()),i=[];for(let a of["Days","Hrs","Min","Sec"]){let c=e.doc.createElement("div");c.className="scalebun-cd-cell";let l=e.doc.createElement("div");l.className="scalebun-cd-num",l.textContent="00";let u=e.doc.createElement("div");u.className="scalebun-cd-lab",u.textContent=a,c.append(l,u),t.appendChild(c),i.push([a,l])}let o=()=>{let a=Math.max(0,s-r()),c=Math.floor(a/864e5);a-=c*864e5;let l=Math.floor(a/36e5);a-=l*36e5;let u=Math.floor(a/6e4);a-=u*6e4;let d=Math.floor(a/1e3);i[0][1].textContent=Xr(c),i[1][1].textContent=Xr(l),i[2][1].textContent=Xr(u),i[3][1].textContent=Xr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var wp={};L(wp,{carouselRenderer:()=>Sw});var ho,Sw,xp=k(()=>{"use strict";ho=n=>typeof n=="string"&&n?n:void 0,Sw=(n,e)=>{var c,l;let t=Array.isArray((c=n.props)==null?void 0:c.slides)?n.props.slides:[],r=e.doc.createElement("div");if(r.className="scalebun-carousel",t.length===0)return r;let s=e.doc.createElement("div");s.className="scalebun-car-track";let i=[];for(let u of t){let d=e.doc.createElement("div");d.className="scalebun-car-slide";let p=ho(u.image);if(p){let f=e.doc.createElement("img");f.className="scalebun-car-img",f.src=p,f.alt="",f.loading="lazy",d.appendChild(f)}if(ho(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(ho(u.text)){let f=e.doc.createElement("div");f.className="scalebun-car-text",f.textContent=u.text,d.appendChild(f)}s.appendChild(d),i.push(d)}r.appendChild(s);let o=e.doc.createElement("div");o.className="scalebun-car-dots";let a=t.map((u,d)=>{let p=e.doc.createElement("button");return p.type="button",p.className="scalebun-car-dot"+(d===0?" on":""),p.setAttribute("aria-label",`Slide ${d+1}`),p.addEventListener("click",()=>i[d].scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})),o.appendChild(p),p});if(r.appendChild(o),typeof IntersectionObserver!="undefined"){let u=new IntersectionObserver(d=>{for(let p of d)if(p.isIntersecting){let f=i.indexOf(p.target);a.forEach((m,h)=>m.classList.toggle("on",h===f))}},{root:s,threshold:.6});i.forEach(d=>u.observe(d))}return(l=e.onInteraction)==null||l.call(e,"carousel_view"),r}});var Sp={};L(Sp,{productGridRenderer:()=>kw});var Yr,kw,kp=k(()=>{"use strict";Yr=n=>n==null?void 0:String(n),kw=(n,e)=>{var s,i;let t=Array.isArray((s=n.props)==null?void 0:s.products)?n.props.products:Array.isArray((i=n.props)==null?void 0:i.items)?n.props.items:[],r=e.doc.createElement("div");return r.className="scalebun-pgrid",t.length===0||t.forEach((o,a)=>{var d;let c=e.doc.createElement("button");c.type="button",c.className="scalebun-pcard";let l=Yr(o.image);if(l){let p=e.doc.createElement("img");p.className="scalebun-pcard-img",p.src=l,p.alt="",p.loading="lazy",c.appendChild(p)}if(o.badge){let p=e.doc.createElement("span");p.className="scalebun-pcard-badge",p.textContent=Yr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=Yr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=Yr(o.price),c.appendChild(p)}c.addEventListener("click",()=>{var p,f;return(f=e.onInteraction)==null?void 0:f.call(e,`product_select:${(p=o.id)!=null?p:a}`)}),r.appendChild(c)}),r}});var Ip={};L(Ip,{confettiRenderer:()=>Iw});function Ew(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Ep,Iw,Cp=k(()=>{"use strict";Ep=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];Iw=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",Ew()||typeof requestAnimationFrame=="undefined")return t.classList.add("scalebun-confetti-static"),t.textContent="\u{1F389}",t;let r=e.doc.createElement("canvas");r.className="scalebun-confetti-canvas",t.appendChild(r);let s=r.getContext("2d");if(!s)return t;let i=Math.min(240,Math.max(40,Number((d=n.props)==null?void 0:d.count)||140)),o=[],a=()=>{let f=r.width;o=Array.from({length:i},(m,h)=>({x:f/2+(h-i/2),y:r.height*.25,vx:(h%20-10)*.6,vy:-4-h%7,rot:h,vr:(h%5-2)*.3,c:Ep[h%Ep.length],s:5+h%4}))};(()=>{var m;let f=(m=t.parentElement)!=null?m:t;r.width=f.clientWidth||360,r.height=f.clientHeight||240})(),a();let l=0,u=()=>{if(!t.isConnected)return;s.clearRect(0,0,r.width,r.height);let f=0;for(let m of o)m.vy+=.16,m.x+=m.vx,m.y+=m.vy,m.rot+=m.vr,m.y<r.height+12&&f++,s.save(),s.translate(m.x,m.y),s.rotate(m.rot),s.fillStyle=m.c,s.fillRect(-m.s/2,-m.s/2,m.s,m.s*.6),s.restore();l++,f>0&&l<240?requestAnimationFrame(u):s.clearRect(0,0,r.width,r.height)};return requestAnimationFrame(u),(p=e.onInteraction)==null||p.call(e,"celebration"),t}});function _t(n,e,t,r={}){var o,a,c;(o=n.querySelector(".scalebun-game-note"))==null||o.remove();let s=e.createElement("div");s.className="scalebun-game-note",s.setAttribute("role","status");let i=e.createElement("span");if(i.textContent=(a=t.message)!=null?a:"Rewards are unavailable right now.",s.appendChild(i),t.retryable&&r.onRetry){let l=e.createElement("button");l.type="button",l.className="scalebun-game-retry",l.textContent=(c=r.retryLabel)!=null?c:"Try again",l.addEventListener("click",()=>{var u;s.remove(),(u=r.onRetry)==null||u.call(r)},{once:!0}),s.appendChild(l)}n.appendChild(s)}function Ot(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Jr=k(()=>{"use strict"});var Tp={};L(Tp,{spinwheelRenderer:()=>Rw});function bo(n,e,t,r){let s=(r-90)*Math.PI/180;return{x:n+t*Math.cos(s),y:e+t*Math.sin(s)}}function Aw(n,e,t,r,s){let i=bo(n,e,t,s),o=bo(n,e,t,r),a=s-r<=180?0:1;return`M ${n} ${e} L ${i.x} ${i.y} A ${t} ${t} 0 ${a} 0 ${o.x} ${o.y} Z`}function Rp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Ap,Cw,go,Rw,Mp=k(()=>{"use strict";Jr();Ap=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],Cw=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};go="http://www.w3.org/2000/svg",Rw=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(Cw).filter(Boolean),r=t.length?t:["10% off","Free ship","Try again","20% off","$5 credit","Jackpot"],s=r.length,i=Math.max(0,Math.min(s-1,Number((y=n.props)==null?void 0:y.resultIndex)||0)),o=e.doc.createElement("div");o.className="scalebun-wheel";let a=220,c=a/2,l=a/2-4,u=360/s,d=e.doc.createElementNS(go,"svg");d.setAttribute("viewBox",`0 0 ${a} ${a}`),d.setAttribute("width",String(a)),d.setAttribute("height",String(a)),d.setAttribute("class","scalebun-wheel-svg"),r.forEach((b,E)=>{let w=e.doc.createElementNS(go,"path");w.setAttribute("d",Aw(c,c,l,E*u,(E+1)*u)),w.setAttribute("fill",Ap[E%Ap.length]),d.appendChild(w);let I=bo(c,c,l*.62,E*u+u/2),S=e.doc.createElementNS(go,"text");S.setAttribute("x",String(I.x)),S.setAttribute("y",String(I.y)),S.setAttribute("fill","#fff"),S.setAttribute("font-size","10"),S.setAttribute("text-anchor","middle"),S.setAttribute("transform",`rotate(${E*u+u/2} ${I.x} ${I.y})`),S.textContent=b.slice(0,12),d.appendChild(S)});let p=e.doc.createElement("div");p.className="scalebun-wheel-pointer";let f=e.doc.createElement("button");f.type="button",f.className="scalebun-wheel-spin",f.textContent="SPIN";let m=!1,h=b=>360*5-(b*u+u/2),g=(b,E)=>{var S;let w=((S=E!=null?E:r[b])!=null?S:"").slice(0,14);if(Rp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=w;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let I=()=>{f.textContent=w};d.addEventListener("transitionend",I,{once:!0}),setTimeout(I,3600)},x=b=>{m=!0,f.disabled=!0,Ot(o),Rp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(E=>{var I,S,C;if(!E.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,_t(o,e.doc,E,{onRetry:()=>x(b+1)}),(I=e.onInteraction)==null||I.call(e,"spin_unavailable");return}let w=Math.max(0,Math.min(s-1,Number((S=E.index)!=null?S:0)));(C=e.onInteraction)==null||C.call(e,`spin:${w}`),g(w,E.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){x(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var Lp={};L(Lp,{scratchRenderer:()=>Tw});function Pp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Tw,_p=k(()=>{"use strict";Jr();Tw=(n,e)=>{var x,v;let t=typeof((x=n.props)==null?void 0:x.prize)=="string"?n.props.prize:"You won a prize!",r=((v=n.props)==null?void 0:v.reveal)==="box",s=e.doc.createElement("div");s.className=r?"scalebun-scratch scalebun-scratch-box":"scalebun-scratch";let i=e.doc.createElement("div");i.className="scalebun-scratch-prize",i.textContent=t,s.appendChild(i);let o=!1,a=()=>{o||!e.requestOutcome||(o=!0,e.requestOutcome(1).then(y=>{var b;if(y.ok){Ot(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",_t(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(Pp())return s;let y=e.doc.createElement("button");return y.type="button",y.className="scalebun-scratch-lid",y.setAttribute("aria-label","Open the mystery box"),y.textContent="\u{1F381}",y.addEventListener("click",()=>{var b;a(),y.setAttribute("data-open","true"),setTimeout(()=>y.remove(),320),(b=e.onInteraction)==null||b.call(e,"mystery_box_opened")},{once:!0}),s.appendChild(y),s}let c=e.doc.createElement("canvas");c.className="scalebun-scratch-cover";let l=c.getContext("2d");if(Pp()||!l)return c.remove(),s;s.appendChild(c);let u=300,d=90;c.width=u,c.height=d,l.fillStyle="#9aa3b2",l.fillRect(0,0,u,d),l.fillStyle="#6b7280",l.font="13px sans-serif",l.textAlign="center",l.fillText("Scratch here",u/2,d/2+4),l.globalCompositeOperation="destination-out";let p=!1,f=!1,m=(y,b)=>{l.beginPath(),l.arc(y,b,16,0,Math.PI*2),l.fill()},h=y=>{let b=c.getBoundingClientRect();return{x:(y.clientX-b.left)/b.width*u,y:(y.clientY-b.top)/b.height*d}},g=y=>{var E;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))};return c.addEventListener("mousedown",y=>{p=!0;let b=h(y);m(b.x,b.y)}),e.doc.addEventListener("mouseup",()=>p=!1),c.addEventListener("mousemove",g),c.addEventListener("touchmove",y=>{var E;let b=y.touches[0];if(b){let w=h(b);m(w.x,w.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))}}),s}});var Op={};L(Op,{slotRenderer:()=>Lw});function Pw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Mw,Lw,Np=k(()=>{"use strict";Jr();Mw=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Lw=(n,e)=>{var p,f,m;let t=(Array.isArray((p=n.props)==null?void 0:p.symbols)?n.props.symbols.map(String):[]).filter(Boolean),r=t.length?t:Mw,s=Array.isArray((f=n.props)==null?void 0:f.result)?n.props.result.slice(0,3).map(String):[r[0],r[0],r[0]],i=e.doc.createElement("div");i.className="scalebun-slot";let o=e.doc.createElement("div");o.className="scalebun-slot-reels";let a=[];for(let h=0;h<3;h++){let g=e.doc.createElement("div");g.className="scalebun-slot-reel";let x=e.doc.createElement("div");x.className="scalebun-slot-strip";for(let v of[...r,...r,(m=s[h])!=null?m:r[0]]){let y=e.doc.createElement("div");y.className="scalebun-slot-cell",y.textContent=v,x.appendChild(y)}g.appendChild(x),a.push(x),o.appendChild(g)}i.appendChild(o);let c=e.doc.createElement("button");c.type="button",c.className="scalebun-slot-spin scalebun-btn scalebun-btn-primary",c.textContent="Spin";let l=!1,u=()=>{a.forEach((g,x)=>{let v=(g.children.length-1)*44;Pw()||(g.style.transition=`transform ${1.6+x*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,Ot(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,_t(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let x=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((E,w)=>{var S,C;let I=E.children[E.children.length-1];I&&(I.textContent=(C=(S=x[w])!=null?S:s[w])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${x.join("")}`),u()})};return c.addEventListener("click",()=>{var h;if(!l){if(e.requestOutcome){d(1);return}l=!0,(h=e.onInteraction)==null||h.call(e,`slot:${s.join("")}`),u()}}),i.appendChild(c),i}});var Bp={};L(Bp,{qrRenderer:()=>Bw});function _w(n,e,t){let r=2166136261^e*73856093^t*19349663;for(let s=0;s<n.length;s++)r=(r^n.charCodeAt(s))*16777619;return((r>>>13^r)&1)===1}function Ow(n,e){let t=(r,s)=>n>=r&&n<r+7&&e>=s&&e<s+7;return t(0,0)||t(18,0)||t(0,18)}function Nw(n,e){let t=n<7?n:n>=18?n-18:-1,r=e<7?e:e>=18?e-18:-1;if(t<0||r<0)return!1;let s=t===0||t===6||r===0||r===6,i=t>=2&&t<=4&&r>=2&&r<=4;return s||i}var yo,Bw,Fp=k(()=>{"use strict";yo="http://www.w3.org/2000/svg";Bw=(n,e)=>{var d;let t=typeof((d=n.props)==null?void 0:d.value)=="string"&&n.props.value?n.props.value:"https://app.example.com",r=e.doc.createElement("div");r.className="scalebun-qr";let s=160,i=2,o=25+i*2,a=s/o,c=e.doc.createElementNS(yo,"svg");c.setAttribute("viewBox",`0 0 ${s} ${s}`),c.setAttribute("width",String(s)),c.setAttribute("height",String(s)),c.setAttribute("class","scalebun-qr-svg");let l=e.doc.createElementNS(yo,"rect");l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("fill","#ffffff"),c.appendChild(l);for(let p=0;p<25;p++)for(let f=0;f<25;f++){let m;if(Ow(f,p)?m=Nw(f,p):f===6||p===6?m=(f+p)%2===0:m=_w(t,f,p),!m)continue;let h=e.doc.createElementNS(yo,"rect");h.setAttribute("x",String((f+i)*a)),h.setAttribute("y",String((p+i)*a)),h.setAttribute("width",String(a+.5)),h.setAttribute("height",String(a+.5)),h.setAttribute("fill","#0b0d12"),c.appendChild(h)}r.appendChild(c);let u=e.doc.createElement("div");return u.className="scalebun-qr-cap",u.textContent=t.length>40?t.slice(0,39)+"\u2026":t,r.appendChild(u),r}});var Dp={};L(Dp,{streakRenderer:()=>Fw});var vo,Fw,qp=k(()=>{"use strict";vo=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Fw=(n,e)=>{var l;let t=(l=n.props)!=null?l:{},r=t.mode==="checkin",s=Array.isArray(t.labels)?t.labels.map(u=>String(u!=null?u:"")):[],i=Math.max(1,Math.min(31,vo(t.days,s.length||7))),o=Math.max(0,Math.min(i,vo(t.filled,0))),a=r?Math.max(0,Math.min(i,vo(t.today,o+1))):0,c=e.doc.createElement("div");c.className=r?"scalebun-streak scalebun-streak-checkin":"scalebun-streak",c.setAttribute("role","group"),c.setAttribute("aria-label",r?`Checked in ${o} of ${i} days`:`${o} day streak of ${i}`);for(let u=1;u<=i;u++){let d=u<=o,p=u===a&&!d,f=e.doc.createElement(p?"button":"div");f.className="scalebun-streak-day",f.setAttribute("data-done",d?"true":"false"),p&&(f.type="button",f.setAttribute("data-today","true"));let m=e.doc.createElement("span");m.className="scalebun-streak-mark",m.setAttribute("aria-hidden","true"),m.textContent=d?r?"\u2713":"\u{1F525}":"",f.appendChild(m);let h=s[u-1];if(h){let g=e.doc.createElement("span");g.className="scalebun-streak-label",g.textContent=h,f.appendChild(g)}f.setAttribute("aria-label",`${h||`Day ${u}`} \u2014 ${d?"done":p?"today":"not done"}`),p&&f.addEventListener("click",()=>{var g;return(g=e.onInteraction)==null?void 0:g.call(e,`check_in:${u}`)},{once:!0}),c.appendChild(f)}return c}});var zp={};L(zp,{nextStepIndex:()=>$p,stepLabels:()=>Hp,stepsRenderer:()=>qw});function Hp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=He(e.backLabel))!=null?t:"Back",skip:(s=(r=He(e.skipLabel))!=null?r:He(e.secondaryLabel))!=null?s:"Skip",next:(i=He(e.nextLabel))!=null?i:"Next",finish:(a=(o=He(e.finalLabel))!=null?o:He(e.ctaLabel))!=null?a:"Finish"}}function $p(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Dw(n){let e=n==null?void 0:n.steps,r=(Array.isArray(e)?e:[]).map(s=>{var o,a;if(typeof s=="string")return{title:s};let i=s&&typeof s=="object"?s:{};return{title:(o=He(i.title))!=null?o:He(i.label),body:(a=He(i.body))!=null?a:He(i.text)}});return r.length?r:[{}]}var He,qw,Up=k(()=>{"use strict";He=n=>typeof n=="string"&&n.trim()?n.trim():void 0;qw=(n,e)=>{let t=n.props,r=Dw(t),s=Hp(t),i=e.doc,o=0,a=i.createElement("div");a.className="scalebun-steps";let c=i.createElement("div");c.className="scalebun-steps-rail",c.setAttribute("role","progressbar"),c.setAttribute("aria-valuemin","1"),c.setAttribute("aria-valuemax",String(r.length));let l=r.map(()=>{let b=i.createElement("span");return b.className="scalebun-steps-dot",c.appendChild(b),b});a.appendChild(c);let u=i.createElement("div");u.className="scalebun-steps-page";let d=i.createElement("div");d.className="scalebun-steps-title";let p=i.createElement("div");p.className="scalebun-steps-body",u.appendChild(d),u.appendChild(p),a.appendChild(u);let f=i.createElement("div");f.className="scalebun-steps-nav";let m=(b,E)=>{let w=i.createElement("button");return w.type="button",w.className=`scalebun-btn ${E}`,w.textContent=b,f.appendChild(w),w},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),x=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var w,I,S;let b=(w=r[o])!=null?w:{};d.textContent=(I=b.title)!=null?I:"",d.style.display=b.title?"":"none",p.textContent=(S=b.body)!=null?S:"",p.style.display=b.body?"":"none";let E=o+1>=r.length;x.textContent=E?s.finish:s.next,h.hidden=o===0,g.hidden=E,c.setAttribute("aria-valuenow",String(o+1)),c.setAttribute("aria-label",`Step ${o+1} of ${r.length}`),l.forEach((C,M)=>{C.setAttribute("data-state",M<o?"done":M===o?"current":"todo"),M===o?C.setAttribute("aria-current","step"):C.removeAttribute("aria-current")})},y=b=>{var w;let E=$p(o,r.length,b);E!==o&&(o=E,v(),(w=e.onInteraction)==null||w.call(e,`step-${o+1}`))};return h.addEventListener("click",()=>y("back")),g.addEventListener("click",()=>{var b;return(b=e.onInteraction)==null?void 0:b.call(e,"step-skip")}),x.addEventListener("click",()=>{var b;if(o+1>=r.length){(b=e.onInteraction)==null||b.call(e,"step-finish");return}y("next")}),v(),a}});async function Vp(n){let e=new Set;for(let t of n)wo[t]&&!Ur[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{Ur[t]=await wo[t]()}catch{}}))}var wo,kA,Wp=k(()=>{"use strict";Wr();wo={markdown:()=>Promise.resolve().then(()=>(lp(),cp)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(up(),dp)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(Gr(),Kr)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(hp(),mp)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(bp(),gp)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(vp(),yp)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(xp(),wp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(kp(),Sp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(Cp(),Ip)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(Mp(),Tp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(_p(),Lp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(Np(),Op)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(Fp(),Bp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(qp(),Dp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Up(),zp)).then(n=>n.stepsRenderer)},kA=Object.keys(wo)});var jp={};L(jp,{bannerSurface:()=>Hw});function Hw(n){var o,a,c,l,u,d,p;let{doc:e,variant:t}=n,r=((o=t.surfaceOptions)==null?void 0:o.placement)==="bottom",s=e.createElement("div");s.className="scalebun-banner"+(r?" scalebun-banner-bottom":""),s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"region"),s.setAttribute("aria-live",(u=(l=t.a11y)==null?void 0:l.liveRegion)!=null?u:"polite"),(d=t.a11y)!=null&&d.labelledBy&&s.setAttribute("aria-label",t.a11y.labelledBy);let i=e.createElement("div");i.className="scalebun-body";for(let f of oe(n))i.appendChild(f);if(s.appendChild(i),((p=t.dismiss)==null?void 0:p.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}return{el:s,destroy:()=>s.remove()}}var Kp=k(()=>{"use strict";Te()});var Gp={};L(Gp,{toastSurface:()=>$w});function $w(n){var l,u,d,p,f,m;let{doc:e,variant:t}=n,r=e.createElement("div");r.className="scalebun-toast",r.setAttribute("role",(u=(l=t.a11y)==null?void 0:l.role)!=null?u:"status"),r.setAttribute("aria-live",(p=(d=t.a11y)==null?void 0:d.liveRegion)!=null?p:"polite");let s=e.createElement("div");s.className="scalebun-body";for(let h of oe(n))s.appendChild(h);if(r.appendChild(s),((f=t.dismiss)==null?void 0:f.xButton)!==!1){let h=e.createElement("button");h.type="button",h.className="scalebun-x",h.setAttribute("aria-label","Dismiss"),h.textContent="\xD7",h.addEventListener("click",()=>n.requestClose("x")),r.appendChild(h)}let i=null,o=(m=t.dismiss)==null?void 0:m.autoDismissMs,a=()=>{o&&o>0&&(i=setTimeout(()=>n.requestClose("auto"),o))},c=()=>{i!=null&&(clearTimeout(i),i=null)};return o&&o>0&&(r.addEventListener("mouseenter",c),r.addEventListener("mouseleave",a),a()),{el:r,destroy:()=>{c(),r.remove()}}}var Xp=k(()=>{"use strict";Te()});function Uw(n){if(n.hasAttribute("hidden")||n.getAttribute("aria-hidden")==="true"||n.closest("[inert]"))return!1;if(typeof getComputedStyle!="undefined"){let e=getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1}return!0}function Yp(n){return Array.from(n.querySelectorAll(zw)).filter(Uw)}function Vw(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Nt(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Yp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=Vw(n),o=i?s.indexOf(i):-1;r.preventDefault(),r.shiftKey?o=o<=0?s.length-1:o-1:o=o===-1||o>=s.length-1?0:o+1,s[o].focus()};return n.addEventListener("keydown",t),()=>n.removeEventListener("keydown",t)}function Qr(n){let e=Yp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Zr(n,e=document){let t=e.body;if(!t)return()=>{};let r=[];for(let s of Array.from(t.children))s===n||s.contains(n)||(r.push({el:s,hadInert:s.hasAttribute("inert"),ariaWas:s.getAttribute("aria-hidden")}),s.setAttribute("inert",""),s.setAttribute("aria-hidden","true"));return()=>{for(let{el:s,hadInert:i,ariaWas:o}of r)i||s.removeAttribute("inert"),o==null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",o)}}function Bt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var zw,es=k(()=>{"use strict";zw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Jp={};L(Jp,{modalSurface:()=>jw});function jw(n){var h,g,x,v,y,b,E;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(x=r.role)!=null?x:"dialog"),a.setAttribute("aria-modal","true");let c=(y=(v=t.surfaceOptions)==null?void 0:v.size)!=null?y:"md";a.setAttribute("data-size",c);let l=oe(n),u=l.find(w=>w.classList.contains("scalebun-h"));if(u){let w=`scalebun-mt-${++Ww}`;u.id=w,a.setAttribute("aria-labelledby",w)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x scalebun-modal-x",w.setAttribute("aria-label","Close dialog"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),a.appendChild(w)}for(let w of l)a.appendChild(w);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",w=>{w.target===o&&n.requestClose("backdrop")});let d=w=>{w.key==="Escape"&&s.escClose!==!1&&(w.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Nt(a,e),f=(E=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?E:o,m=Zr(f,e);return{el:o,afterMount:()=>Qr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var Ww,Qp=k(()=>{"use strict";Te();es();Ww=0});var nf={};L(nf,{slideoverSurface:()=>Xw});function Kw(n,e){try{let t=localStorage.getItem(tf(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(ef,Math.max(Zp,r)):e}catch{return e}}function Gw(n,e){try{localStorage.setItem(tf(n),String(Math.round(e)))}catch{}}function Xw(n){var g,x,v,y,b,E,w,I,S,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((x=t.surfaceOptions)==null?void 0:x.resizable)!==!1,a=!!((v=t.surfaceOptions)!=null&&v.pinnable),c=e.createElement("div");c.className="scalebun-slideover "+(s?"scalebun-slideover-bottom":i?"scalebun-slideover-left":"scalebun-slideover-right"),c.setAttribute("role",(b=(y=t.a11y)==null?void 0:y.role)!=null?b:s?"dialog":"complementary"),c.setAttribute("aria-label",(w=(E=t.a11y)==null?void 0:E.labelledBy)!=null?w:t.name);let l=Kw(t.id,(S=(I=t.surfaceOptions)==null?void 0:I.maxWidth)!=null?S:380),u=()=>{s||(c.style.width=`${l}px`)};u();let d=e.createElement("div");if(d.className="scalebun-so-header",a){let M=e.createElement("button");M.type="button",M.className="scalebun-x scalebun-so-pin";let R=`scalebun_inapp_slideover_pin_${t.id}`,A=!1;try{A=localStorage.getItem(R)==="1"}catch{}let O=()=>{c.setAttribute("data-pinned",A?"true":"false"),M.setAttribute("aria-pressed",A?"true":"false"),M.title=A?"Unpin":"Pin",M.textContent=A?"\u{1F4CC}":"\u{1F4CD}"};M.addEventListener("click",()=>{A=!A;try{localStorage.setItem(R,A?"1":"0")}catch{}O()}),O(),d.appendChild(M)}if(((C=t.dismiss)==null?void 0:C.xButton)!==!1){let M=e.createElement("button");M.type="button",M.className="scalebun-x",M.setAttribute("aria-label","Close panel"),M.textContent="\xD7",M.addEventListener("click",()=>n.requestClose("x")),d.appendChild(M)}c.appendChild(d);let p=e.createElement("div");p.className="scalebun-so-body";for(let M of oe(n))p.appendChild(M);c.appendChild(p);let f=null,m=null;if(o){let M=e.createElement("div");M.className="scalebun-so-resize",M.setAttribute("role","separator"),M.setAttribute("aria-orientation","vertical"),M.addEventListener("mousedown",R=>{R.preventDefault();let A=R.clientX,O=l;f=z=>{let D=i?z.clientX-A:A-z.clientX;l=Math.min(ef,Math.max(Zp,O+D)),u()},m=()=>{Gw(t.id,l),h()},e.addEventListener("mousemove",f),e.addEventListener("mouseup",m)}),c.appendChild(M)}let h=()=>{f&&e.removeEventListener("mousemove",f),m&&e.removeEventListener("mouseup",m),f=m=null};return{el:c,destroy:()=>{h(),c.remove()}}}var Zp,ef,tf,rf=k(()=>{"use strict";Te();Zp=280,ef=640,tf=n=>`scalebun_inapp_slideover_${n}`});function sf(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function an(n,e,t,r=[]){try{for(let s of[...n.querySelectorAll(e)])r.push(s)}catch{}if(t)for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;i&&an(i,e,t,r)}return r}function xo(n,e,t){let r=null;try{r=n.querySelector(e)}catch{return null}if(r)return r;if(!t)return null;for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;if(i){let o=xo(i,e,!0);if(o)return o}}return null}function Yw(n,e,t,r){let s=e.trim(),i=an(n,t!=null?t:"*",r).filter(o=>{var a;return((a=o.textContent)!=null?a:"").trim()===s});return i.length?i.reduce((o,a)=>a.querySelectorAll("*").length<o.querySelectorAll("*").length?a:o):null}function Jw(n,e,t,r){var a,c;let s=e?`[role="${sf(e)}"]`:"button,a,[role],input,select,textarea,summary",i=an(n,s,r);if(!t)return(a=i[0])!=null?a:null;let o=t.trim();return(c=i.find(l=>{var u,d;return((d=(u=l.getAttribute("aria-label"))!=null?u:l.textContent)!=null?d:"").trim()===o}))!=null?c:null}function Qw(n){var e;if(typeof document=="undefined"||!document.evaluate)return null;try{return(e=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue)!=null?e:null}catch{return null}}function Zw(n,e,t){var r;switch(n.kind){case"selector":return xo(e,n.value,t);case"data-attr":return xo(e,`[data-scalebun-anchor="${sf(n.value)}"]`,t);case"nth":return(r=an(e,n.selector,t)[n.index])!=null?r:null;case"text":return Yw(e,n.value,n.scope,t);case"aria":return Jw(e,n.role,n.name,t);case"xpath":return Qw(n.value)}}function of(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of an(n,"[data-scalebun-anchor]",!0)){let i=(r=s.getAttribute("data-scalebun-anchor"))==null?void 0:r.trim();if(i&&t.add(i),t.size>=e)break}return[...t].sort()}function pt(n,e=typeof document!="undefined"?document:void 0){let t=n.shadowPiercing!==!1,r=0;for(let s=0;s<n.strategies.length;s++){r++;let i=e?Zw(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function af(n){return n.el!=null&&n.strategyIndex>0}var ts=k(()=>{"use strict"});function So(n,e,t){switch(n){case"top":return e.y-t.y;case"bottom":return t.y+t.height-(e.y+e.height);case"left":return e.x-t.x;case"right":return t.x+t.width-(e.x+e.width)}}function cf(n,e,t,r,s){let i=(cn(n)?t.height:t.width)+s;return So(n,e,r)>=i}function ns(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function rs(n){var h,g,x,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(x=n.arrowSize)!=null?x:8,s=n.anchor,i=n.tooltip,o=n.boundary,a=(v=n.preferred)!=null?v:{side:"bottom",align:"center"},c=a.side,l=!1;if(!cf(c,s,i,o,e)){let y=ex[c];(cf(y,s,i,o,e)||So(y,s,o)>So(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&cn(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;cn(c)?(p=c==="top"?s.y-i.height-e:s.y+s.height+e,d=u==="start"?s.x:u==="end"?s.x+s.width-i.width:s.x+s.width/2-i.width/2):(d=c==="left"?s.x-i.width-e:s.x+s.width+e,p=u==="start"?s.y:u==="end"?s.y+s.height-i.height:s.y+s.height/2-i.height/2);let f=!1;if(cn(c)){let y=ns(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=ns(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return cn(c)?(m.x=ns(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=ns(s.y+s.height/2-p,r,i.height-r),m.x=c==="left"?i.width:0),{placement:{side:c,align:u},x:d,y:p,arrow:m,flipped:l,shifted:f}}var ex,cn,ko=k(()=>{"use strict";ex={top:"bottom",bottom:"top",left:"right",right:"left"},cn=n=>n==="top"||n==="bottom"});var tt,ss=k(()=>{"use strict";tt=class{constructor(){this.mo=null;this.subs=new Set;this.scheduled=!1}start(){this.mo||typeof MutationObserver=="undefined"||typeof document=="undefined"||(this.mo=new MutationObserver(()=>this.notify()),this.mo.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}))}onChange(e){return this.subs.add(e),this.start(),()=>{this.subs.delete(e),this.subs.size||this.dispose()}}notify(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(let e of[...this.subs])try{e()}catch{}}))}dispose(){var e;(e=this.mo)==null||e.disconnect(),this.mo=null,this.subs.clear()}}});function tx(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function $e(n){let e=[{kind:"selector",value:n}],t=n.match(/^\[data-scalebun-anchor=["']?([^"'\]]+)["']?\]$/);return t&&e.push({kind:"data-attr",value:t[1]}),{strategies:e,shadowPiercing:!0}}function lf(n){var r,s,i,o;let e=(r=n==null?void 0:n.strategies)!=null?r:[],t=(s=e.find(a=>a.kind==="selector"))!=null?s:e[0];if(!t)return"";switch(t.kind){case"selector":case"data-attr":case"text":case"xpath":return t.value;case"nth":return`${t.selector}[${t.index}]`;case"aria":return`aria:${(i=t.role)!=null?i:"*"}/${(o=t.name)!=null?o:"*"}`}}var Me,Ft=k(()=>{"use strict";ts();ko();ss();Me=class{constructor(e){this.opts=e;this.raf=null;this.lostTimer=null;this.lastStrategy=-1;this.hadEl=!1;this.missed=!1;var t,r;this.hub=(t=e.hub)!=null?t:new tt,this.ownHub=!e.hub,this.now=(r=e.now)!=null?r:()=>Date.now()}start(){this.reposition(),this.unsubMo=this.hub.onChange(()=>this.reposition()),this.onScrollResize=()=>this.schedule(),typeof window!="undefined"&&(window.addEventListener("scroll",this.onScrollResize,!0),window.addEventListener("resize",this.onScrollResize))}reposition(){var t,r,s,i,o,a;let e=pt(this.opts.spec);if(e.el){this.clearLost(),this.hadEl||(r=(t=this.opts.hooks).onFound)==null||r.call(t,e.el),af(e)&&e.strategyIndex!==this.lastStrategy&&((i=(s=this.opts.hooks).onHeal)==null||i.call(s,e.strategyIndex)),this.lastStrategy=e.strategyIndex,this.hadEl=!0,this.missed=!1;let c=e.el.getBoundingClientRect(),l=rs({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:tx(),preferred:this.opts.preferred,offset:this.opts.offset});this.opts.hooks.onReposition(l,e.el)}else this.missed||(this.missed=!0,(a=(o=this.opts.hooks).onMiss)==null||a.call(o)),this.hadEl=!1,this.armLost()}schedule(){if(this.raf!=null)return;let e=()=>{this.raf=null,this.reposition()};this.raf=typeof requestAnimationFrame!="undefined"?requestAnimationFrame(e):setTimeout(e,16)}armLost(){var e;this.lostTimer==null&&(this.lostTimer=setTimeout(()=>{var t,r;this.lostTimer=null,pt(this.opts.spec).el==null&&(this.hadEl=!1,(r=(t=this.opts.hooks).onLost)==null||r.call(t,"not-found"))},(e=this.opts.graceMs)!=null?e:1500))}clearLost(){this.lostTimer!=null&&(clearTimeout(this.lostTimer),this.lostTimer=null)}stop(){var e;(e=this.unsubMo)==null||e.call(this),this.unsubMo=void 0,this.onScrollResize&&typeof window!="undefined"&&(window.removeEventListener("scroll",this.onScrollResize,!0),window.removeEventListener("resize",this.onScrollResize)),this.onScrollResize=void 0,this.raf!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(this.raf),this.raf=null,this.clearLost(),this.ownHub&&this.hub.dispose()}}});var df={};L(df,{popoverSurface:()=>sx});function nx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function rx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function sx(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=nx(n),s=e.createElement("div");s.className="scalebun-popover",s.setAttribute("role",(l=(c=t.a11y)==null?void 0:c.role)!=null?l:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=(u=t.surfaceOptions)==null?void 0:u.maxWidth;if(i&&(s.style.maxWidth=`${i}px`),((d=t.dismiss)==null?void 0:d.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x scalebun-pop-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}let o=e.createElement("div");o.className="scalebun-pop-body";for(let f of oe(n))o.appendChild(f);s.appendChild(o);let a=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||320,height:s.offsetHeight||120}),preferred:{side:rx(n),align:"center"},offset:(p=t.surfaceOptions)==null?void 0:p.offset,hooks:{onReposition:f=>{s.style.top=`${f.y}px`,s.style.left=`${f.x}px`,s.setAttribute("data-placement",f.placement.side)},onHeal:()=>{var f;return(f=n.metrics)==null?void 0:f.recordAnchorRetry()},onMiss:()=>{var f;return(f=n.metrics)==null?void 0:f.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>a==null?void 0:a.start(),destroy:()=>{a==null||a.stop(),s.remove()}}}var uf=k(()=>{"use strict";Te();Ft()});var pf={};L(pf,{coachmarkSurface:()=>ax});function ix(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function ox(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ax(n){var p,f,m,h,g,x;let{doc:e,variant:t}=n,r=ix(n),s=((p=t.surfaceOptions)==null?void 0:p.spotlight)!==!1,i=e.createElement("div");i.className="scalebun-coach-root";let o=s?e.createElement("div"):null;o&&(o.className="scalebun-coach-spot",i.appendChild(o));let a=e.createElement("div");a.className="scalebun-coachmark",a.setAttribute("role",(m=(f=t.a11y)==null?void 0:f.role)!=null?m:"dialog"),a.setAttribute("aria-label",t.name),a.style.position="absolute";let c=(h=t.surfaceOptions)==null?void 0:h.maxWidth;if(c&&(a.style.maxWidth=`${c}px`),((g=t.dismiss)==null?void 0:g.xButton)!==!1){let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","Dismiss"),v.textContent="\xD7",v.addEventListener("click",()=>n.requestClose("x")),a.appendChild(v)}let l=e.createElement("div");l.className="scalebun-pop-body";for(let v of oe(n))l.appendChild(v);a.appendChild(l),i.appendChild(a);let u=6,d=r?new Me({spec:$e(r),size:()=>({width:a.offsetWidth||300,height:a.offsetHeight||120}),preferred:{side:ox(n),align:"center"},offset:(x=t.surfaceOptions)==null?void 0:x.offset,hooks:{onReposition:(v,y)=>{if(a.style.top=`${v.y}px`,a.style.left=`${v.x}px`,a.setAttribute("data-placement",v.placement.side),o){let b=y.getBoundingClientRect();o.style.top=`${b.y-u}px`,o.style.left=`${b.x-u}px`,o.style.width=`${b.width+u*2}px`,o.style.height=`${b.height+u*2}px`}},onHeal:()=>{var v;return(v=n.metrics)==null?void 0:v.recordAnchorRetry()},onMiss:()=>{var v;return(v=n.metrics)==null?void 0:v.recordFailedSelector(r)},onLost:v=>{var y;(y=n.metrics)==null||y.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${v}`),n.requestClose("auto")}}}):null;return{el:i,afterMount:()=>d==null?void 0:d.start(),destroy:()=>{d==null||d.stop(),i.remove()}}}var ff=k(()=>{"use strict";Te();Ft()});function Dt(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Dt(l,e));if("any"in n)return n.any.some(l=>Dt(l,e));if("not"in n)return!Dt(n.not,e);if("flag"in n)return!!((i=e.flags)!=null&&i[n.flag])===((o=n.is)!=null?o:!0);let t=(a=e.props)==null?void 0:a[n.prop],r=(c=n.op)!=null?c:"exists",s=typeof t=="number"&&typeof n.value=="number";switch(r){case"exists":return t!=null;case"eq":return t===n.value;case"ne":return t!==n.value;case"gt":return s&&t>n.value;case"lt":return s&&t<n.value;case"gte":return s&&t>=n.value;case"lte":return s&&t<=n.value;case"in":return Array.isArray(n.value)&&n.value.includes(t);default:return!1}}function mf(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Dt(t.when,e))return t.to}return null}var hf=k(()=>{"use strict"});var qt,Eo=k(()=>{"use strict";hf();qt=class{constructor(e){this.deps=e;this.tour=null;this.index=0;this.status="idle";this.startedAt=0;this.token=0;this.stepCleanup=null;this.pendingEvent=null;this.context={}}get state(){var e,t;return{tourId:(t=(e=this.tour)==null?void 0:e.id)!=null?t:null,index:this.index,status:this.status}}start(e,t){var s,i,o,a,c;this.status==="running"&&this.end("abandoned","superseded"),this.tour=e,this.context=(s=t==null?void 0:t.context)!=null?s:{},this.status="running",this.startedAt=this.deps.now();let r=!!(t!=null&&t.resume);this.index=r&&(a=(o=(i=this.deps).loadIndex)==null?void 0:o.call(i,e.id))!=null?a:0,(this.index>=e.steps.length||this.index<0)&&(this.index=0),this.deps.emit("$coachmark_tour_started",{tourId:e.id,version:(c=e.version)!=null?c:1,resumed:r&&this.index>0,steps:e.steps.length}),this.enter(this.index)}next(){this.status==="running"&&this.completeStep("next")}back(){if(this.status==="running"&&this.index>0){let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_back",{tourId:this.tour.id,stepId:e.id,index:this.index}),this.enter(this.index-1)}}skip(){if(this.status!=="running")return;let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_skipped",{tourId:this.tour.id,stepId:e.id,index:this.index,bySystem:!1}),this.enter(this.index+1)}notify(e){this.status==="running"&&this.pendingEvent===e&&this.completeStep("event")}end(e="abandoned",t="api"){var s,i,o;if(this.status!=="running")return;let r=this.tour;if(this.clearStep(),this.status=e,this.deps.hide(),(i=(s=this.deps).persist)==null||i.call(s,r.id,-1),e==="completed")this.deps.emit("$coachmark_tour_completed",{tourId:r.id,version:(o=r.version)!=null?o:1,steps:r.steps.length,totalMs:this.deps.now()-this.startedAt});else{let a=r.steps[this.index];this.deps.emit("$coachmark_tour_abandoned",{tourId:r.id,stepId:a==null?void 0:a.id,index:this.index,method:t})}}async enter(e){var o,a,c,l;this.clearStep();let t=this.tour;if(!t||this.status!=="running")return;if(e>=t.steps.length)return this.end("completed");this.index=e;let r=++this.token,s=t.steps[e];if(s.skipIf&&Dt(s.skipIf,this.context))return this.deps.emit("$coachmark_step_skipped",{tourId:t.id,stepId:s.id,index:e,bySystem:!0,reason:"skipIf"}),void this.enter(e+1);(a=(o=this.deps).persist)==null||a.call(o,t.id,e);let i=null;if(s.anchor){let u=(c=s.waitConditions)!=null?c:["exists","visible"],d=()=>this.deps.resolveAnchor(s.anchor).el,p=await this.deps.waitFor(d,{conditions:u,timeoutMs:(l=s.timeoutMs)!=null?l:5e3},this.deps.hub);if(r!==this.token||this.status!=="running")return;if(!p.ok)return this.deps.emit("$coachmark_anchor_failed",{tourId:t.id,stepId:s.id,index:e,reason:p.reason,strategiesTried:this.deps.resolveAnchor(s.anchor).strategiesTried}),this.applyFallback(s,e);let f=this.deps.resolveAnchor(s.anchor);f.strategyIndex>0&&this.deps.emit("$coachmark_anchor_healed",{tourId:t.id,stepId:s.id,index:e,winningStrategy:f.strategyIndex}),i=p.el}this.paint(s,i,e,!1)}applyFallback(e,t){var s;let r=(s=e.fallback)!=null?s:"modal";if(this.deps.emit("$coachmark_step_fallback",{tourId:this.tour.id,stepId:e.id,index:t,fallback:r,reason:"anchor-fail"}),r==="skip")return void this.enter(t+1);if(r==="end")return this.end("abandoned","anchor-fail");this.paint(e,null,t,!0)}paint(e,t,r,s){this.deps.render({step:e,el:t,index:r,total:this.tour.steps.length,degraded:s,controls:this.controls()}),this.deps.emit("$coachmark_step_entered",{tourId:this.tour.id,stepId:e.id,index:r,anchored:!!t,degraded:s}),this.armAdvance(e,t)}armAdvance(e,t){var s;let r=(s=e.advance)!=null?s:"next";if(this.pendingEvent=null,r!=="next")if(r==="anchor-click"&&t){let i=()=>this.completeStep("click");t.addEventListener("click",i,{once:!0}),this.stepCleanup=()=>t.removeEventListener("click",i)}else if(r==="anchor-gone"&&e.anchor){let i=this.token,o=()=>this.deps.resolveAnchor(e.anchor).el;this.deps.waitFor(o,{conditions:["gone"],timeoutMs:36e5},this.deps.hub).then(a=>{a.ok&&i===this.token&&this.status==="running"&&this.completeStep("gone")})}else if(typeof r=="object"&&"timer"in r){let i=setTimeout(()=>this.completeStep("timer"),r.timer);this.stepCleanup=()=>clearTimeout(i)}else typeof r=="object"&&"event"in r&&(this.pendingEvent=r.event)}completeStep(e){if(this.status!=="running"||!this.tour)return;let t=this.tour.steps[this.index];this.deps.emit("$coachmark_step_completed",{tourId:this.tour.id,stepId:t.id,index:this.index,advanceBy:e});let r=mf(t.next,this.context);if(r){let s=this.tour.steps.findIndex(i=>i.id===r);if(s>=0)return this.deps.emit("$coachmark_branched",{tourId:this.tour.id,fromStep:t.id,toStep:r,index:s}),void this.enter(s)}this.enter(this.index+1)}controls(){return{next:()=>this.next(),back:()=>this.back(),skip:()=>this.skip(),close:()=>this.end("abandoned","dismiss")}}clearStep(){var e;(e=this.stepCleanup)==null||e.call(this),this.stepCleanup=null,this.pendingEvent=null,this.token++}dispose(){this.clearStep(),this.status="idle",this.tour=null}}});function Co(n,e){let t=n.width*n.height;if(t<=0)return 0;let r=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),s=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return r*s/t}function Io(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function gf(n){if(n)return n;let e=typeof window!="undefined"?window.innerWidth:0,t=typeof window!="undefined"?window.innerHeight:0;return{x:0,y:0,width:e,height:t}}function bf(n){if(n.disabled)return!1;let e=n.getBoundingClientRect();if(e.width===0||e.height===0)return!1;let t=typeof document!="undefined"&&document.elementFromPoint?document.elementFromPoint(e.left+e.width/2,e.top+e.height/2):null;return t?n===t||n.contains(t)||t.contains(n):!1}function cx(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&Co(Io(n),gf(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!bf(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(Io(n));if(o!==t.v)return t.v=o,r.n=0,!1;if(r.n+=1,r.n<((i=e.stableFrames)!=null?i:2))return!1}return!0}function lx(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&Co(Io(n),gf(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!bf(n)?"not-clickable":"timeout":"not-found"}function is(n,e,t){return new Promise(r=>{var p,f;let s=!1,i=()=>{},o,a,c={v:""},l={n:0},u=(m,h,g)=>{s||(s=!0,i(),o&&clearTimeout(o),a&&clearInterval(a),r({ok:m,el:h,reason:g}))},d=()=>{if(s)return;let m=n();cx(m,e,c,l)&&u(!0,e.conditions.includes("gone")?null:m)};i=t.onChange(d),a=setInterval(d,(p=e.pollMs)!=null?p:100),o=setTimeout(()=>{let m=n();u(!1,m,lx(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var os=k(()=>{"use strict"});var yf={};L(yf,{tourSurface:()=>ux});function dx(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?$e(n.anchor):void 0,title:n.title,body:n.body,placement:n.anchor?{side:e,align:"center"}:void 0,advance:(t=n.advance)!=null?t:"next",fallback:"modal"}}function ux(n){var u,d;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.steps)!=null?d:[],s=new tt,i=e.createElement("div");i.className="scalebun-tour-root";let o=()=>{},a=p=>{var w;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(w=p.step.title)!=null?w:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let I=e.createElement("h2");I.className="scalebun-h",I.textContent=p.step.title,f.appendChild(I)}if(p.step.body){let I=e.createElement("p");I.className="scalebun-text",I.textContent=p.step.body,f.appendChild(I)}let m=e.createElement("div");m.className="scalebun-tour-nav";let h=e.createElement("span");h.className="scalebun-tour-prog",h.textContent=`${p.index+1} / ${p.total}`,m.appendChild(h);let g=e.createElement("span");g.className="scalebun-tour-btns";let x=(I,S,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${S}`,M.textContent=I,M.addEventListener("click",C),M};p.index>0&&g.appendChild(x("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(x("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(x(p.index+1>=p.total?"Done":"Next","scalebun-btn-primary",p.controls.next)),m.appendChild(g),f.appendChild(m);let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","End tour"),v.textContent="\xD7",v.addEventListener("click",p.controls.close),f.appendChild(v),i.appendChild(f);let y=null,b=null,E=()=>{b==null||b.stop(),b=null,y==null||y.remove(),y=null,f.style.position="fixed",f.style.top="",f.style.left="",f.removeAttribute("data-placement"),f.classList.add("scalebun-tour-center")};if(p.el&&p.step.anchor){let I=lf(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let S=6;b=new Me({spec:p.step.anchor,size:()=>({width:f.offsetWidth||300,height:f.offsetHeight||120}),preferred:p.step.placement,hooks:{onReposition:(C,M)=>{f.style.top=`${C.y}px`,f.style.left=`${C.x}px`,f.setAttribute("data-placement",C.placement.side);let R=M.getBoundingClientRect();y.style.top=`${R.y-S}px`,y.style.left=`${R.x-S}px`,y.style.width=`${R.width+S*2}px`,y.style.height=`${R.height+S*2}px`},onHeal:()=>{var C;return(C=n.metrics)==null?void 0:C.recordAnchorRetry()},onMiss:()=>{var C;return(C=n.metrics)==null?void 0:C.recordFailedSelector(I)},onLost:C=>{var M;E(),(M=n.metrics)==null||M.recordFailedSelector(I),n.hooks.onInteraction(`anchor-lost:${C}`)}}}),b.start()}else f.classList.add("scalebun-tour-center");return()=>{b==null||b.stop(),y==null||y.remove(),f.remove()}},c=new qt({hub:s,resolveAnchor:pt,waitFor:is,render:p=>{o(),o=a(p)},hide:()=>{o(),o=()=>{}},emit:p=>n.hooks.onInteraction(p),now:()=>Date.now(),persist:(p,f)=>{try{f<0?localStorage.removeItem(Ao(p)):localStorage.setItem(Ao(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(Ao(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(dx)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var Ao,vf=k(()=>{"use strict";Eo();ts();os();ss();Ft();Ao=n=>`scalebun_inapp_tour_${n}`});var wf={};L(wf,{hotspotSurface:()=>mx});function px(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function fx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function mx(n){let{doc:e,variant:t}=n,r=px(n),s=e.createElement("div");s.className="scalebun-hotspot-root";let i=e.createElement("button");i.type="button",i.className="scalebun-beacon",i.setAttribute("aria-label",t.name),i.setAttribute("aria-expanded","false"),s.appendChild(i);let o=e.createElement("div");o.className="scalebun-beacon-card",o.setAttribute("role","tooltip"),o.hidden=!0;for(let d of oe(n))o.appendChild(d);s.appendChild(o);let a=!1,c=d=>{a!==d&&(a=d,o.hidden=!d,i.setAttribute("aria-expanded",String(d)),d&&n.hooks.onInteraction("hotspot_reveal"))};i.addEventListener("mouseenter",()=>c(!0)),i.addEventListener("focus",()=>c(!0)),i.addEventListener("click",()=>c(!a));let l=!1;o.addEventListener("mouseenter",()=>l=!0),o.addEventListener("mouseleave",()=>{l=!1,c(!1)}),i.addEventListener("mouseleave",()=>setTimeout(()=>!l&&c(!1),120));let u=r?new Me({spec:$e(r),size:()=>({width:o.offsetWidth||240,height:o.offsetHeight||90}),preferred:{side:fx(n),align:"center"},hooks:{onReposition:(d,p)=>{let f=p.getBoundingClientRect();i.style.top=`${f.y-5}px`,i.style.left=`${f.x+f.width-5}px`,o.style.top=`${d.y}px`,o.style.left=`${d.x}px`,o.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:d=>{var p;(p=n.metrics)==null||p.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${d}`),n.requestClose("auto")}}}):null;return{el:s,afterMount:()=>u==null?void 0:u.start(),destroy:()=>{u==null||u.stop(),s.remove()}}}var xf=k(()=>{"use strict";Te();Ft()});var Sf={};L(Sf,{toolbarSurface:()=>bx});function hx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function gx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function bx(n){var a,c,l,u;let{doc:e,variant:t}=n,r=hx(n),s=e.createElement("div");s.className="scalebun-toolbar-callout",s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=e.createElement("div");i.className="scalebun-pop-body";for(let d of oe(n))i.appendChild(d);if(s.appendChild(i),((l=t.dismiss)==null?void 0:l.xButton)!==!1){let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-pop-x",d.setAttribute("aria-label","Dismiss"),d.textContent="\xD7",d.addEventListener("click",()=>n.requestClose("x")),s.appendChild(d)}let o=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||220,height:s.offsetHeight||80}),preferred:{side:gx(n),align:"center"},offset:(u=t.surfaceOptions)==null?void 0:u.offset,hooks:{onReposition:d=>{s.style.top=`${d.y}px`,s.style.left=`${d.x}px`,s.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>o==null?void 0:o.start(),destroy:()=>{o==null||o.stop(),s.remove()}}}var kf=k(()=>{"use strict";Te();Ft()});var Ef={};L(Ef,{paletteSurface:()=>yx});function yx(n){var x,v,y;let{doc:e,variant:t}=n,r=(v=(x=t.surfaceOptions)==null?void 0:x.commands)!=null?v:[],s=Bt(e),i=e.createElement("div");i.className="scalebun-palette-backdrop";let o=e.createElement("div");o.className="scalebun-palette",o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.name);let a=e.createElement("input");a.className="scalebun-palette-input",a.type="text",a.setAttribute("role","combobox"),a.setAttribute("aria-expanded","true"),a.placeholder="Type a command or search\u2026",o.appendChild(a);let c=e.createElement("ul");c.className="scalebun-palette-list",c.setAttribute("role","listbox"),o.appendChild(c),i.appendChild(o);let l=r.slice(),u=0,d=b=>{if(b){if(n.hooks.onCtaClick(b.action),n.hooks.onInteraction(`palette_select:${b.id}`),b.action==="link"&&b.value)try{typeof window!="undefined"&&window.location.assign(b.value)}catch{}n.requestClose("cta")}},p=()=>{if(c.replaceChildren(),l.length===0){let b=e.createElement("li");b.className="scalebun-palette-empty",b.textContent="No matches",c.appendChild(b);return}l.forEach((b,E)=>{let w=e.createElement("li");w.className="scalebun-palette-item"+(E===u?" active":""),w.setAttribute("role","option"),w.setAttribute("aria-selected",String(E===u));let I=e.createElement("span");if(I.className="scalebun-palette-label",I.textContent=b.label,w.appendChild(I),b.hint){let S=e.createElement("span");S.className="scalebun-palette-hint",S.textContent=b.hint,w.appendChild(S)}w.addEventListener("mousemove",()=>{u=E,f()}),w.addEventListener("click",()=>d(b)),c.appendChild(w)})},f=()=>{Array.from(c.children).forEach((b,E)=>{b.classList.toggle("active",E===u),b.setAttribute("aria-selected",String(E===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(E=>E.label.toLowerCase().includes(b)||E.action.toLowerCase().includes(b)):r.slice(),u=0,p()};a.addEventListener("input",m);let h=b=>{b.key==="Escape"?(b.stopPropagation(),n.requestClose("esc")):b.key==="ArrowDown"?(b.preventDefault(),u=Math.min(l.length-1,u+1),f()):b.key==="ArrowUp"?(b.preventDefault(),u=Math.max(0,u-1),f()):b.key==="Enter"&&(b.preventDefault(),d(l[u]))};o.addEventListener("keydown",h),((y=t.dismiss)==null?void 0:y.backdropClose)!==!1&&i.addEventListener("mousedown",b=>{b.target===i&&n.requestClose("backdrop")});let g=Nt(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var If=k(()=>{"use strict";es()});var Cf={};L(Cf,{panelSurface:()=>vx});function vx(n){var g,x,v,y,b,E;let{doc:e,variant:t}=n,r=((g=t.surfaceOptions)==null?void 0:g.placement)==="left",s=e.createElement("div");s.className="scalebun-panel "+(r?"scalebun-panel-left":"scalebun-panel-right"),s.setAttribute("role",(v=(x=t.a11y)==null?void 0:x.role)!=null?v:"complementary"),s.setAttribute("aria-label",t.name);let i=e.createElement("div");i.className="scalebun-panel-head";let o=e.createElement("div");if(o.className="scalebun-panel-title",o.textContent=t.name,i.appendChild(o),((y=t.dismiss)==null?void 0:y.xButton)!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Close panel"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),i.appendChild(w)}s.appendChild(i);let a=e.createElement("div");a.className="scalebun-panel-thread",a.setAttribute("role","log"),a.setAttribute("aria-live","polite"),s.appendChild(a);let c=(E=(b=t.blocks.find(w=>w.kind==="text"))==null?void 0:b.props)==null?void 0:E.text;typeof c=="string"&&f("assistant",c);let l=e.createElement("form");l.className="scalebun-panel-composer";let u=e.createElement("textarea");u.className="scalebun-panel-input",u.rows=1,u.placeholder="Ask anything\u2026";let d=e.createElement("button");d.type="submit",d.className="scalebun-btn scalebun-btn-primary scalebun-panel-send",d.textContent="Send",l.append(u,d),s.appendChild(l);let p=null;function f(w,I){let S=e.createElement("div");return S.className=`scalebun-bubble scalebun-bubble-${w}`,S.textContent=I,a.appendChild(S),a.scrollTop=a.scrollHeight,S}let m=w=>{w.preventDefault();let I=u.value.trim();I&&(f("user",I),u.value="",n.hooks.onInteraction(`ai_prompt:${I}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:w=>{var I;p||(p=f("assistant","")),p.textContent=((I=p.textContent)!=null?I:"")+w,a.scrollTop=a.scrollHeight},endAssistant:()=>{p==null||p.classList.remove("streaming"),p=null}};return s.scalebunStream=h,{el:s,destroy:()=>{l.removeEventListener("submit",m),s.remove()}}}var Af=k(()=>{"use strict"});var Tf={};L(Tf,{checklistSurface:()=>wx});function wx(n){var E,w,I,S,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((E=r==null?void 0:r.props)==null?void 0:E.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(I=(w=t.blocks.find(R=>R.kind==="heading"))==null?void 0:w.props)==null?void 0:I.text,o=new Set;try{let R=localStorage.getItem(Rf(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(Rf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(S=t.a11y)==null?void 0:S.role)!=null?C:"complementary"),c.setAttribute("aria-label",t.name);let l=e.createElement("div");l.className="scalebun-cl-head";let u=e.createElement("div");u.className="scalebun-cl-title",u.textContent=typeof i=="string"?i:t.name,l.appendChild(u);let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-cl-dock",d.setAttribute("aria-label","Minimize"),d.textContent="\u2014";let p=!1;if(d.addEventListener("click",()=>{p=!p,c.classList.toggle("collapsed",p),d.textContent=p?"\u25A2":"\u2014"}),l.appendChild(d),((M=t.dismiss)==null?void 0:M.xButton)!==!1){let R=e.createElement("button");R.type="button",R.className="scalebun-x",R.setAttribute("aria-label","Dismiss"),R.textContent="\xD7",R.addEventListener("click",()=>n.requestClose("x")),l.appendChild(R)}c.appendChild(l);let f=e.createElement("div");f.className="scalebun-cl-bar";let m=e.createElement("div");m.className="scalebun-cl-fill",f.appendChild(m);let h=e.createElement("div");h.className="scalebun-cl-count",c.append(f,h);let g=e.createElement("ul");g.className="scalebun-cl-list",c.appendChild(g);let x=!1,v=()=>{let R=s.length||1,A=s.filter(O=>o.has(O.id)).length;m.style.width=`${Math.round(A/R*100)}%`,h.textContent=`${A} of ${s.length} complete`,g.replaceChildren();for(let O of s){let z=e.createElement("li");z.className="scalebun-cl-item"+(o.has(O.id)?" done":"");let D=e.createElement("button");D.type="button",D.className="scalebun-cl-check",D.setAttribute("role","checkbox"),D.setAttribute("aria-checked",String(o.has(O.id))),D.textContent=o.has(O.id)?"\u2713":"",D.addEventListener("click",()=>y(O.id));let ne=e.createElement("span");ne.className="scalebun-cl-label",ne.textContent=O.label,z.append(D,ne),g.appendChild(z)}A>=s.length&&s.length>0&&!x?(x=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(x=!1,c.classList.remove("complete"))},y=R=>{o.has(R)?o.delete(R):o.add(R),a(),n.hooks.onInteraction(`checklist_step:${R}`),v()},b=R=>{!o.has(R)&&s.some(A=>A.id===R)&&(o.add(R),a(),v())};return c.scalebunChecklist={completeStep:b},v(),{el:c,destroy:()=>c.remove()}}var Rf,Mf=k(()=>{"use strict";Rf=n=>`scalebun_inapp_checklist_${n}`});var Pf={};L(Pf,{takeoverSurface:()=>Sx});function Sx(n){var m,h,g,x,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-takeover",o.setAttribute("role",(g=r.role)!=null?g:"dialog"),o.setAttribute("aria-modal","true");let a=e.createElement("div");a.className="scalebun-takeover-inner";let c=oe(n),l=c.find(y=>y.classList.contains("scalebun-h"));if(l){let y=`scalebun-tk-${++xx}`;l.id=y,o.setAttribute("aria-labelledby",y)}else o.setAttribute("aria-label",t.name);if(s.xButton===!0){let y=e.createElement("button");y.type="button",y.className="scalebun-x scalebun-takeover-x",y.setAttribute("aria-label","Close"),y.textContent="\xD7",y.addEventListener("click",()=>n.requestClose("x")),a.appendChild(y)}for(let y of c)a.appendChild(y);o.appendChild(a);let u=y=>{y.key==="Escape"&&s.escClose===!0&&(y.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",u);let d=Nt(o,e),p=(v=(x=n.host.shadowRoot)==null?void 0:x.host)!=null?v:o,f=Zr(p,e);return{el:o,afterMount:()=>Qr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var xx,Lf=k(()=>{"use strict";Te();es();xx=0});var _f={};L(_f,{launcherSurface:()=>kx});function kx(n){var u,d,p,f;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.commands)!=null?d:[],s=(f=(p=t.blocks.find(m=>m.kind==="heading"||m.kind==="text"))==null?void 0:p.props)==null?void 0:f.text,i=e.createElement("div");i.className="scalebun-launcher";let o=e.createElement("div");o.className="scalebun-launcher-menu",o.setAttribute("role","menu"),o.hidden=!0;let a=e.createElement("button");a.type="button",a.className="scalebun-launcher-fab",a.setAttribute("aria-label",typeof s=="string"?s:t.name),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),a.textContent="?";let c=!1,l=m=>{c=m,o.hidden=!m,a.setAttribute("aria-expanded",String(m)),a.textContent=m?"\xD7":"?"};a.addEventListener("click",()=>l(!c));for(let m of r){let h=e.createElement("button");h.type="button",h.className="scalebun-launcher-item",h.setAttribute("role","menuitem"),h.textContent=m.label,h.addEventListener("click",()=>{if(n.hooks.onCtaClick(m.action),n.hooks.onInteraction(`launcher_select:${m.id}`),m.action==="link"&&m.value)try{typeof window!="undefined"&&window.location.assign(m.value)}catch{}l(!1)}),o.appendChild(h)}return i.append(o,a),{el:i,destroy:()=>i.remove()}}var Of=k(()=>{"use strict"});var Ff={};L(Ff,{ShadowHost:()=>ln,applyThemeVars:()=>as,resolveScheme:()=>Bf});function Bf(n){if(n==="light"||n==="dark")return n;try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function as(n,e){let t=Ix[Bf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var Ex,Nf,Ix,ln,cs=k(()=>{"use strict";$();Ex="scalebun-inapp-host",Nf=`
539
539
  :host{ all: initial; }
540
540
  .layer{
541
541
  position: fixed; inset: 0; z-index: 2147483600;
@@ -560,7 +560,7 @@ ${$v(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
560
560
  negative offset and was being sliced off by the screen edge. */
561
561
  .zone-center{ top: 16px; inset-inline-end: 16px; }
562
562
  @media (prefers-reduced-motion: reduce){ .layer *{ animation: none !important; transition: none !important; } }
563
- `,kx={light:{"--scalebun-bg":"#ffffff","--scalebun-fg":"#111827","--scalebun-muted":"#6b7280","--scalebun-border":"#e5e7eb","--scalebun-accent":"#4f46e5","--scalebun-accent-fg":"#ffffff","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.15)","--scalebun-radius":"12px"},dark:{"--scalebun-bg":"#1f2430","--scalebun-fg":"#f3f4f6","--scalebun-muted":"#9aa3b2","--scalebun-border":"#333b4a","--scalebun-accent":"#7c83ff","--scalebun-accent-fg":"#0b0d12","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.5)","--scalebun-radius":"12px"}};ln=class{constructor(){this.zones=new Map;this.mode="auto";this.adoptedIds=new Set}ensure(){var s,i;if(this.host||typeof document=="undefined")return;let e=document.createElement("div");e.id=Sx,e.setAttribute("data-scalebun","inapp"),e.style.cssText="all: initial; position: static;",this.host=e;let t=e.attachShadow({mode:"open"});if(this.root=t,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in t)try{let o=new CSSStyleSheet;o.replaceSync(_f),t.adoptedStyleSheets=[o],this.sheet=o}catch{this.injectStyleTag(t)}else this.injectStyleTag(t);let r=document.createElement("div");r.className="layer",r.setAttribute("role","presentation"),t.appendChild(r),this.layer=r,document.body.appendChild(e),this.applyTheme(),typeof matchMedia!="undefined"&&(this.mql=matchMedia("(prefers-color-scheme: dark)"),this.onScheme=()=>{this.mode==="auto"&&this.applyTheme()},(i=(s=this.mql).addEventListener)==null||i.call(s,"change",this.onScheme))}injectStyleTag(e){let t=vt(document.createElement("style"));t.textContent=_f,e.appendChild(t)}addStyles(e,t){if(this.ensure(),this.adoptedIds.has(e)||!this.root)return;this.adoptedIds.add(e);let r=this.root;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in r)try{let i=new CSSStyleSheet;i.replaceSync(t);let o=r.adoptedStyleSheets;r.adoptedStyleSheets=[...o,i];return}catch{}let s=vt(document.createElement("style"));s.setAttribute("data-scalebun-styles",e),s.textContent=t,r.appendChild(s)}setTheme(e){this.mode=e,this.ensure(),this.applyTheme()}applyTheme(){this.host&&as(this.host,this.mode)}element(){return this.host}zone(e){var s;this.ensure();let t=this.zones.get(e);if(t)return t;t=document.createElement("div");let r=e.startsWith("inline:")?"inline":e;return t.className=`zone zone-${r}`,t.setAttribute("data-zone",e),(s=this.layer)==null||s.appendChild(t),this.zones.set(e,t),t}destroy(){var e,t,r;this.mql&&this.onScheme&&((t=(e=this.mql).removeEventListener)==null||t.call(e,"change",this.onScheme)),this.onScheme=void 0,this.mql=void 0,this.zones.clear(),(r=this.host)==null||r.remove(),this.host=void 0,this.root=void 0,this.layer=void 0,this.sheet=void 0}get shadowRoot(){return this.root}}});var Bf={};L(Bf,{mountInline:()=>Ix});function Ix(n,e,t,r={}){var d,p;let s=(p=(d=e.surfaceOptions)==null?void 0:d.slot)!=null?p:"default",i=null,o=()=>{},a=!1,c=(f="x")=>{a||(a=!0,u(),o(),i&&(t.onDismiss(f),i.remove(),i=null))},l=f=>{var v,y,b,E;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",as(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,zr+Ex);let g=m.createElement("div");g.className="scalebun-inline",g.setAttribute("role",(b=(y=e.a11y)==null?void 0:y.role)!=null?b:"region"),g.setAttribute("aria-label",e.name);let x=uo({doc:m,hooks:t,requestClose:w=>c(w)});for(let w of Vr(e.blocks,x))g.appendChild(w);if((E=e.dismiss)!=null&&E.xButton){let w=m.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Dismiss"),w.textContent="\xD7",w.addEventListener("click",()=>c("x")),g.appendChild(w)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=jr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var Ex,Ff=k(()=>{"use strict";$();cs();co();Te();Wr();Ex=`
563
+ `,Ix={light:{"--scalebun-bg":"#ffffff","--scalebun-fg":"#111827","--scalebun-muted":"#6b7280","--scalebun-border":"#e5e7eb","--scalebun-accent":"#4f46e5","--scalebun-accent-fg":"#ffffff","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.15)","--scalebun-radius":"12px"},dark:{"--scalebun-bg":"#1f2430","--scalebun-fg":"#f3f4f6","--scalebun-muted":"#9aa3b2","--scalebun-border":"#333b4a","--scalebun-accent":"#7c83ff","--scalebun-accent-fg":"#0b0d12","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.5)","--scalebun-radius":"12px"}};ln=class{constructor(){this.zones=new Map;this.mode="auto";this.adoptedIds=new Set}ensure(){var s,i;if(this.host||typeof document=="undefined")return;let e=document.createElement("div");e.id=Ex,e.setAttribute("data-scalebun","inapp"),e.style.cssText="all: initial; position: static;",this.host=e;let t=e.attachShadow({mode:"open"});if(this.root=t,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in t)try{let o=new CSSStyleSheet;o.replaceSync(Nf),t.adoptedStyleSheets=[o],this.sheet=o}catch{this.injectStyleTag(t)}else this.injectStyleTag(t);let r=document.createElement("div");r.className="layer",r.setAttribute("role","presentation"),t.appendChild(r),this.layer=r,document.body.appendChild(e),this.applyTheme(),typeof matchMedia!="undefined"&&(this.mql=matchMedia("(prefers-color-scheme: dark)"),this.onScheme=()=>{this.mode==="auto"&&this.applyTheme()},(i=(s=this.mql).addEventListener)==null||i.call(s,"change",this.onScheme))}injectStyleTag(e){let t=vt(document.createElement("style"));t.textContent=Nf,e.appendChild(t)}addStyles(e,t){if(this.ensure(),this.adoptedIds.has(e)||!this.root)return;this.adoptedIds.add(e);let r=this.root;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in r)try{let i=new CSSStyleSheet;i.replaceSync(t);let o=r.adoptedStyleSheets;r.adoptedStyleSheets=[...o,i];return}catch{}let s=vt(document.createElement("style"));s.setAttribute("data-scalebun-styles",e),s.textContent=t,r.appendChild(s)}setTheme(e){this.mode=e,this.ensure(),this.applyTheme()}applyTheme(){this.host&&as(this.host,this.mode)}element(){return this.host}zone(e){var s;this.ensure();let t=this.zones.get(e);if(t)return t;t=document.createElement("div");let r=e.startsWith("inline:")?"inline":e;return t.className=`zone zone-${r}`,t.setAttribute("data-zone",e),(s=this.layer)==null||s.appendChild(t),this.zones.set(e,t),t}destroy(){var e,t,r;this.mql&&this.onScheme&&((t=(e=this.mql).removeEventListener)==null||t.call(e,"change",this.onScheme)),this.onScheme=void 0,this.mql=void 0,this.zones.clear(),(r=this.host)==null||r.remove(),this.host=void 0,this.root=void 0,this.layer=void 0,this.sheet=void 0}get shadowRoot(){return this.root}}});var Df={};L(Df,{mountInline:()=>Ax});function Ax(n,e,t,r={}){var d,p;let s=(p=(d=e.surfaceOptions)==null?void 0:d.slot)!=null?p:"default",i=null,o=()=>{},a=!1,c=(f="x")=>{a||(a=!0,u(),o(),i&&(t.onDismiss(f),i.remove(),i=null))},l=f=>{var v,y,b,E;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",as(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,zr+Cx);let g=m.createElement("div");g.className="scalebun-inline",g.setAttribute("role",(b=(y=e.a11y)==null?void 0:y.role)!=null?b:"region"),g.setAttribute("aria-label",e.name);let x=uo({doc:m,hooks:t,requestClose:w=>c(w)});for(let w of Vr(e.blocks,x))g.appendChild(w);if((E=e.dismiss)!=null&&E.xButton){let w=m.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Dismiss"),w.textContent="\xD7",w.addEventListener("click",()=>c("x")),g.appendChild(w)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=jr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var Cx,qf=k(()=>{"use strict";$();cs();co();Te();Wr();Cx=`
564
564
  :host{ display:block; }
565
565
  .scalebun-inline{ position:relative; background:var(--scalebun-bg); color:var(--scalebun-fg);
566
566
  border:1px solid var(--scalebun-border); border-radius:var(--scalebun-radius); padding:18px; }
@@ -568,7 +568,7 @@ ${$v(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
568
568
  .scalebun-inline .scalebun-x{ position:absolute; top:8px; inset-inline-end:8px; background:none; border:0;
569
569
  color:var(--scalebun-muted); cursor:pointer; font-size:16px; border-radius:6px; }
570
570
  .scalebun-inline .scalebun-h{ padding-inline-end:24px; }
571
- `});var qf={};L(qf,{SURFACE_LOADERS:()=>Ro,isSurfaceSupported:()=>Cx,renderVariant:()=>To});function Cx(n){return n==="inline"||n in Ro}async function To(n,e,t){var a;let r=zp(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,Df(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(Ff(),Bf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Ro[n.surface];if(!s)return await r,Df(n.id);let[i]=await Promise.all([s(),r]),o=sp(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function Df(n){return{variantId:n,close:()=>{}}}var Ro,Mo=k(()=>{"use strict";ip();Up();Ro={banner:()=>Promise.resolve().then(()=>(Wp(),Vp)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Kp(),jp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Yp(),Xp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(tf(),ef)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(lf(),cf)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(uf(),df)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(bf(),gf)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(vf(),yf)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(xf(),wf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(kf(),Sf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(If(),Ef)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(Rf(),Af)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(Mf(),Tf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(Lf(),Pf)).then(n=>n.launcherSurface)}});function zf(n){_o=n}function Oo(n){try{Lo==null||Lo(n)}catch{}}function Uf(n,e){let t=typeof e=="string"&&e?e:null;return t?Ax.has(t)?t:null:n&&Tx[n]||null}function Vf(n){var t;let e=(t=n==null?void 0:n.ext)==null?void 0:t.archetype;return typeof e=="string"&&e?e:void 0}function No(n,e){let t=Vf(e!=null?e:n.spec);return Uf(n.variantKey,t)?!0:t?(Mx.has(t)||Oo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Oo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Lx(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Hr(n);return!r||!so(n)?(Oo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=Px[e])!=null?t:null}function Fx(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve;switch(n){case"spinWheel":{let G=ue(e,["segments","prizes","rewards"]);return[{kind:"spinwheel",props:{segments:G.map(pe).filter(Boolean),resultIndex:Ox(G,e)}}]}case"scratchReveal":return[{kind:"scratch",props:{prize:(u=B((l=(c=(a=(o=(i=e.prize)!=null?i:e.reward)!=null?o:e.rewardValue)!=null?a:e.rewardResult)!=null?c:e.resultReward)!=null?l:e.coupon))!=null?u:"You won!",reveal:r==="mystery_box"?"box":"scratch"}}];case"slotReward":{let G=ue(e,["resultSymbols","result","winningSymbols"]).map(pe).filter(Boolean);return[{kind:"slot",props:{symbols:ue(e,["symbols","reels","slotItems"]).map(pe).filter(Boolean),...G.length?{result:G.slice(0,3)}:{}}}]}case"countdown":return[{kind:"countdown",props:Nx(e)}];case"celebration":return[{kind:"confetti",props:{}}];case"qrNfc":return[{kind:"qr",props:{value:(m=(f=(p=(d=B(e.url))!=null?d:B(e.link))!=null?p:B(e.qrValue))!=null?f:B(e.deepLink))!=null?m:"https://app.example.com"}}];case"carouselDeck":{let G=ue(e,["slides","cards","items","steps"]);return[{kind:"carousel",props:{slides:(G.length?G:[{},{},{}]).map(Y=>{var ee,T,_;let X=ae(Y);return{image:B((ee=X.image)!=null?ee:X.imageUrl),title:pe(Y),text:B((_=(T=X.text)!=null?T:X.body)!=null?_:X.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),Y=(E=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(x=ie.prompt)!=null?x:ie.question)!=null?v:ie.label))!=null?b:t)!=null?E:"Tell us",X=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=X.length?X:ue(ie,["options","answers","choices"]),T=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((_,N)=>({id:String(N),label:pe(_)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:Y}}];case"rating_request":return[{kind:"rating",props:{question:Y,max:Po(Number((w=e.max)!=null?w:e.scale),5)}}];case"emoji_reaction_bar":{let _=ue(e,["emojis","reactions","options"]).map(N=>{var F;return typeof N=="string"?N:(F=B(ae(N).emoji))!=null?F:pe(N)}).filter(Boolean);return[{kind:"emoji",props:{question:Y,..._.length?{emojis:_}:{}}}]}case"quiz_card":{let _=ae((I=e.outcome)!=null?I:e.quizOutcome),N=B((S=_.answeredId)!=null?S:e.answeredId),F=B((C=_.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:Y,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:Y,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],Y=ie.map((_,N)=>{let F=ae(_);return{id:String(N),label:pe(_),done:F.done===!0||F.checked===!0||F.complete===!0}}),X=_x((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:X}},T=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let _=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ce=>{let Ae=ae(Ce);return Ae.done===!0||Ae.checked===!0||Ae.complete===!0}).length,re=Po(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ce=>ae(Ce).today===!0),he=[{kind:"streak",props:{mode:_?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Po(Number((Q=e.days)!=null?Q:e.calendarLength),7)},..._&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let _=X>=100,N=[ee];return T&&N.push({kind:"callout",props:{icon:_?"\u{1F389}":"\u{1F512}",text:_?T:`Unlock ${T}`}}),N}case"goal_tracker":{let _=Number((ce=(fe=e.currentValue)!=null?fe:e.progressValue)!=null?ce:e.current),N=Number((le=(Se=(xe=e.target)!=null?xe:e.goal)!=null?Se:e.targetValue)!=null?le:e.goalValue),F=[ee];return F.push({kind:"stat",props:{value:Number.isFinite(_)?Number.isFinite(N)?`${_} / ${N}`:_:`${Math.round(X)}%`,label:(K=B((V=(q=e.goalLabel)!=null?q:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let _=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(_)&&N.push({kind:"stat",props:{value:_,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:Y.map(F=>({label:F.label}))}}),N}case"guided_setup_wizard":case"first_session_onboarding":return[{kind:"steps",props:{steps:ie.map(N=>{var W,re;let F=ae(N);return{title:pe(N)||void 0,body:B((re=(W=F.body)!=null?W:F.text)!=null?re:F.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}];default:return[ee,{kind:"checklist",props:{items:Y}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(Y=>{var ee,T;let X=ae(Y);return{title:pe(Y)||void 0,body:B((T=(ee=X.body)!=null?ee:X.text)!=null?T:X.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return $f(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let Y=ue(e,["products","items"]).map(ee=>{var _,N,F;let T=ae(ee);return{id:String((_=T.id)!=null?_:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(ee),price:(F=T.price)!=null?F:T.amount}}),X=B(e.productTitle);return!Y.length&&X&&Y.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:X,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:Y}}),G}default:return $f(e,s)}}function Dx(n,e){var u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(S=(I=(w=(E=(b=(y=(v=(x=(g=(h=(m=(f=(p=(d=(u=n.benefitMessage)!=null?u:n.segmentExplanation)!=null?d:n.availabilityMessage)!=null?p:n.rewardMessage)!=null?f:n.offerMessage)!=null?m:n.proofMessage)!=null?h:n.valueMessage)!=null?g:n.reviewMessage)!=null?x:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?E:n.instruction)!=null?w:n.instructions)!=null?I:n.closedMessage)!=null?S:n.reasonText)!=null?C:n.motivationalText)!=null?M:n.urgencyNote)!=null?R:n.subtitle);s&&s!==e&&t.push({kind:"text",props:{text:s}});let i=ue(n,["actions","ctas"]).map(q=>{var K;let V=ae(q);return{label:pe(q),action:(K=B(V.action))!=null?K:"dismiss",deepLink:B(V.deepLink),variant:"secondary"}}).filter(q=>q.label);i.length&&r.push({kind:"cta",props:{actions:i}});let o=B((fe=(Q=(J=(te=(D=(z=(O=(A=n.price)!=null?A:n.eventTime)!=null?O:n.dateTime)!=null?z:n.goal)!=null?D:n.documentType)!=null?te:n.lastOrderDate)!=null?J:n.reward)!=null?Q:n.rewardTitle)!=null?fe:n.resultReward);o&&r.push({kind:"badge",props:{text:o}});let a=B((ce=n.eventTitle)!=null?ce:n.passTitle);a&&a!==e&&t.push({kind:"callout",props:{icon:"\u{1F39F}\uFE0F",text:a}});let c=B((xe=n.avatar)!=null?xe:n.avatarUrl);c&&t.unshift({kind:"image",props:{src:c,alt:""}});let l=B(n.itemName);if(l){let q=B(n.oldPrice),V=B(n.newPrice),K=q&&V?`${q} \u2192 ${V}`:(le=(Se=V!=null?V:q)!=null?Se:B(n.stockStatus))!=null?le:B(n.quantity);r.push({kind:"callout",props:{icon:"\u{1F3F7}\uFE0F",text:K?`${l} \xB7 ${K}`:l}})}return{lead:t,trail:r}}function $f(n,e){let t=[],r=ue(n,["bullets","bulletList","benefits","features","newFeatures","perks","perksList","reasonList","digestItems","contentSections","contentBlocks","suggestedActions","points","highlights","dateTimeOptions","tabs","slots"]).map(pe).filter(Boolean);r.length&&t.push({kind:"list",props:{items:r}});let s=ue(n,["plans","planCards","tiers","pricingTiers","packages"]);s.length&&t.push({kind:"table",props:{columns:["Plan","Price"],rows:s.map(a=>{var l,u;let c=ae(a);return[pe(a),String((u=(l=c.price)!=null?l:c.amount)!=null?u:"")]})}});let i=ue(n,["products","productList","productCards","productImages","crossSellItems","recommendations","bundleItems","cartItems","itemList","relatedItems"]);i.length&&t.push({kind:"product-grid",props:{products:i.map(a=>{var l,u,d;let c=ae(a);return{id:String((l=c.id)!=null?l:""),image:B((u=c.image)!=null?u:c.imageUrl),title:pe(a),price:(d=c.price)!=null?d:c.amount}})}});let o=ue(n,["steps","setupSteps","tasks","checklistItems","checklist"]);return o.length&&t.push({kind:"checklist",props:{items:o.map((a,c)=>({id:String(c),label:pe(a),done:ae(a).done===!0}))}}),t}function qx(n,e){var f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,te,J;let t=(f=Uf(n.variantKey,Vf(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=Rx[t])!=null?m:Lx(r))!=null?h:Hf[n.layout])!=null?g:Hf.modal,i=B((x=r.sidePosition)!=null?x:r.position),o=t==="sideSheet"&&(i==="left"||i==="right")?{...s,surfaceOptions:{...s.surfaceOptions,placement:i}}:s,a=[];e.imageUrl&&a.push({kind:"image",props:{src:e.imageUrl,alt:(v=e.title)!=null?v:""}});let c=B((y=r.eyebrow)!=null?y:r.badge);c&&c!==e.title&&c.length<32&&a.push({kind:"badge",props:{text:c}});let l=(R=B(e.title))!=null?R:B((M=(C=(S=(I=(w=(E=(b=r.eventTitle)!=null?b:r.passTitle)!=null?E:r.expandedTitle)!=null?w:r.subject)!=null?I:r.vipTitle)!=null?S:r.offerTitle)!=null?C:r.bubbleLabel)!=null?M:r.peekLabel),u=(A=B(e.body))!=null?A:B(r.expandedBody);l&&a.push({kind:"heading",props:{text:l}}),u&&a.push({kind:"text",props:{text:u}});let d=Dx(r,u);a.push(...d.lead),a.push(...Fx(t,r,l,n.variantKey,u)),a.push(...d.trail);let p=[];return(O=e.cta)!=null&&O.label&&p.push({label:e.cta.label,action:(z=e.cta.action)!=null?z:"dismiss",deepLink:e.cta.deepLink,variant:"primary"}),(D=e.secondaryCta)!=null&&D.label&&p.push({label:e.secondaryCta.label,action:"dismiss",variant:"dismiss"}),p.length&&a.push({kind:"cta",props:{actions:p}}),a.length===0&&a.push({kind:"text",props:{text:e.body}}),{id:n.id,key:(te=n.variantKey)!=null?te:n.id,name:(J=e.title)!=null?J:n.id,category:"misc",platforms:["web"],surface:o.surface,surfaceOptions:o.surfaceOptions,blocks:a,priority:"normal",triggers:[{type:"manual"}],dismiss:{xButton:!0,escClose:!0,backdropClose:!0}}}function $x(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?Hx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function zx(n,e){let t=Vi(e.style),r=(s,i)=>{i&&n.style.setProperty(s,i)};r("--scalebun-accent",t.accent),r("--scalebun-bg",t.cardBg),r("--scalebun-fg",t.bodyColor),r("--scalebun-title",t.titleColor),t.accent?r("--scalebun-accent-fg",Wi(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function Wf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Mo(),qf)),Promise.resolve().then(()=>(cs(),Nf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(zx(o,e),$x(o,e));let a=ae(e.ext),c=Hu({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,..._o?{handler:_o}:{}});if(c&&Ou(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=qx(n,e),u=!1,d=!1,p=()=>{d||(d=!0,queueMicrotask(()=>{try{i.destroy()}catch{}}))},f=await r(l,{onImpression(){},onView(){},onCtaClick(){u||(u=!0,t.onClick())},onInteraction(){},onDismiss(){u||(u=!0,t.onDismiss()),p()},...c?{requestOutcome:c}:{}},{host:i,slots:Pt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Po,pe,ue,Ax,Rx,Tx,Lo,_o,Mx,Px,Hf,_x,Ox,Nx,Bx,Hx,jf=k(()=>{"use strict";ji();$u();io();no();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Po=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,pe=n=>{var t,r,s,i;if(typeof n=="string")return n;let e=ae(n);return(i=(s=(r=(t=B(e.label))!=null?t:B(e.title))!=null?r:B(e.text))!=null?s:B(e.name))!=null?i:""},ue=(n,e)=>{for(let t of e)if(Array.isArray(n[t]))return n[t];return[]},Ax=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),Rx={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},Tx={spin_wheel:"spinWheel",scratch_card:"scratchReveal",mystery_box:"scratchReveal",slot_reward:"slotReward",carousel_story:"carouselDeck",swipe_deck:"carouselDeck",countdown_offer:"countdown",poll_card:"questionFlow",survey_sheet:"questionFlow",nps_prompt:"questionFlow",quiz_card:"questionFlow",product_finder:"questionFlow",preferences_picker:"questionFlow",feedback_capture:"questionFlow",emoji_reaction_bar:"questionFlow",rating_request:"questionFlow",progress_unlock:"checklistProgress",streak_reward:"checklistProgress",daily_check_in:"checklistProgress",goal_tracker:"checklistProgress",interactive_checklist:"checklistProgress",guided_setup_wizard:"checklistProgress",first_session_onboarding:"checklistProgress",community_challenge:"checklistProgress",milestone_celebration:"celebration",celebration_confetti_full_screen:"celebration",nfc_qr_prompt:"qrNfc",wallet_pass_offer:"qrNfc",video_commerce_card:"videoCommerce"},Lo=null,_o=null;Mx=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),Px={overlay:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},sheet:{surface:"slideover",surfaceOptions:{placement:"right",resizable:!0}},banner:{surface:"banner",surfaceOptions:{placement:"top"}},fullscreen:{surface:"takeover"},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},bubble:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},anchored:{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}};Hf={modal:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},fullscreen:{surface:"takeover"},bottom_sheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}},top_banner:{surface:"banner",surfaceOptions:{placement:"top"}},bottom_banner:{surface:"banner",surfaceOptions:{placement:"bottom"}},tooltip:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}}},_x=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Ox=(n,e)=>{var i,o,a,c,l,u,d;if(!n.length)return 0;for(let p of["resultIndex","winningIndex"]){let f=Number(e[p]);if(Number.isInteger(f)&&f>=0&&f<n.length)return f}let t=p=>{var m,h,g;let f=ae(p);return(g=(h=(m=B(f.id))!=null?m:B(f.segmentId))!=null?h:B(f.key))!=null?g:B(f.value)},r=B((a=(o=(i=e.segmentId)!=null?i:e.winningId)!=null?o:e.resultId)!=null?a:e.outcomeId);if(r){let p=n.findIndex(f=>t(f)===r);if(p>=0)return p}let s=B((d=(u=(l=(c=e.resultState)!=null?c:e.rewardValue)!=null?l:e.prize)!=null?u:e.rewardResult)!=null?d:e.resultReward);if(s){let p=s.trim().toLowerCase(),f=n.findIndex(m=>pe(m).trim().toLowerCase()===p);if(f>=0)return f}return 0},Nx=n=>{var r;let e=Bx(n);if(e)return{target:e};let t=Number((r=n.durationHours)!=null?r:n.hours);return{durationMs:(Number.isFinite(t)&&t>0?t:24)*36e5}},Bx=n=>{var l,u,d,p;let e=(d=(u=(l=B(n.endsAt))!=null?l:B(n.deadline))!=null?u:B(n.to))!=null?d:B(n.endAt);if(e)return e;let t=(p=B(n.expiryTime))!=null?p:B(n.expiresAt);if(!t)return;let r=Date.parse(t);if(Number.isFinite(r))return new Date(r).toISOString();let s=t.split(":").map(f=>Number(f));if(!s.length||s.some(f=>!Number.isFinite(f)))return;let[i=0,o=0,a=0]=s.length===3?s:[0,...s],c=((i*60+o)*60+a)*1e3;return c>0?new Date(Date.now()+c).toISOString():void 0};Hx={fade:"scalebun-fade .18s ease",fade_scale:"scalebun-pop .16s ease",slide_up:"scalebun-slideup .2s ease",slide_down:"scalebun-slidedown .18s ease",slide_in_right:"scalebun-slide-in-r .2s ease"}});var Gf={};L(Gf,{installShakeDetector:()=>Wx});function Wx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,x;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Bo,p=((g=u.y)!=null?g:0)/Bo,f=((x=u.z)!=null?x:0)/Bo;if(Math.sqrt(d*d+p*p+f*f)<Ux)return;let m=P();if(!(m-e<Vx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Kf)}catch{return null}},a=l=>{try{sessionStorage.setItem(Kf,l)}catch{}},c=DeviceMotionEvent.requestPermission;if(typeof c=="function"){if(o()==="denied")return()=>{};let l=()=>{r==null||r(),c().then(u=>{a(u==="granted"?"granted":"denied"),u==="granted"&&i()}).catch(()=>{})};window.addEventListener("click",l),window.addEventListener("touchend",l),r=()=>{window.removeEventListener("click",l),window.removeEventListener("touchend",l)}}else i();return()=>{r==null||r(),r=void 0,t&&window.removeEventListener("devicemotion",s),t=!1}}var Ux,Vx,Bo,Kf,Xf=k(()=>{"use strict";$();Ux=2.3,Vx=1500,Bo=9.80665,Kf="scalebun_shake_perm"});var Yf={};L(Yf,{EngageRuntime:()=>Fo});var Fo,Jf=k(()=>{"use strict";au();Ui();Pu();Lu();jf();Fe();Fo=class{constructor(e){this.deps=e;this.showing=!1;this.startedAt=0;this.campaignsById=new Map;this.shakeInCampaigns=!1;this.shakeInMessages=!1;var t;this.surveys=new tn(r=>this.tryShow(r)),this.inapp=new tn(r=>this.tryShowInApp(r)),zf((t=e.gameHandler)!=null?t:null)}setCampaigns(e){this.campaignsById=new Map(e.map(t=>[t.id,t])),this.surveys.setItems(e),this.shakeInCampaigns=e.some(t=>t.trigger==="shake_device"),this.syncShake()}setMessages(e){let t=e.filter(r=>r.preview);this.inapp.setItems(e.filter(r=>!r.preview)),t.length&&this.maybeShowPreview(t),this.shakeInMessages=e.some(r=>r.trigger==="shake_device"),this.syncShake()}async syncShake(){let e=(this.shakeInCampaigns||this.shakeInMessages)&&!!this.deps.signal;if(e&&!this.shakeTeardown){let{installShakeDetector:t}=await Promise.resolve().then(()=>(Xf(),Gf));(this.shakeInCampaigns||this.shakeInMessages)&&this.deps.signal&&!this.shakeTeardown&&(this.shakeTeardown=t(r=>this.deps.signal(r)))}else!e&&this.shakeTeardown&&(this.shakeTeardown(),this.shakeTeardown=void 0)}maybeShowPreview(e){if(this.showing)return;let r=e.filter(o=>!o.testRunId||!$i(o.testRunId)).sort((o,a)=>{var c,l;return((c=a.createdAt)!=null?c:"").localeCompare((l=o.createdAt)!=null?l:"")})[0];if(!r)return;r.testRunId&&zi(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),No(r,s)){this.showRich(r,s,i,!0);return}this.active=Zi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finishInApp(r,!0)},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finishInApp(r,!0)}})}showRich(e,t,r,s=!1){Wf(e,t,{onClick:()=>{this.inappEvent(e,"click",r,s);let a=t.cta;if((a==null?void 0:a.action)==="link"&&a.deepLink&&/^https?:\/\//i.test(a.deepLink))try{window.location.href=a.deepLink}catch{}this.finishInApp(e,s)},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finishInApp(e,s)}}).then(a=>{this.showing?this.active=a:a.close()}).catch(()=>{this.finish()})}onScreenView(e,t=0){this.surveys.onScreenView(e,t),this.inapp.onScreenView(e,t)}onSignal(e,t=0){this.surveys.onSignal(e,t),this.inapp.onSignal(e,t)}onCustomEvent(e,t=0){this.surveys.onCustomEvent(e,t),this.inapp.onCustomEvent(e,t)}onLifecycle(e,t,r=0){this.surveys.onLifecycle(e,t,r),this.inapp.onLifecycle(e,t,r)}stop(){var e,t;this.surveys.stop(),this.inapp.stop(),(e=this.shakeTeardown)==null||e.call(this),this.shakeTeardown=void 0,(t=this.active)==null||t.close(),this.active=void 0,this.showing=!1}resolveSpec(e){let t=e.experiment;return t!=null&&t.enabled&&t.variantB&&typeof t.split=="number"?Ee(`${e.id}:${this.deps.deviceId}`)%100<t.split?{spec:t.variantB,variantId:"B"}:{spec:e.spec,variantId:"A"}:{spec:e.spec,variantId:e.variantId}}finishInApp(e,t){t||Tr(e),this.finish()}tryShowInApp(e){if(this.showing||!Ar(e,this.deps.now(),this.deps.sessionId))return;this.showing=!0,Rr(e,this.deps.now(),this.deps.sessionId);let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),No(e,t)){this.showRich(e,t,r);return}this.active=Zi(e.layout,t,{onClick:s=>{if(this.inappEvent(e,"click",r),s.action==="link"&&s.deepLink&&/^https?:\/\//i.test(s.deepLink))try{window.location.href=s.deepLink}catch{}this.finishInApp(e,!1)},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finishInApp(e,!1)}})}inappEvent(e,t,r,s=!1){let i={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...r?{variantId:r}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},...s?{isTest:!0,...e.previewId?{previewId:e.previewId}:{}}:{}}};this.deps.transport.postEvents([i])}tryShow(e){this.showing||!Ar(e,this.deps.now(),this.deps.sessionId)||(this.showing=!0,this.startedAt=this.deps.now(),Rr(e,this.deps.now(),this.deps.sessionId),this.beacon(e,"shown"),this.event(e,"impression"),this.active=Mu(e,{onStarted:()=>this.beacon(e,"started"),onSubmit:t=>{this.submit(e,t),this.finish()},onDismiss:()=>{this.event(e,"dismiss"),this.finish()}}))}finish(){this.showing=!1,this.active=void 0}async submit(e,t){var a;Tr(e);let r=this.deps.uuid(),s=(a=t.attachments)!=null&&a.length?await this.uploadAttachments(r,t.attachments):void 0,i={responseId:r,surveyId:e.id,schemaVersion:1,score:t.score,text:t.text,answers:t.answers,...s&&s.length?{attachments:s}:{},durationMs:this.deps.now()-this.startedAt,sessionId:this.deps.sessionId,screen:this.deps.currentScreen(),platform:"web",deviceId:this.deps.deviceId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()},o=await this.deps.transport.postResponses([i]);return this.event(e,"completion"),o?"success":"error"}async uploadAttachments(e,t){let r=t.map((a,c)=>({attachmentId:`${e}-att-${c}`,responseId:e,kind:a.kind,contentType:a.contentType})),s=await this.deps.transport.presignAttachments(r);if(!s||!s.enabled)return[];let i=new Map(s.attachments.map(a=>[a.attachmentId,a])),o=[];for(let a=0;a<t.length;a++){let c=t[a],l=i.get(`${e}-att-${a}`);l&&await this.deps.transport.putBlob(l.uploadUrl,c.blob,c.contentType)&&o.push({attachmentId:l.attachmentId,kind:c.kind,storageKey:l.storageKey,mime:c.contentType,byteSize:c.blob.size,...c.width!=null?{width:c.width}:{},...c.height!=null?{height:c.height}:{},...c.durationMs!=null?{durationMs:c.durationMs}:{},...c.transcript?{transcript:c.transcript}:{},...c.transcriptApproved!=null?{transcriptApproved:c.transcriptApproved}:{},...c.masked!=null?{masked:c.masked}:{}})}return o}submitFor(e,t){let r=this.campaignsById.get(e);return r?this.submit(r,t):Promise.resolve("error")}emitRatingEvent(e,t={}){let r={eventId:this.deps.uuid(),type:e,ts:new Date(this.deps.now()).toISOString(),sessionId:this.deps.sessionId,...t.promptId?{promptId:t.promptId}:{},...t.triggerId?{triggerId:t.triggerId}:{},...t.variantId?{variantId:t.variantId}:{},...e==="rating_selected"&&typeof t.stars=="number"?{stars:t.stars}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},dims:{platform:"web"}};this.deps.transport.postRatingEvents([r])}beacon(e,t){let r={beaconId:this.deps.uuid(),surveyId:e.id,stage:t,sessionId:this.deps.sessionId,deviceId:this.deps.deviceId,platform:"web",screen:this.deps.currentScreen(),...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()};this.deps.transport.postImpressions([r])}event(e,t){let r={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{}}};this.deps.transport.postEvents([r])}}});function Do(n){return n>=200?"critical":n>=100?"warning":"info"}function qo(n,e){if(e<=0)return{fps:0,dropped:0};let t=Math.min(60,Math.round(n/e*1e3)),r=Math.round(e/1e3*60);return{fps:t,dropped:Math.max(0,r-n)}}function Ho(n){return{value:Math.round(n.loadEventEnd||n.duration),metadata:{kind:"page_load",ttfb:Math.round(n.responseStart),dcl:Math.round(n.domContentLoadedEventEnd),navType:n.type}}}var $o=k(()=>{"use strict"});var tm={};L(tm,{startCollectors:()=>Jx});function Jx(n,e){let t,r,s,i,o,a=()=>{if(e()){try{let d=performance.memory,p=d==null?void 0:d.usedJSHeapSize;typeof p=="number"&&p>0&&n("memory",p,{kind:"js_heap",totalHeap:d==null?void 0:d.totalJSHeapSize,heapLimit:d==null?void 0:d.jsHeapSizeLimit})}catch{}i=setTimeout(a,em)}},c=()=>{var d;try{let p=(d=performance.getEntriesByType)==null?void 0:d.call(performance,"navigation"),f=p==null?void 0:p[0];if(!f||f.loadEventEnd<=0)return;let m=Ho(f);n("screen_load",m.value,m.metadata,m.value)}catch{}},l=()=>{var h;let d=window.PerformanceObserver;if(!d)return;let p=(h=d.supportedEntryTypes)!=null?h:[],f=p.includes("long-animation-frame"),m=!f&&p.includes("longtask");if(!(!f&&!m))try{let g=new d(x=>{var v;for(let y of x.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Yx||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Do(b)},Math.round(y.duration))}});g.observe({type:f?"long-animation-frame":"longtask",buffered:!0}),t=g}catch{}},u=()=>{if(!e())return;if(typeof document!="undefined"&&document.visibilityState!=="visible"||typeof requestAnimationFrame=="undefined"){s=setTimeout(u,zo);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Xx)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=qo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,zo)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,zo),performance.memory&&(i=setTimeout(a,em)),()=>{t==null||t.disconnect(),r!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(r),s&&clearTimeout(s),i&&clearTimeout(i),o&&typeof window!="undefined"&&window.removeEventListener("load",o)}}var Xx,zo,Yx,em,nm=k(()=>{"use strict";$o();Xx=5e3,zo=25e3,Yx=50,em=3e4});var lm={};L(lm,{EXIT_THRESHOLD:()=>sm,EXIT_WEIGHTS:()=>rm,REVERSAL_DEFAULTS:()=>Vo,ScrollReversalDetector:()=>us,canFire:()=>cm,isTopExit:()=>om,reversalMetrics:()=>am,startExitIntent:()=>tS});function om(n,e,t=im){return n&&e<=t}function am(n,e){let t=n[n.length-1];if(n.length<2||!t)return null;let r=t;for(let o of n)if(t.t-o.t<=e){r=o;break}let s=t.t-r.t;if(s<=0)return null;let i=r.y-t.y;return{distancePx:i,velocityPxMs:i/s}}function cm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:eS)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Zx))}function tS(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...Vo,...e!=null?e:{}},i=new us(s),o=()=>{try{return Et(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=rm[u];if(p===void 0||p<sm||!cm(Uo(),r,t))return;t++,r=Uo();let f={confidence:p,trigger:u,path:location.pathname,scroll_depth_pct:o(),...d};n.trackEvent("$exit_intent",f),n.signal("exit_intent",f)},c=u=>{om(!u.relatedTarget,u.clientY,s.topEdgePx)&&a("top_exit",{x:u.clientX|0,y:u.clientY|0,exit_y:Math.round(u.clientY)})},l=()=>{let u=i.push(window.scrollY||0,Uo(),o(),window.innerHeight||0);u&&a("scroll_reversal",{velocity_px_ms:Math.round(u.velocityPxMs*1e3)/1e3,distance_px:Math.round(u.distancePx)})};return document.addEventListener("mouseout",c),window.addEventListener("scroll",l,{passive:!0}),{fires:()=>t,stop:()=>{document.removeEventListener("mouseout",c),window.removeEventListener("scroll",l)}}}var rm,sm,Zx,eS,im,Vo,us,Uo,dm=k(()=>{"use strict";Bn();rm={top_exit:.8,scroll_reversal:.5},sm=.5,Zx=3e4,eS=3,im=40,Vo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:im};us=class{constructor(e=Vo){this.tuning=e;this.buf=[];this.sustained=0;this.maxY=0;this.latched=!1}get maxScrollY(){return this.maxY}get sustainedSamples(){return this.sustained}push(e,t,r,s){for(e>this.maxY&&(this.maxY=e),this.buf.push({y:e,t});this.buf.length>2&&t-this.buf[1].t>this.tuning.windowMs;)this.buf.shift();let i=am(this.buf,this.tuning.windowMs);return i!==null&&i.distancePx>=this.tuning.minDistancePx&&i.velocityPxMs>=this.tuning.minVelocityPxMs?(this.sustained+=1,this.latched||this.sustained<this.tuning.sustainSamples||this.maxY<=s||r<this.tuning.minDepthPct?null:(this.latched=!0,i)):(this.sustained=0,this.latched=!1,null)}};Uo=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function um(n,e){let t={...rS,...n},r=Le(e,nS),s=i=>r<Math.max(0,Math.min(1,i))*100;switch(t.mode){case"off":return{record:!1,streamFromStart:!1,bucket:r,reason:"off"};case"always":return{record:!0,streamFromStart:!0,bucket:r,reason:"always"};case"sampled":return s(t.sampleRate)?{record:!0,streamFromStart:!0,bucket:r,reason:"sampled-in"}:{record:!1,streamFromStart:!1,bucket:r,reason:"sampled-out"};case"onError":default:return s(t.onErrorSampleRate)?{record:!0,streamFromStart:!1,bucket:r,reason:"onerror-armed"}:{record:!1,streamFromStart:!1,bucket:r,reason:"onerror-out"}}}var nS,rS,pm=k(()=>{"use strict";Fe();nS="wzb-replay-v1",rS={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var jo={};L(jo,{SegmentBuffer:()=>Wo,approxBytes:()=>Ht});function Ht(n){var i,o;let e=64,t=n.snapshot;if(typeof t=="string")e+=t.length;else if(t)try{e+=JSON.stringify(t).length}catch{e+=4096}let r=n.mutations;if(Array.isArray(r))for(let a of r){e+=40;let c=(o=(i=a.value)!=null?i:a.data)!=null?o:a.css;typeof c=="string"&&(e+=c.length),(a.node||a.doc)&&(e+=256),Array.isArray(a.rules)&&(e+=a.rules.reduce((l,u)=>l+u.length,0))}let s=n.events;return Array.isArray(s)&&(e+=s.length*48),e}var Wo,fs=k(()=>{"use strict";Wo=class{constructor(e,t=1/0){this.maxSegments=e;this.maxBytes=t;this.sealed=[];this.current=null;this.droppedSegments=0;this.accumBytes=0}openSegment(e){var r;this.current&&this.sealed.push(this.current);let t=Ht(e);this.current={keyframeId:(r=e.frameId)!=null?r:"",frames:[e],bytes:t},this.accumBytes+=t,this.evict()}append(e){if(!this.current)return!1;let t=Ht(e);return this.current.frames.push(e),this.current.bytes+=t,this.accumBytes+=t,this.evict(),!0}evict(){for(;this.sealed.length>0&&(this.sealed.length+1>this.maxSegments||this.accumBytes>this.maxBytes);){let e=this.sealed.shift();this.accumBytes-=e.bytes,this.droppedSegments++}}drainFrames(){let e=[];for(let t of this.sealed)e.push(...t.frames);return this.current&&e.push(...this.current.frames),e}clear(){this.sealed=[],this.current=null,this.accumBytes=0}get currentFrameCount(){var e,t;return(t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0}get currentBytes(){var e,t;return(t=(e=this.current)==null?void 0:e.bytes)!=null?t:0}get totalBytes(){return this.accumBytes}get segmentCount(){return this.sealed.length+(this.current?1:0)}get frameCount(){var e,t;return this.sealed.reduce((r,s)=>r+s.frames.length,0)+((t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0)}get dropped(){return this.droppedSegments}get hasOpenSegment(){return this.current!==null}}});var ms,fm=k(()=>{"use strict";ms=class{constructor(e,t){this.windowMs=e;this.emit=t;this.pending=[];this.timer=null}append(e){e.length&&(this.pending.push(...e),this.timer==null&&(this.timer=setTimeout(()=>this.flush(),this.windowMs)))}flush(){if(this.timer!=null&&(clearTimeout(this.timer),this.timer=null),!this.pending.length)return;let e=this.pending;this.pending=[],this.emit(e)}dispose(){this.flush()}}});function sS(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function mm(n,e){if(e===0)return n;let t=n.mutations;if(e>=1&&Array.isArray(t)&&t.length>0&&t.every(s=>s.op==="canvas"))return null;let r=n.events;if(Array.isArray(r)&&r.length>0){let s=r.filter(i=>!(e>=2&&i.k==="move"));if(s.length===0)return null;s.length!==r.length&&(n.events=s)}return n}var hs,hm=k(()=>{"use strict";hs=class{constructor(e){this.egressPending=e;this.longTaskMs=0;this._level=0;if(typeof PerformanceObserver!="undefined")try{this.po=new PerformanceObserver(t=>{for(let r of t.getEntries())this.longTaskMs+=r.duration}),this.po.observe({type:"longtask",buffered:!1})}catch{}typeof setInterval=="function"&&(this.timer=setInterval(()=>this.sample(),1e3))}sample(){var t,r;let e=this.longTaskMs;this.longTaskMs=0,this._level=sS(e,(r=(t=this.egressPending)==null?void 0:t.call(this))!=null?r:0)}get level(){return this._level}dispose(){var e;this.timer&&clearInterval(this.timer),(e=this.po)==null||e.disconnect(),this.po=void 0}}});function Ko(n){let e=n;for(let t of oS)e=e.replace(t,iS);return e}function gm(n){let e=n.snapshot;e&&typeof e=="object"&&gs(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)aS(r)}function gs(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=Ko(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=Ko(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)gs(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)gs(t)}function aS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=Ko(n.value)),n.op==="add"&&n.node&&gs(n.node)}var iS,oS,bm=k(()=>{"use strict";iS="[redacted]",oS=[/\b[\w.+-]+@[\w-]+\.[\w.-]+\b/g,/\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:\d[ -]?){13,18}\d\b/g,/(?:\+\d{1,3}[\s.-]?)?\(?\d{2,4}\)?[\s.-]\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g]});var wm={};L(wm,{deviceMemoryGB:()=>vm,networkHint:()=>ym,shouldDeferHeavyEgress:()=>Go,userOptedOutOfTracking:()=>lS});function cS(){if(typeof navigator!="undefined")return navigator.connection}function ym(){let n=cS(),e=typeof(n==null?void 0:n.effectiveType)=="string"?n.effectiveType:void 0;return{saveData:(n==null?void 0:n.saveData)===!0,slow:e==="2g"||e==="slow-2g",effectiveType:e}}function lS(){var t;if(typeof navigator=="undefined")return!1;let n=navigator;if(n.globalPrivacyControl===!0)return!0;let e=(t=n.doNotTrack)!=null?t:typeof window!="undefined"?window.doNotTrack:void 0;return e==="1"||e==="yes"}function vm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function Go(){let n=ym();if(n.saveData||n.slow)return!0;let e=vm();return typeof e=="number"&&e<=1}var Xo=k(()=>{"use strict"});function Yo(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(xm);return n||(n=`t_${H()}`,sessionStorage.setItem(xm,n)),n}}catch{}return bs!=null?bs:bs=`t_${H()}`}function Jo(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function Qo(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var xm,bs,Sm=k(()=>{"use strict";$();xm="scalebun_replay_tab"});var ea={};L(ea,{GZ_PREFIX:()=>dn,ReplayEncoder:()=>Zo,decodeSnapshotValue:()=>uS,gunzipBase64:()=>Em,gzipBase64:()=>km});async function km(n){let e=new CompressionStream("gzip"),t=e.writable.getWriter();t.write(new TextEncoder().encode(n)),t.close();let r=await new Response(e.readable).arrayBuffer();return pS(new Uint8Array(r))}async function Em(n){let e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);let r=new DecompressionStream("gzip"),s=r.writable.getWriter();return s.write(t),s.close(),await new Response(r.readable).text()}async function uS(n){return typeof n=="string"&&n.startsWith(dn)?JSON.parse(await Em(n.slice(dn.length))):n}function pS(n){let e="";for(let r=0;r<n.length;r+=32768)e+=String.fromCharCode.apply(null,Array.from(n.subarray(r,r+32768)));return btoa(e)}var dn,dS,Zo,ta=k(()=>{"use strict";dn="gz:",dS=`
571
+ `});var $f={};L($f,{SURFACE_LOADERS:()=>Ro,isSurfaceSupported:()=>Rx,renderVariant:()=>To});function Rx(n){return n==="inline"||n in Ro}async function To(n,e,t){var a;let r=Vp(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,Hf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(qf(),Df)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Ro[n.surface];if(!s)return await r,Hf(n.id);let[i]=await Promise.all([s(),r]),o=op(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function Hf(n){return{variantId:n,close:()=>{}}}var Ro,Mo=k(()=>{"use strict";ap();Wp();Ro={banner:()=>Promise.resolve().then(()=>(Kp(),jp)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Xp(),Gp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Qp(),Jp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(rf(),nf)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(uf(),df)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(ff(),pf)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(vf(),yf)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(xf(),wf)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(kf(),Sf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(If(),Ef)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(Af(),Cf)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(Mf(),Tf)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(Lf(),Pf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(Of(),_f)).then(n=>n.launcherSurface)}});function Vf(n){_o=n}function Oo(n){try{Lo==null||Lo(n)}catch{}}function Wf(n,e){let t=typeof e=="string"&&e?e:null;return t?Tx.has(t)?t:null:n&&Px[n]||null}function jf(n){var t;let e=(t=n==null?void 0:n.ext)==null?void 0:t.archetype;return typeof e=="string"&&e?e:void 0}function No(n,e){let t=jf(e!=null?e:n.spec);return Wf(n.variantKey,t)?!0:t?(Lx.has(t)||Oo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Oo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Ox(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Hr(n);return!r||!so(n)?(Oo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=_x[e])!=null?t:null}function qx(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,ne,J,Q,fe,ce,xe,Se,le,H,V,K,de,me,se,Ue,Ve;switch(n){case"spinWheel":{let G=ue(e,["segments","prizes","rewards"]);return[{kind:"spinwheel",props:{segments:G.map(pe).filter(Boolean),resultIndex:Bx(G,e)}}]}case"scratchReveal":return[{kind:"scratch",props:{prize:(u=B((l=(c=(a=(o=(i=e.prize)!=null?i:e.reward)!=null?o:e.rewardValue)!=null?a:e.rewardResult)!=null?c:e.resultReward)!=null?l:e.coupon))!=null?u:"You won!",reveal:r==="mystery_box"?"box":"scratch"}}];case"slotReward":{let G=ue(e,["resultSymbols","result","winningSymbols"]).map(pe).filter(Boolean);return[{kind:"slot",props:{symbols:ue(e,["symbols","reels","slotItems"]).map(pe).filter(Boolean),...G.length?{result:G.slice(0,3)}:{}}}]}case"countdown":return[{kind:"countdown",props:Fx(e)}];case"celebration":return[{kind:"confetti",props:{}}];case"qrNfc":return[{kind:"qr",props:{value:(m=(f=(p=(d=B(e.url))!=null?d:B(e.link))!=null?p:B(e.qrValue))!=null?f:B(e.deepLink))!=null?m:"https://app.example.com"}}];case"carouselDeck":{let G=ue(e,["slides","cards","items","steps"]);return[{kind:"carousel",props:{slides:(G.length?G:[{},{},{}]).map(Y=>{var te,T,_;let X=ae(Y);return{image:B((te=X.image)!=null?te:X.imageUrl),title:pe(Y),text:B((_=(T=X.text)!=null?T:X.body)!=null?_:X.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),Y=(E=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(x=ie.prompt)!=null?x:ie.question)!=null?v:ie.label))!=null?b:t)!=null?E:"Tell us",X=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),te=X.length?X:ue(ie,["options","answers","choices"]),T=(te.length?te:[{label:"Option A"},{label:"Option B"}]).map((_,N)=>({id:String(N),label:pe(_)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:Y}}];case"rating_request":return[{kind:"rating",props:{question:Y,max:Po(Number((w=e.max)!=null?w:e.scale),5)}}];case"emoji_reaction_bar":{let _=ue(e,["emojis","reactions","options"]).map(N=>{var F;return typeof N=="string"?N:(F=B(ae(N).emoji))!=null?F:pe(N)}).filter(Boolean);return[{kind:"emoji",props:{question:Y,..._.length?{emojis:_}:{}}}]}case"quiz_card":{let _=ae((I=e.outcome)!=null?I:e.quizOutcome),N=B((S=_.answeredId)!=null?S:e.answeredId),F=B((C=_.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:Y,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:Y,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],Y=ie.map((_,N)=>{let F=ae(_);return{id:String(N),label:pe(_),done:F.done===!0||F.checked===!0||F.complete===!0}}),X=Nx((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),te={kind:"progress",props:{value:X}},T=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let _=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ce=>{let Ae=ae(Ce);return Ae.done===!0||Ae.checked===!0||Ae.complete===!0}).length,re=Po(Number((J=(ne=(D=e.filled)!=null?D:e.currentStreak)!=null?ne:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ce=>ae(Ce).today===!0),he=[{kind:"streak",props:{mode:_?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Po(Number((Q=e.days)!=null?Q:e.calendarLength),7)},..._&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let _=X>=100,N=[te];return T&&N.push({kind:"callout",props:{icon:_?"\u{1F389}":"\u{1F512}",text:_?T:`Unlock ${T}`}}),N}case"goal_tracker":{let _=Number((ce=(fe=e.currentValue)!=null?fe:e.progressValue)!=null?ce:e.current),N=Number((le=(Se=(xe=e.target)!=null?xe:e.goal)!=null?Se:e.targetValue)!=null?le:e.goalValue),F=[te];return F.push({kind:"stat",props:{value:Number.isFinite(_)?Number.isFinite(N)?`${_} / ${N}`:_:`${Math.round(X)}%`,label:(K=B((V=(H=e.goalLabel)!=null?H:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let _=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[te];return Number.isFinite(_)&&N.push({kind:"stat",props:{value:_,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:Y.map(F=>({label:F.label}))}}),N}case"guided_setup_wizard":case"first_session_onboarding":return[{kind:"steps",props:{steps:ie.map(N=>{var W,re;let F=ae(N);return{title:pe(N)||void 0,body:B((re=(W=F.body)!=null?W:F.text)!=null?re:F.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}];default:return[te,{kind:"checklist",props:{items:Y}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(Y=>{var te,T;let X=ae(Y);return{title:pe(Y)||void 0,body:B((T=(te=X.body)!=null?te:X.text)!=null?T:X.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return Uf(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let Y=ue(e,["products","items"]).map(te=>{var _,N,F;let T=ae(te);return{id:String((_=T.id)!=null?_:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(te),price:(F=T.price)!=null?F:T.amount}}),X=B(e.productTitle);return!Y.length&&X&&Y.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:X,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:Y}}),G}default:return Uf(e,s)}}function Hx(n,e){var u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,ne,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(S=(I=(w=(E=(b=(y=(v=(x=(g=(h=(m=(f=(p=(d=(u=n.benefitMessage)!=null?u:n.segmentExplanation)!=null?d:n.availabilityMessage)!=null?p:n.rewardMessage)!=null?f:n.offerMessage)!=null?m:n.proofMessage)!=null?h:n.valueMessage)!=null?g:n.reviewMessage)!=null?x:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?E:n.instruction)!=null?w:n.instructions)!=null?I:n.closedMessage)!=null?S:n.reasonText)!=null?C:n.motivationalText)!=null?M:n.urgencyNote)!=null?R:n.subtitle);s&&s!==e&&t.push({kind:"text",props:{text:s}});let i=ue(n,["actions","ctas"]).map(H=>{var K;let V=ae(H);return{label:pe(H),action:(K=B(V.action))!=null?K:"dismiss",deepLink:B(V.deepLink),variant:"secondary"}}).filter(H=>H.label);i.length&&r.push({kind:"cta",props:{actions:i}});let o=B((fe=(Q=(J=(ne=(D=(z=(O=(A=n.price)!=null?A:n.eventTime)!=null?O:n.dateTime)!=null?z:n.goal)!=null?D:n.documentType)!=null?ne:n.lastOrderDate)!=null?J:n.reward)!=null?Q:n.rewardTitle)!=null?fe:n.resultReward);o&&r.push({kind:"badge",props:{text:o}});let a=B((ce=n.eventTitle)!=null?ce:n.passTitle);a&&a!==e&&t.push({kind:"callout",props:{icon:"\u{1F39F}\uFE0F",text:a}});let c=B((xe=n.avatar)!=null?xe:n.avatarUrl);c&&t.unshift({kind:"image",props:{src:c,alt:""}});let l=B(n.itemName);if(l){let H=B(n.oldPrice),V=B(n.newPrice),K=H&&V?`${H} \u2192 ${V}`:(le=(Se=V!=null?V:H)!=null?Se:B(n.stockStatus))!=null?le:B(n.quantity);r.push({kind:"callout",props:{icon:"\u{1F3F7}\uFE0F",text:K?`${l} \xB7 ${K}`:l}})}return{lead:t,trail:r}}function Uf(n,e){let t=[],r=ue(n,["bullets","bulletList","benefits","features","newFeatures","perks","perksList","reasonList","digestItems","contentSections","contentBlocks","suggestedActions","points","highlights","dateTimeOptions","tabs","slots"]).map(pe).filter(Boolean);r.length&&t.push({kind:"list",props:{items:r}});let s=ue(n,["plans","planCards","tiers","pricingTiers","packages"]);s.length&&t.push({kind:"table",props:{columns:["Plan","Price"],rows:s.map(a=>{var l,u;let c=ae(a);return[pe(a),String((u=(l=c.price)!=null?l:c.amount)!=null?u:"")]})}});let i=ue(n,["products","productList","productCards","productImages","crossSellItems","recommendations","bundleItems","cartItems","itemList","relatedItems"]);i.length&&t.push({kind:"product-grid",props:{products:i.map(a=>{var l,u,d;let c=ae(a);return{id:String((l=c.id)!=null?l:""),image:B((u=c.image)!=null?u:c.imageUrl),title:pe(a),price:(d=c.price)!=null?d:c.amount}})}});let o=ue(n,["steps","setupSteps","tasks","checklistItems","checklist"]);return o.length&&t.push({kind:"checklist",props:{items:o.map((a,c)=>({id:String(c),label:pe(a),done:ae(a).done===!0}))}}),t}function $x(n,e){var f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,ne,J;let t=(f=Wf(n.variantKey,jf(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=Mx[t])!=null?m:Ox(r))!=null?h:zf[n.layout])!=null?g:zf.modal,i=B((x=r.sidePosition)!=null?x:r.position),o=t==="sideSheet"&&(i==="left"||i==="right")?{...s,surfaceOptions:{...s.surfaceOptions,placement:i}}:s,a=[];e.imageUrl&&a.push({kind:"image",props:{src:e.imageUrl,alt:(v=e.title)!=null?v:""}});let c=B((y=r.eyebrow)!=null?y:r.badge);c&&c!==e.title&&c.length<32&&a.push({kind:"badge",props:{text:c}});let l=(R=B(e.title))!=null?R:B((M=(C=(S=(I=(w=(E=(b=r.eventTitle)!=null?b:r.passTitle)!=null?E:r.expandedTitle)!=null?w:r.subject)!=null?I:r.vipTitle)!=null?S:r.offerTitle)!=null?C:r.bubbleLabel)!=null?M:r.peekLabel),u=(A=B(e.body))!=null?A:B(r.expandedBody);l&&a.push({kind:"heading",props:{text:l}}),u&&a.push({kind:"text",props:{text:u}});let d=Hx(r,u);a.push(...d.lead),a.push(...qx(t,r,l,n.variantKey,u)),a.push(...d.trail);let p=[];return(O=e.cta)!=null&&O.label&&p.push({label:e.cta.label,action:(z=e.cta.action)!=null?z:"dismiss",deepLink:e.cta.deepLink,variant:"primary"}),(D=e.secondaryCta)!=null&&D.label&&p.push({label:e.secondaryCta.label,action:"dismiss",variant:"dismiss"}),p.length&&a.push({kind:"cta",props:{actions:p}}),a.length===0&&a.push({kind:"text",props:{text:e.body}}),{id:n.id,key:(ne=n.variantKey)!=null?ne:n.id,name:(J=e.title)!=null?J:n.id,category:"misc",platforms:["web"],surface:o.surface,surfaceOptions:o.surfaceOptions,blocks:a,priority:"normal",triggers:[{type:"manual"}],dismiss:{xButton:!0,escClose:!0,backdropClose:!0}}}function Ux(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?zx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function Vx(n,e){let t=Vi(e.style),r=(s,i)=>{i&&n.style.setProperty(s,i)};r("--scalebun-accent",t.accent),r("--scalebun-bg",t.cardBg),r("--scalebun-fg",t.bodyColor),r("--scalebun-title",t.titleColor),t.accent?r("--scalebun-accent-fg",Wi(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function Kf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Mo(),$f)),Promise.resolve().then(()=>(cs(),Ff))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(Vx(o,e),Ux(o,e));let a=ae(e.ext),c=zu({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,..._o?{handler:_o}:{}});if(c&&Bu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=$x(n,e),u=!1,d=!1,p=()=>{d||(d=!0,queueMicrotask(()=>{try{i.destroy()}catch{}}))},f=await r(l,{onImpression(){},onView(){},onCtaClick(){u||(u=!0,t.onClick())},onInteraction(){},onDismiss(){u||(u=!0,t.onDismiss()),p()},...c?{requestOutcome:c}:{}},{host:i,slots:Pt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Po,pe,ue,Tx,Mx,Px,Lo,_o,Lx,_x,zf,Nx,Bx,Fx,Dx,zx,Gf=k(()=>{"use strict";ji();Uu();io();no();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Po=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,pe=n=>{var t,r,s,i;if(typeof n=="string")return n;let e=ae(n);return(i=(s=(r=(t=B(e.label))!=null?t:B(e.title))!=null?r:B(e.text))!=null?s:B(e.name))!=null?i:""},ue=(n,e)=>{for(let t of e)if(Array.isArray(n[t]))return n[t];return[]},Tx=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),Mx={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},Px={spin_wheel:"spinWheel",scratch_card:"scratchReveal",mystery_box:"scratchReveal",slot_reward:"slotReward",carousel_story:"carouselDeck",swipe_deck:"carouselDeck",countdown_offer:"countdown",poll_card:"questionFlow",survey_sheet:"questionFlow",nps_prompt:"questionFlow",quiz_card:"questionFlow",product_finder:"questionFlow",preferences_picker:"questionFlow",feedback_capture:"questionFlow",emoji_reaction_bar:"questionFlow",rating_request:"questionFlow",progress_unlock:"checklistProgress",streak_reward:"checklistProgress",daily_check_in:"checklistProgress",goal_tracker:"checklistProgress",interactive_checklist:"checklistProgress",guided_setup_wizard:"checklistProgress",first_session_onboarding:"checklistProgress",community_challenge:"checklistProgress",milestone_celebration:"celebration",celebration_confetti_full_screen:"celebration",nfc_qr_prompt:"qrNfc",wallet_pass_offer:"qrNfc",video_commerce_card:"videoCommerce"},Lo=null,_o=null;Lx=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),_x={overlay:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},sheet:{surface:"slideover",surfaceOptions:{placement:"right",resizable:!0}},banner:{surface:"banner",surfaceOptions:{placement:"top"}},fullscreen:{surface:"takeover"},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},bubble:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},anchored:{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}};zf={modal:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},fullscreen:{surface:"takeover"},bottom_sheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}},top_banner:{surface:"banner",surfaceOptions:{placement:"top"}},bottom_banner:{surface:"banner",surfaceOptions:{placement:"bottom"}},tooltip:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}}},Nx=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Bx=(n,e)=>{var i,o,a,c,l,u,d;if(!n.length)return 0;for(let p of["resultIndex","winningIndex"]){let f=Number(e[p]);if(Number.isInteger(f)&&f>=0&&f<n.length)return f}let t=p=>{var m,h,g;let f=ae(p);return(g=(h=(m=B(f.id))!=null?m:B(f.segmentId))!=null?h:B(f.key))!=null?g:B(f.value)},r=B((a=(o=(i=e.segmentId)!=null?i:e.winningId)!=null?o:e.resultId)!=null?a:e.outcomeId);if(r){let p=n.findIndex(f=>t(f)===r);if(p>=0)return p}let s=B((d=(u=(l=(c=e.resultState)!=null?c:e.rewardValue)!=null?l:e.prize)!=null?u:e.rewardResult)!=null?d:e.resultReward);if(s){let p=s.trim().toLowerCase(),f=n.findIndex(m=>pe(m).trim().toLowerCase()===p);if(f>=0)return f}return 0},Fx=n=>{var r;let e=Dx(n);if(e)return{target:e};let t=Number((r=n.durationHours)!=null?r:n.hours);return{durationMs:(Number.isFinite(t)&&t>0?t:24)*36e5}},Dx=n=>{var l,u,d,p;let e=(d=(u=(l=B(n.endsAt))!=null?l:B(n.deadline))!=null?u:B(n.to))!=null?d:B(n.endAt);if(e)return e;let t=(p=B(n.expiryTime))!=null?p:B(n.expiresAt);if(!t)return;let r=Date.parse(t);if(Number.isFinite(r))return new Date(r).toISOString();let s=t.split(":").map(f=>Number(f));if(!s.length||s.some(f=>!Number.isFinite(f)))return;let[i=0,o=0,a=0]=s.length===3?s:[0,...s],c=((i*60+o)*60+a)*1e3;return c>0?new Date(Date.now()+c).toISOString():void 0};zx={fade:"scalebun-fade .18s ease",fade_scale:"scalebun-pop .16s ease",slide_up:"scalebun-slideup .2s ease",slide_down:"scalebun-slidedown .18s ease",slide_in_right:"scalebun-slide-in-r .2s ease"}});var Yf={};L(Yf,{installShakeDetector:()=>Kx});function Kx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,x;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Bo,p=((g=u.y)!=null?g:0)/Bo,f=((x=u.z)!=null?x:0)/Bo;if(Math.sqrt(d*d+p*p+f*f)<Wx)return;let m=P();if(!(m-e<jx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Xf)}catch{return null}},a=l=>{try{sessionStorage.setItem(Xf,l)}catch{}},c=DeviceMotionEvent.requestPermission;if(typeof c=="function"){if(o()==="denied")return()=>{};let l=()=>{r==null||r(),c().then(u=>{a(u==="granted"?"granted":"denied"),u==="granted"&&i()}).catch(()=>{})};window.addEventListener("click",l),window.addEventListener("touchend",l),r=()=>{window.removeEventListener("click",l),window.removeEventListener("touchend",l)}}else i();return()=>{r==null||r(),r=void 0,t&&window.removeEventListener("devicemotion",s),t=!1}}var Wx,jx,Bo,Xf,Jf=k(()=>{"use strict";$();Wx=2.3,jx=1500,Bo=9.80665,Xf="scalebun_shake_perm"});var Qf={};L(Qf,{EngageRuntime:()=>Fo});var Fo,Zf=k(()=>{"use strict";lu();Ui();_u();Ou();Gf();Fe();Fo=class{constructor(e){this.deps=e;this.showing=!1;this.startedAt=0;this.campaignsById=new Map;this.shakeInCampaigns=!1;this.shakeInMessages=!1;var t;this.surveys=new tn(r=>this.tryShow(r)),this.inapp=new tn(r=>this.tryShowInApp(r)),Vf((t=e.gameHandler)!=null?t:null)}setCampaigns(e){this.campaignsById=new Map(e.map(t=>[t.id,t])),this.surveys.setItems(e),this.shakeInCampaigns=e.some(t=>t.trigger==="shake_device"),this.syncShake()}setMessages(e){let t=e.filter(r=>r.preview);this.inapp.setItems(e.filter(r=>!r.preview)),t.length&&this.maybeShowPreview(t),this.shakeInMessages=e.some(r=>r.trigger==="shake_device"),this.syncShake()}async syncShake(){let e=(this.shakeInCampaigns||this.shakeInMessages)&&!!this.deps.signal;if(e&&!this.shakeTeardown){let{installShakeDetector:t}=await Promise.resolve().then(()=>(Jf(),Yf));(this.shakeInCampaigns||this.shakeInMessages)&&this.deps.signal&&!this.shakeTeardown&&(this.shakeTeardown=t(r=>this.deps.signal(r)))}else!e&&this.shakeTeardown&&(this.shakeTeardown(),this.shakeTeardown=void 0)}maybeShowPreview(e){if(this.showing)return;let r=e.filter(o=>!o.testRunId||!$i(o.testRunId)).sort((o,a)=>{var c,l;return((c=a.createdAt)!=null?c:"").localeCompare((l=o.createdAt)!=null?l:"")})[0];if(!r)return;r.testRunId&&zi(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),No(r,s)){this.showRich(r,s,i,!0);return}this.active=Zi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finishInApp(r,!0)},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finishInApp(r,!0)}})}showRich(e,t,r,s=!1){Kf(e,t,{onClick:()=>{this.inappEvent(e,"click",r,s);let a=t.cta;if((a==null?void 0:a.action)==="link"&&a.deepLink&&/^https?:\/\//i.test(a.deepLink))try{window.location.href=a.deepLink}catch{}this.finishInApp(e,s)},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finishInApp(e,s)}}).then(a=>{this.showing?this.active=a:a.close()}).catch(()=>{this.finish()})}onScreenView(e,t=0){this.surveys.onScreenView(e,t),this.inapp.onScreenView(e,t)}onSignal(e,t=0){this.surveys.onSignal(e,t),this.inapp.onSignal(e,t)}onCustomEvent(e,t=0){this.surveys.onCustomEvent(e,t),this.inapp.onCustomEvent(e,t)}onLifecycle(e,t,r=0){this.surveys.onLifecycle(e,t,r),this.inapp.onLifecycle(e,t,r)}stop(){var e,t;this.surveys.stop(),this.inapp.stop(),(e=this.shakeTeardown)==null||e.call(this),this.shakeTeardown=void 0,(t=this.active)==null||t.close(),this.active=void 0,this.showing=!1}resolveSpec(e){let t=e.experiment;return t!=null&&t.enabled&&t.variantB&&typeof t.split=="number"?Ee(`${e.id}:${this.deps.deviceId}`)%100<t.split?{spec:t.variantB,variantId:"B"}:{spec:e.spec,variantId:"A"}:{spec:e.spec,variantId:e.variantId}}finishInApp(e,t){t||Tr(e),this.finish()}tryShowInApp(e){if(this.showing||!Ar(e,this.deps.now(),this.deps.sessionId))return;this.showing=!0,Rr(e,this.deps.now(),this.deps.sessionId);let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),No(e,t)){this.showRich(e,t,r);return}this.active=Zi(e.layout,t,{onClick:s=>{if(this.inappEvent(e,"click",r),s.action==="link"&&s.deepLink&&/^https?:\/\//i.test(s.deepLink))try{window.location.href=s.deepLink}catch{}this.finishInApp(e,!1)},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finishInApp(e,!1)}})}inappEvent(e,t,r,s=!1){let i={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...r?{variantId:r}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},...s?{isTest:!0,...e.previewId?{previewId:e.previewId}:{}}:{}}};this.deps.transport.postEvents([i])}tryShow(e){this.showing||!Ar(e,this.deps.now(),this.deps.sessionId)||(this.showing=!0,this.startedAt=this.deps.now(),Rr(e,this.deps.now(),this.deps.sessionId),this.beacon(e,"shown"),this.event(e,"impression"),this.active=Lu(e,{onStarted:()=>this.beacon(e,"started"),onSubmit:t=>{this.submit(e,t),this.finish()},onDismiss:()=>{this.event(e,"dismiss"),this.finish()}}))}finish(){this.showing=!1,this.active=void 0}async submit(e,t){var a;Tr(e);let r=this.deps.uuid(),s=(a=t.attachments)!=null&&a.length?await this.uploadAttachments(r,t.attachments):void 0,i={responseId:r,surveyId:e.id,schemaVersion:1,score:t.score,text:t.text,answers:t.answers,...s&&s.length?{attachments:s}:{},durationMs:this.deps.now()-this.startedAt,sessionId:this.deps.sessionId,screen:this.deps.currentScreen(),platform:"web",deviceId:this.deps.deviceId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()},o=await this.deps.transport.postResponses([i]);return this.event(e,"completion"),o?"success":"error"}async uploadAttachments(e,t){let r=t.map((a,c)=>({attachmentId:`${e}-att-${c}`,responseId:e,kind:a.kind,contentType:a.contentType})),s=await this.deps.transport.presignAttachments(r);if(!s||!s.enabled)return[];let i=new Map(s.attachments.map(a=>[a.attachmentId,a])),o=[];for(let a=0;a<t.length;a++){let c=t[a],l=i.get(`${e}-att-${a}`);l&&await this.deps.transport.putBlob(l.uploadUrl,c.blob,c.contentType)&&o.push({attachmentId:l.attachmentId,kind:c.kind,storageKey:l.storageKey,mime:c.contentType,byteSize:c.blob.size,...c.width!=null?{width:c.width}:{},...c.height!=null?{height:c.height}:{},...c.durationMs!=null?{durationMs:c.durationMs}:{},...c.transcript?{transcript:c.transcript}:{},...c.transcriptApproved!=null?{transcriptApproved:c.transcriptApproved}:{},...c.masked!=null?{masked:c.masked}:{}})}return o}submitFor(e,t){let r=this.campaignsById.get(e);return r?this.submit(r,t):Promise.resolve("error")}emitRatingEvent(e,t={}){let r={eventId:this.deps.uuid(),type:e,ts:new Date(this.deps.now()).toISOString(),sessionId:this.deps.sessionId,...t.promptId?{promptId:t.promptId}:{},...t.triggerId?{triggerId:t.triggerId}:{},...t.variantId?{variantId:t.variantId}:{},...e==="rating_selected"&&typeof t.stars=="number"?{stars:t.stars}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},dims:{platform:"web"}};this.deps.transport.postRatingEvents([r])}beacon(e,t){let r={beaconId:this.deps.uuid(),surveyId:e.id,stage:t,sessionId:this.deps.sessionId,deviceId:this.deps.deviceId,platform:"web",screen:this.deps.currentScreen(),...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()};this.deps.transport.postImpressions([r])}event(e,t){let r={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{}}};this.deps.transport.postEvents([r])}}});function Do(n){return n>=200?"critical":n>=100?"warning":"info"}function qo(n,e){if(e<=0)return{fps:0,dropped:0};let t=Math.min(60,Math.round(n/e*1e3)),r=Math.round(e/1e3*60);return{fps:t,dropped:Math.max(0,r-n)}}function Ho(n){return{value:Math.round(n.loadEventEnd||n.duration),metadata:{kind:"page_load",ttfb:Math.round(n.responseStart),dcl:Math.round(n.domContentLoadedEventEnd),navType:n.type}}}var $o=k(()=>{"use strict"});var rm={};L(rm,{startCollectors:()=>Zx});function Zx(n,e){let t,r,s,i,o,a=()=>{if(e()){try{let d=performance.memory,p=d==null?void 0:d.usedJSHeapSize;typeof p=="number"&&p>0&&n("memory",p,{kind:"js_heap",totalHeap:d==null?void 0:d.totalJSHeapSize,heapLimit:d==null?void 0:d.jsHeapSizeLimit})}catch{}i=setTimeout(a,nm)}},c=()=>{var d;try{let p=(d=performance.getEntriesByType)==null?void 0:d.call(performance,"navigation"),f=p==null?void 0:p[0];if(!f||f.loadEventEnd<=0)return;let m=Ho(f);n("screen_load",m.value,m.metadata,m.value)}catch{}},l=()=>{var h;let d=window.PerformanceObserver;if(!d)return;let p=(h=d.supportedEntryTypes)!=null?h:[],f=p.includes("long-animation-frame"),m=!f&&p.includes("longtask");if(!(!f&&!m))try{let g=new d(x=>{var v;for(let y of x.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Qx||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Do(b)},Math.round(y.duration))}});g.observe({type:f?"long-animation-frame":"longtask",buffered:!0}),t=g}catch{}},u=()=>{if(!e())return;if(typeof document!="undefined"&&document.visibilityState!=="visible"||typeof requestAnimationFrame=="undefined"){s=setTimeout(u,zo);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Jx)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=qo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,zo)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,zo),performance.memory&&(i=setTimeout(a,nm)),()=>{t==null||t.disconnect(),r!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(r),s&&clearTimeout(s),i&&clearTimeout(i),o&&typeof window!="undefined"&&window.removeEventListener("load",o)}}var Jx,zo,Qx,nm,sm=k(()=>{"use strict";$o();Jx=5e3,zo=25e3,Qx=50,nm=3e4});var um={};L(um,{EXIT_THRESHOLD:()=>om,EXIT_WEIGHTS:()=>im,REVERSAL_DEFAULTS:()=>Vo,ScrollReversalDetector:()=>us,canFire:()=>dm,isTopExit:()=>cm,reversalMetrics:()=>lm,startExitIntent:()=>rS});function cm(n,e,t=am){return n&&e<=t}function lm(n,e){let t=n[n.length-1];if(n.length<2||!t)return null;let r=t;for(let o of n)if(t.t-o.t<=e){r=o;break}let s=t.t-r.t;if(s<=0)return null;let i=r.y-t.y;return{distancePx:i,velocityPxMs:i/s}}function dm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:nS)||e>0&&n-e<((i=r.cooldownMs)!=null?i:tS))}function rS(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...Vo,...e!=null?e:{}},i=new us(s),o=()=>{try{return Et(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=im[u];if(p===void 0||p<om||!dm(Uo(),r,t))return;t++,r=Uo();let f={confidence:p,trigger:u,path:location.pathname,scroll_depth_pct:o(),...d};n.trackEvent("$exit_intent",f),n.signal("exit_intent",f)},c=u=>{cm(!u.relatedTarget,u.clientY,s.topEdgePx)&&a("top_exit",{x:u.clientX|0,y:u.clientY|0,exit_y:Math.round(u.clientY)})},l=()=>{let u=i.push(window.scrollY||0,Uo(),o(),window.innerHeight||0);u&&a("scroll_reversal",{velocity_px_ms:Math.round(u.velocityPxMs*1e3)/1e3,distance_px:Math.round(u.distancePx)})};return document.addEventListener("mouseout",c),window.addEventListener("scroll",l,{passive:!0}),{fires:()=>t,stop:()=>{document.removeEventListener("mouseout",c),window.removeEventListener("scroll",l)}}}var im,om,tS,nS,am,Vo,us,Uo,pm=k(()=>{"use strict";Bn();im={top_exit:.8,scroll_reversal:.5},om=.5,tS=3e4,nS=3,am=40,Vo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:am};us=class{constructor(e=Vo){this.tuning=e;this.buf=[];this.sustained=0;this.maxY=0;this.latched=!1}get maxScrollY(){return this.maxY}get sustainedSamples(){return this.sustained}push(e,t,r,s){for(e>this.maxY&&(this.maxY=e),this.buf.push({y:e,t});this.buf.length>2&&t-this.buf[1].t>this.tuning.windowMs;)this.buf.shift();let i=lm(this.buf,this.tuning.windowMs);return i!==null&&i.distancePx>=this.tuning.minDistancePx&&i.velocityPxMs>=this.tuning.minVelocityPxMs?(this.sustained+=1,this.latched||this.sustained<this.tuning.sustainSamples||this.maxY<=s||r<this.tuning.minDepthPct?null:(this.latched=!0,i)):(this.sustained=0,this.latched=!1,null)}};Uo=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function fm(n,e){let t={...iS,...n},r=Le(e,sS),s=i=>r<Math.max(0,Math.min(1,i))*100;switch(t.mode){case"off":return{record:!1,streamFromStart:!1,bucket:r,reason:"off"};case"always":return{record:!0,streamFromStart:!0,bucket:r,reason:"always"};case"sampled":return s(t.sampleRate)?{record:!0,streamFromStart:!0,bucket:r,reason:"sampled-in"}:{record:!1,streamFromStart:!1,bucket:r,reason:"sampled-out"};case"onError":default:return s(t.onErrorSampleRate)?{record:!0,streamFromStart:!1,bucket:r,reason:"onerror-armed"}:{record:!1,streamFromStart:!1,bucket:r,reason:"onerror-out"}}}var sS,iS,mm=k(()=>{"use strict";Fe();sS="wzb-replay-v1",iS={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var jo={};L(jo,{SegmentBuffer:()=>Wo,approxBytes:()=>Ht});function Ht(n){var i,o;let e=64,t=n.snapshot;if(typeof t=="string")e+=t.length;else if(t)try{e+=JSON.stringify(t).length}catch{e+=4096}let r=n.mutations;if(Array.isArray(r))for(let a of r){e+=40;let c=(o=(i=a.value)!=null?i:a.data)!=null?o:a.css;typeof c=="string"&&(e+=c.length),(a.node||a.doc)&&(e+=256),Array.isArray(a.rules)&&(e+=a.rules.reduce((l,u)=>l+u.length,0))}let s=n.events;return Array.isArray(s)&&(e+=s.length*48),e}var Wo,fs=k(()=>{"use strict";Wo=class{constructor(e,t=1/0){this.maxSegments=e;this.maxBytes=t;this.sealed=[];this.current=null;this.droppedSegments=0;this.accumBytes=0}openSegment(e){var r;this.current&&this.sealed.push(this.current);let t=Ht(e);this.current={keyframeId:(r=e.frameId)!=null?r:"",frames:[e],bytes:t},this.accumBytes+=t,this.evict()}append(e){if(!this.current)return!1;let t=Ht(e);return this.current.frames.push(e),this.current.bytes+=t,this.accumBytes+=t,this.evict(),!0}evict(){for(;this.sealed.length>0&&(this.sealed.length+1>this.maxSegments||this.accumBytes>this.maxBytes);){let e=this.sealed.shift();this.accumBytes-=e.bytes,this.droppedSegments++}}drainFrames(){let e=[];for(let t of this.sealed)e.push(...t.frames);return this.current&&e.push(...this.current.frames),e}clear(){this.sealed=[],this.current=null,this.accumBytes=0}get currentFrameCount(){var e,t;return(t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0}get currentBytes(){var e,t;return(t=(e=this.current)==null?void 0:e.bytes)!=null?t:0}get totalBytes(){return this.accumBytes}get segmentCount(){return this.sealed.length+(this.current?1:0)}get frameCount(){var e,t;return this.sealed.reduce((r,s)=>r+s.frames.length,0)+((t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0)}get dropped(){return this.droppedSegments}get hasOpenSegment(){return this.current!==null}}});var ms,hm=k(()=>{"use strict";ms=class{constructor(e,t){this.windowMs=e;this.emit=t;this.pending=[];this.timer=null}append(e){e.length&&(this.pending.push(...e),this.timer==null&&(this.timer=setTimeout(()=>this.flush(),this.windowMs)))}flush(){if(this.timer!=null&&(clearTimeout(this.timer),this.timer=null),!this.pending.length)return;let e=this.pending;this.pending=[],this.emit(e)}dispose(){this.flush()}}});function oS(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function gm(n,e){if(e===0)return n;let t=n.mutations;if(e>=1&&Array.isArray(t)&&t.length>0&&t.every(s=>s.op==="canvas"))return null;let r=n.events;if(Array.isArray(r)&&r.length>0){let s=r.filter(i=>!(e>=2&&i.k==="move"));if(s.length===0)return null;s.length!==r.length&&(n.events=s)}return n}var hs,bm=k(()=>{"use strict";hs=class{constructor(e){this.egressPending=e;this.longTaskMs=0;this._level=0;if(typeof PerformanceObserver!="undefined")try{this.po=new PerformanceObserver(t=>{for(let r of t.getEntries())this.longTaskMs+=r.duration}),this.po.observe({type:"longtask",buffered:!1})}catch{}typeof setInterval=="function"&&(this.timer=setInterval(()=>this.sample(),1e3))}sample(){var t,r;let e=this.longTaskMs;this.longTaskMs=0,this._level=oS(e,(r=(t=this.egressPending)==null?void 0:t.call(this))!=null?r:0)}get level(){return this._level}dispose(){var e;this.timer&&clearInterval(this.timer),(e=this.po)==null||e.disconnect(),this.po=void 0}}});function Ko(n){let e=n;for(let t of cS)e=e.replace(t,aS);return e}function ym(n){let e=n.snapshot;e&&typeof e=="object"&&gs(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)lS(r)}function gs(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=Ko(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=Ko(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)gs(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)gs(t)}function lS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=Ko(n.value)),n.op==="add"&&n.node&&gs(n.node)}var aS,cS,vm=k(()=>{"use strict";aS="[redacted]",cS=[/\b[\w.+-]+@[\w-]+\.[\w.-]+\b/g,/\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:\d[ -]?){13,18}\d\b/g,/(?:\+\d{1,3}[\s.-]?)?\(?\d{2,4}\)?[\s.-]\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g]});var Sm={};L(Sm,{deviceMemoryGB:()=>xm,networkHint:()=>wm,shouldDeferHeavyEgress:()=>Go,userOptedOutOfTracking:()=>uS});function dS(){if(typeof navigator!="undefined")return navigator.connection}function wm(){let n=dS(),e=typeof(n==null?void 0:n.effectiveType)=="string"?n.effectiveType:void 0;return{saveData:(n==null?void 0:n.saveData)===!0,slow:e==="2g"||e==="slow-2g",effectiveType:e}}function uS(){var t;if(typeof navigator=="undefined")return!1;let n=navigator;if(n.globalPrivacyControl===!0)return!0;let e=(t=n.doNotTrack)!=null?t:typeof window!="undefined"?window.doNotTrack:void 0;return e==="1"||e==="yes"}function xm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function Go(){let n=wm();if(n.saveData||n.slow)return!0;let e=xm();return typeof e=="number"&&e<=1}var Xo=k(()=>{"use strict"});function Yo(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(km);return n||(n=`t_${q()}`,sessionStorage.setItem(km,n)),n}}catch{}return bs!=null?bs:bs=`t_${q()}`}function Jo(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function Qo(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var km,bs,Em=k(()=>{"use strict";$();km="scalebun_replay_tab"});var ea={};L(ea,{GZ_PREFIX:()=>dn,ReplayEncoder:()=>Zo,decodeSnapshotValue:()=>fS,gunzipBase64:()=>Cm,gzipBase64:()=>Im});async function Im(n){let e=new CompressionStream("gzip"),t=e.writable.getWriter();t.write(new TextEncoder().encode(n)),t.close();let r=await new Response(e.readable).arrayBuffer();return mS(new Uint8Array(r))}async function Cm(n){let e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);let r=new DecompressionStream("gzip"),s=r.writable.getWriter();return s.write(t),s.close(),await new Response(r.readable).text()}async function fS(n){return typeof n=="string"&&n.startsWith(dn)?JSON.parse(await Cm(n.slice(dn.length))):n}function mS(n){let e="";for(let r=0;r<n.length;r+=32768)e+=String.fromCharCode.apply(null,Array.from(n.subarray(r,r+32768)));return btoa(e)}var dn,pS,Zo,ta=k(()=>{"use strict";dn="gz:",pS=`
572
572
  self.onmessage = async (e) => {
573
573
  const { id, json } = e.data;
574
574
  try {
@@ -584,7 +584,7 @@ self.onmessage = async (e) => {
584
584
  self.postMessage({ id, err: String(err) });
585
585
  }
586
586
  };
587
- `,Zo=class{constructor(){this.worker=null;this.url=null;this.nextId=1;this.pending=new Map;this.tryInitWorker()}tryInitWorker(){if(!(typeof Worker=="undefined"||typeof Blob=="undefined"||typeof URL=="undefined")&&typeof CompressionStream!="undefined")try{let e=new Blob([dS],{type:"application/javascript"});this.url=URL.createObjectURL(e),this.worker=new Worker(this.url),this.worker.onmessage=t=>{let{id:r,out:s,err:i}=t.data,o=this.pending.get(r);o&&(this.pending.delete(r),i!=null?o.reject(new Error(i)):o.resolve(s))},this.worker.onerror=()=>this.disableWorker()}catch{this.disableWorker()}}disableWorker(){var e;try{(e=this.worker)==null||e.terminate()}catch{}if(this.worker=null,this.url){try{URL.revokeObjectURL(this.url)}catch{}this.url=null}for(let t of this.pending.values())t.reject(new Error("worker disabled"));this.pending.clear()}async encodeSnapshot(e){let t;try{t=JSON.stringify(e)}catch{return e}if(this.worker)try{return dn+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return dn+await km(t)}catch{}return e}viaWorker(e){return new Promise((t,r)=>{let s=this.nextId++,i=setTimeout(()=>{this.pending.delete(s)&&r(new Error("worker timeout"))},5e3);this.pending.set(s,{resolve:o=>{clearTimeout(i),t(o)},reject:o=>{clearTimeout(i),r(o)}}),this.worker.postMessage({id:s,json:e})})}dispose(){this.disableWorker()}}});function Im(n){var e;return(e=n.shadowRoot)!=null?e:null}function ys(n,e){e.remove(n);let t=Im(n);t&&t.childNodes.forEach(r=>ys(r,e)),n.childNodes.forEach(r=>ys(r,e))}function vs(n,e=[]){let t=Im(n);return t&&(e.push(t),t.childNodes.forEach(r=>vs(r,e))),n.childNodes.forEach(r=>vs(r,e)),e}function na(n,e){e.add(n),n.childNodes.forEach(t=>na(t,e))}var Cm=k(()=>{"use strict"});var ra={};L(ra,{MutationRecorder:()=>ft,buildMutations:()=>Am});function fS(n){ws.add(n),!($t||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&($t=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=$t.call(this,e);if(e&&e.mode==="open")for(let r of ws)try{r(this,t)}catch{}return t})}function mS(n){ws.delete(n),ws.size===0&&$t&&(Element.prototype.attachShadow=$t,$t=null)}function xs(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),xs(s,e)),xs(r,e)})}function Am(n,e,t){var l,u,d,p,f,m,h;let r=new Map,s=new Map,i=[],o=[];for(let g of n)if(g.type==="attributes"){let x=e.getId(g.target);if(x==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Or.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&Rt(g.target)&&(v=Tt(v)),v!=null){let y=g.target;v=Fr(g.attributeName,v,(u=(l=y.tagName)==null?void 0:l.toLowerCase())!=null?u:"",(p=(d=y.ownerDocument)==null?void 0:d.baseURI)!=null?p:"")}r.set(`${x}:${g.attributeName}`,{op:"attr",id:x,key:g.attributeName,value:v})}else if(g.type==="characterData"){let x=e.getId(g.target);if(x==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,E=(t.maskAllText||Nr(g.target.parentElement,t.maskSel))&&!_r.has(v)?Ge(y):y;s.set(x,{op:"text",id:x,value:E})}else g.type==="childList"&&(g.removedNodes.forEach(x=>{var y;let v=e.getId(x);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),ys(x,e))}),g.addedNodes.forEach(x=>o.push({node:x,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:x,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(x);if(y==null)continue;let b=Xe(g,e,t);b&&(na(g,a),c.push({op:"add",parent:y,next:v&&(h=e.getId(v))!=null?h:null,node:b}))}return[...i,...c,...r.values(),...s.values()]}var ws,$t,ft,un=k(()=>{"use strict";et();Cm();ws=new Set,$t=null;ft=class{constructor(e,t,r={}){this.reg=e;this.onMutations=t;this.observer=null;this.queued=[];this.scheduled=!1;this.rafId=null;this.shadowObservers=new Map;this.shadowHandler=null;this.observedDoc=null;this.o=Ze(r)}observe(e){var t;typeof MutationObserver!="undefined"&&(this.observer=new MutationObserver(r=>this.enqueue(r)),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.observedDoc=(t=e.ownerDocument)!=null?t:e,xs(e,(r,s)=>this.observeShadowRoot(s)),this.shadowHandler=(r,s)=>{if(r.ownerDocument!==this.observedDoc)return;let i=!this.shadowObservers.has(s);this.observeShadowRoot(s);let o=this.reg.getId(r);i&&o!=null&&this.onMutations([{op:"shadow",host:o,shadow:Br(s,this.reg,this.o)}])},fS(this.shadowHandler))}observeShadowRoot(e){if(this.shadowObservers.has(e)||typeof MutationObserver=="undefined")return;let t=new MutationObserver(r=>this.enqueue(r));t.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.shadowObservers.set(e,t),xs(e,(r,s)=>this.observeShadowRoot(s))}enqueue(e){this.queued.push(...e),!this.scheduled&&(this.scheduled=!0,typeof requestAnimationFrame=="function"?this.rafId=requestAnimationFrame(()=>this.drain()):queueMicrotask(()=>this.drain()))}drain(){this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}flush(){this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}disconnect(){var e;this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.shadowObservers.values())t.disconnect();this.shadowObservers.clear(),this.shadowHandler&&(mS(this.shadowHandler),this.shadowHandler=null),this.observedDoc=null,this.queued=[],this.scheduled=!1,this.rafId=null}takeShadowRecords(){for(let e of this.shadowObservers.values())this.queued.push(...e.takeRecords())}process(e){if(!e.length)return;this.releaseRemovedShadowRoots(e);let t=Am(e,this.reg,this.o);t.length&&this.onMutations(t)}releaseRemovedShadowRoots(e){if(this.shadowObservers.size!==0)for(let t of e)t.type==="childList"&&t.removedNodes.forEach(r=>{if(!r.isConnected)for(let s of vs(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ia={};L(ia,{InteractionRecorder:()=>sa});function Rm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function bS(n){var r;let e=(r=n.getAttribute)==null?void 0:r.call(n,"role");if(e)return e;let t=n.tagName.toLowerCase();if(t==="a")return"link";if(t==="button"||t==="summary")return"button";if(t==="input"||t==="select"||t==="textarea"||t==="label")return"input"}function yS(n,e){var s,i,o,a,c,l,u;let t=d=>d&&d.trim()?d.trim():"",r=t((s=n.getAttribute)==null?void 0:s.call(n,"aria-label"))||t((i=n.getAttribute)==null?void 0:i.call(n,"title"))||t((o=n.getAttribute)==null?void 0:o.call(n,"alt"))||t((a=n.getAttribute)==null?void 0:a.call(n,"name"))||t((c=n.getAttribute)==null?void 0:c.call(n,"placeholder"));if(!r&&!e&&(r=t(n.innerText||n.textContent)),!r){let d=t((l=n.getAttribute)==null?void 0:l.call(n,"id")),p=t((((u=n.getAttribute)==null?void 0:u.call(n,"class"))||"").split(/\s+/)[0]);r=d?`#${d}`:p?`.${p}`:""}return r=r.replace(/\s+/g," ").trim(),r?r.slice(0,40):void 0}function vS(n,e){var t,r;try{let s=n;if(s&&s.nodeType!==1&&(s=s.parentElement),!s||s.nodeType!==1)return;let i=s,o=(r=(t=i.closest)==null?void 0:t.call(i,gS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?bS(a):void 0,label:yS(a,e)}}catch{return}}function Tm(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function wS(n,e){var s,i,o;let t=n,r=0;for(;t&&r++<500;){if(t===e)return!0;let a=(i=t.parentNode)!=null?i:(s=t.getRootNode)==null?void 0:s.call(t);t=a&&a!==t?(o=a.host)!=null?o:a:null}return!1}var hS,sa,gS,oa=k(()=>{"use strict";et();hS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,moveFlushMs:300,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},sa=class{constructor(e,t,r={}){this.reg=e;this.onEvents=t;this.pending=[];this.listeners=[];this.timer=null;this.deadTimers=new Set;this.deadObservers=new Set;this.lastMoveT=0;this.lastScrollT=0;this.lastActivityT=0;this.clickHistory=[];this.startHref="";this.frameOffsets=new Map;this.pendingSince=0;this.onTick=()=>{this.pending.length&&(this.pending.every(e=>e.k==="move")&&Date.now()-this.pendingSince<this.o.moveFlushMs||this.flush())};this.onMove=e=>{let t=e,r=Date.now();if(r-this.lastMoveT<this.o.moveThrottleMs)return;this.lastMoveT=r;let s=this.offsetFor(e.target),i=this.rootScroll(e.target);this.queue({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r},"move")};this.onClick=e=>{var h,g;let t=e,r=Date.now(),s=e.target,i=(h=s==null?void 0:s.hasAttribute)!=null&&h.call(s,"data-scalebun")?null:(g=e.composedPath)==null?void 0:g.call(e)[0],o=i!=null&&i.tagName?i:s,a=this.reg.getId(o),c=this.offsetFor(o),l=this.rootScroll(o),u=t.clientX+c.x,d=t.clientY+c.y;this.clickHistory=this.clickHistory.filter(x=>r-x.t<this.o.rageWindowMs);let p=this.clickHistory.filter(x=>Math.hypot(x.x-u,x.y-d)<=this.o.rageRadius);this.clickHistory.push({x:u,y:d,t:r});let f=p.length+1>=this.o.rageMin,m=vS(o,this.o.maskText);this.queue({k:"click",x:u,y:d,sx:l.sx,sy:l.sy,id:a,t:r,...f?{rage:!0}:{},...m?{el:m}:{}},"immediate"),this.armDeadCheck(o,{x:u,y:d,sx:l.sx,sy:l.sy,id:a,at:r,el:m})};this.onScroll=e=>{var o,a,c,l;let t=Date.now();if(t-this.lastScrollT<this.o.scrollThrottleMs)return;this.lastScrollT=t;let r=e.target,s=(o=r.documentElement)!=null?o:r,i=(a=this.reg.getId(s))!=null?a:0;this.queue({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t},"fast")};this.onInput=e=>{var i;let t=e.target,r=this.reg.getId(t);if(r==null)return;let s=(i=t.value)!=null?i:"";Rt(t)?s=Tt(s):this.o.maskInputs&&(s=Ge(s)),this.queue({k:"input",id:r,value:s,t:Date.now()},"fast")};this.onResize=()=>{this.queue({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()},"fast")};this.o={...hS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Rm(),this.add(document,"mousemove",this.onMove,!0),this.add(document,"click",this.onClick,!0),this.add(document,"scroll",this.onScroll,!0),this.add(document,"input",this.onInput,!0),typeof window!="undefined"&&this.add(window,"resize",this.onResize,!0),this.timer=setInterval(this.onTick,this.o.flushMs))}queue(e,t){var r,s;if(this.pending.length||(this.pendingSince=Date.now()),this.pending.push(e),t==="immediate"){try{(s=(r=this.o).beforeImmediateFlush)==null||s.call(r)}catch{}this.flush()}}observeFrame(e,t){this.frameOffsets.has(e)||(this.frameOffsets.set(e,t),this.add(e,"mousemove",this.onMove,!0),this.add(e,"click",this.onClick,!0),this.add(e,"scroll",this.onScroll,!0),this.add(e,"input",this.onInput,!0))}unobserveFrame(e){this.frameOffsets.delete(e)&&(this.listeners=this.listeners.filter(t=>{if(t.target===e){try{t.target.removeEventListener(t.type,t.fn,t.capture)}catch{}return!1}return!0}))}rootScroll(e){var t,r,s,i,o,a,c,l,u,d;try{let p=e&&e.ownerDocument||(typeof document!="undefined"?document:null);if(!p)return{sx:0,sy:0};let f=p.defaultView,m=(o=(i=(r=f==null?void 0:f.scrollX)!=null?r:(t=p.documentElement)==null?void 0:t.scrollLeft)!=null?i:(s=p.body)==null?void 0:s.scrollLeft)!=null?o:0,h=(d=(u=(c=f==null?void 0:f.scrollY)!=null?c:(a=p.documentElement)==null?void 0:a.scrollTop)!=null?u:(l=p.body)==null?void 0:l.scrollTop)!=null?d:0;return{sx:Math.round(m),sy:Math.round(h)}}catch{return{sx:0,sy:0}}}offsetFor(e){let t=e&&e.ownerDocument||null,r=t?this.frameOffsets.get(t):void 0;if(!r)return{x:0,y:0};try{return r()}catch{return{x:0,y:0}}}flush(){if(!this.pending.length)return;let e=this.pending;this.pending=[],this.onEvents(e)}disconnect(){for(let e of this.listeners)e.target.removeEventListener(e.type,e.fn,e.capture);this.listeners=[],this.timer&&clearInterval(this.timer),this.timer=null;for(let e of this.deadTimers)clearTimeout(e);this.deadTimers.clear();for(let e of this.deadObservers)try{e.disconnect()}catch{}this.deadObservers.clear(),this.frameOffsets.clear(),this.pending=[]}add(e,t,r,s){e.addEventListener(t,r,s),this.listeners.push({target:e,type:t,fn:r,capture:s})}armDeadCheck(e,t){let{x:r,y:s,id:i,at:o,el:a}=t,c=e&&e.nodeType===1&&e.isConnected?e:null,l=!1,u=null,d=()=>{if(u){try{u.disconnect()}catch{}this.deadObservers.delete(u),u=null}};if(typeof MutationObserver!="undefined"&&typeof document!="undefined")try{u=new MutationObserver(f=>{for(let m of f){let h=c?wS(m.target,c):!1,g=m.type==="childList"&&(Tm(m.addedNodes)||Tm(m.removedNodes));if(h||g){l=!0;break}}l&&d()}),u.observe(document,{subtree:!0,childList:!0}),c&&u.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.deadObservers.add(u)}catch{l=!0}else l=!0;let p=setTimeout(()=>{this.deadTimers.delete(p),d(),!l&&Rm()===this.startHref&&this.queue({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}},"immediate")},this.o.deadMs);this.deadTimers.add(p)}};gS='a[href],button,input,select,textarea,label,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=checkbox],[role=radio],[role=switch],[contenteditable=""],[contenteditable=true],[tabindex]:not([tabindex="-1"])'});var Om={};L(Om,{bridgeCrossOriginFrame:()=>aa,installChildSatellite:()=>xS,nodeIdBaseFor:()=>ca});function xS(n,e={}){if(typeof window=="undefined"||window.parent===window)return()=>{};let t=Ze(e),r,s=!1,i=o=>{let a=o.data;if(!a||a.scalebun!==Mm||s||!_m(o.origin,n))return;s=!0;let c=new sn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Xe(document,c,t);u&&l({scalebun:Pm,doc:u}),r=new ft(c,d=>l({scalebun:Lm,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function aa(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!_m(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Pm&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Lm&&Array.isArray(c.mutations)&&t.emit(c.mutations))};window.addEventListener("message",s);let i="*";try{i=new URL(n.src,location.href).origin}catch{}let o=()=>{try{r.postMessage({scalebun:Mm,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Mm,Pm,Lm,_m,ca,la=k(()=>{"use strict";on();et();un();Mm="scalebun:frame-init",Pm="scalebun:frame-key",Lm="scalebun:frame-mut",_m=(n,e)=>e.includes("*")||e.includes(n);ca=n=>n*1e6});var ua={};L(ua,{IframeManager:()=>da});var da,pa=k(()=>{"use strict";et();un();la();da=class{constructor(e,t,r={},s={}){this.reg=e;this.onMutations=t;this.attached=new Map;this.loadListeners=[];this.bridges=new Map;this.started=!1;var i,o;this.o=Ze(r),this.onFrame=s.onFrame,this.onUnframe=s.onUnframe,this.maxDepth=(i=s.maxDepth)!=null?i:3,this.frameOrigins=(o=s.frameOrigins)!=null?o:[]}start(){this.started||typeof document=="undefined"||(this.started=!0,this.installLoad(document,0),this.scan(document,0))}scan(e,t){if(!(t>this.maxDepth)){this.sweep();try{e.querySelectorAll("iframe").forEach(r=>this.attach(r,t))}catch{}}}sweep(){var e;if(this.attached.size)for(let[t,{doc:r,rec:s}]of this.attached)t.isConnected||(s.disconnect(),(e=this.onUnframe)==null||e.call(this,r),this.attached.delete(t));if(this.bridges.size)for(let[t,r]of this.bridges)t.isConnected||(r(),this.bridges.delete(t))}installLoad(e,t){let r=s=>{let i=s.target;i&&i.tagName==="IFRAME"&&this.attach(i,t)};try{e.addEventListener("load",r,!0),this.loadListeners.push({doc:e,fn:r})}catch{}}attach(e,t){var c,l;if(t>this.maxDepth)return;let r=null;try{r=e.contentDocument}catch{this.bridgeCrossOrigin(e);return}if(!r||!r.documentElement){this.bridgeCrossOrigin(e);return}let s=this.attached.get(e);if(s){if(s.doc===r)return;s.rec.disconnect(),(c=this.onUnframe)==null||c.call(this,s.doc),this.attached.delete(e)}let i=this.reg.getId(e);if(i==null)return;let o=Xe(r,this.reg,this.o);o&&this.onMutations([{op:"iframe",id:i,doc:o}]);let a=new ft(this.reg,this.onMutations,this.o);a.observe(r.documentElement),this.attached.set(e,{doc:r,rec:a}),(l=this.onFrame)==null||l.call(this,r,()=>{try{let u=e.getBoundingClientRect();return{x:u.left,y:u.top}}catch{return{x:0,y:0}}}),t<this.maxDepth&&(this.installLoad(r,t+1),this.scan(r,t+1))}bridgeCrossOrigin(e){if(!this.frameOrigins.length||this.bridges.has(e))return;let t=this.reg.getId(e);if(t==null)return;let r=aa(e,t,{nodeIdBase:ca(t),allowedChildOrigins:this.frameOrigins,emit:this.onMutations});this.bridges.set(e,r)}subDocuments(){return this.sweep(),[...this.attached.values()].map(e=>e.doc)}disconnect(){for(let{rec:e}of this.attached.values())e.disconnect();this.attached.clear();for(let e of this.bridges.values())e();this.bridges.clear();for(let{doc:e,fn:t}of this.loadListeners)try{e.removeEventListener("load",t,!0)}catch{}this.loadListeners=[],this.started=!1}}});var Nm={};L(Nm,{CanvasRecorder:()=>fa});var SS,fa,Bm=k(()=>{"use strict";SS="data-scalebun-block",fa=class{constructor(e,t,r=()=>{},s={}){this.reg=e;this.onMutations=t;this.log=r;this.timer=null;this.last=new Map;this.tainted=new Set;this.scratch=null;var i,o,a;this.intervalMs=Math.max(50,Math.round(1e3/((i=s.fps)!=null?i:3))),this.maxDim=(o=s.maxDim)!=null?o:1024,this.quality=(a=s.quality)!=null?a:.6,this.getDocs=s.getDocs}start(){typeof document!="undefined"&&(this.capture(),this.timer=setInterval(()=>this.capture(),this.intervalMs))}disconnect(){this.timer&&clearInterval(this.timer),this.timer=null,this.last.clear(),this.tainted.clear(),this.scratch=null}capture(){let e=this.getDocs?this.getDocs():typeof document!="undefined"?[document]:[],t=[],r=new Set;for(let s of e){let i;try{i=s.querySelectorAll("canvas")}catch{continue}i.forEach(o=>{let a=this.reg.getId(o);if(a==null||(r.add(a),o.hasAttribute(SS)))return;let c=o.width,l=o.height;if(!c||!l)return;let u;try{u=this.encode(o,c,l)}catch{this.tainted.has(a)||(this.tainted.add(a),this.log("[scalebun] canvas not capturable (tainted / cross-origin)"));return}this.last.get(a)!==u&&(this.last.set(a,u),t.push({op:"canvas",id:a,data:u,w:c,h:l}))})}if(this.last.size>r.size)for(let s of this.last.keys())r.has(s)||this.last.delete(s);if(this.tainted.size)for(let s of this.tainted)r.has(s)||this.tainted.delete(s);t.length&&this.onMutations(t)}encode(e,t,r){var i;let s=Math.min(1,this.maxDim/Math.max(t,r));if(s<1){let o=(i=this.scratch)!=null?i:this.scratch=document.createElement("canvas");o.width=Math.max(1,Math.round(t*s)),o.height=Math.max(1,Math.round(r*s));let a=o.getContext("2d");if(!a)throw new Error("no 2d context");return a.clearRect(0,0,o.width,o.height),a.drawImage(e,0,0,o.width,o.height),o.toDataURL("image/webp",this.quality)}return e.toDataURL("image/webp",this.quality)}}});var Fm={};L(Fm,{installCadence:()=>kS});function kS(n){let e=[];if(n.keyframeIntervalMs>0&&n.keyframeIntervalMs!==1/0){let t=setInterval(()=>n.onCheckpoint("time"),n.keyframeIntervalMs);e.push(()=>clearInterval(t))}if(typeof document!="undefined"){let t=()=>{document.visibilityState==="visible"&&n.onCheckpoint("visible")};document.addEventListener("visibilitychange",t),e.push(()=>document.removeEventListener("visibilitychange",t))}if(typeof window!="undefined"&&typeof history!="undefined"&&typeof location!="undefined"){let t=location.href,r=()=>{location.href!==t&&(t=location.href,n.onCheckpoint("url"))};window.addEventListener("popstate",r),window.addEventListener("hashchange",r);let s=history.pushState,i=history.replaceState;history.pushState=function(...o){let a=s.apply(this,o);return r(),a},history.replaceState=function(...o){let a=i.apply(this,o);return r(),a},e.push(()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r),history.pushState!==s&&(history.pushState=s),history.replaceState!==i&&(history.replaceState=i)})}return()=>{for(let t of e)try{t()}catch{}}}var Dm=k(()=>{"use strict"});var zm={};L(zm,{RecorderController:()=>ks,createRecorder:()=>LS});function PS(n){if(n.frameType==="keyframe")return"keyframe";let e=n.mutations;if(e!=null&&e.length)return e.every(r=>r.op==="canvas")?"canvas":"mutation";let t=n.events;return t!=null&&t.length?t.some(r=>r.k==="click"||r.k==="deadclick"||r.k==="input")?"interaction":t.some(r=>r.k==="scroll"||r.k==="viewport")?"scroll":"move":"other"}async function LS(n,e){let t=new ks(n,e);return await t.init(),t}function Hm(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function $m(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var qm,Ss,IS,CS,AS,RS,TS,MS,ks,Um=k(()=>{"use strict";$();Wt();Mn();fs();fm();hm();bm();Xo();Sm();En();qm=120,Ss=2e5,IS=8,CS=2e6,AS=3e4,RS=5*6e4,TS=100,MS=300;ks=class{constructor(e,t){this.ctx=e;this.decision=t;this.active=!1;this.seq=Ys(0);this.keyframeId="";this.checkpointing=!1;this.dirtySinceKeyframe=!1;this.lastKeyframeAt=0;this.streamChainBytes=0;this.streamChainFrames=0;this.pendingEncodes=new Set;this.shed=0;this.producerCounts={};this.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&Go()&&(this.streaming=!1,e.log("[replay] save-data/slow \u2192 buffered")),this.persistBuffer=!!((r=e.replaySampling)!=null&&r.persistBuffer)&&!this.streaming,this.maskText=(s=e.maskReplayText)!=null?s:!1}nextSeq(){let e=Ys(1);return this.seq=e+1,e}get isActive(){return this.active}stats(){var t,r,s,i,o,a;let e=this.segBuf;return{recording:this.active&&!this.paused,paused:this.paused,streaming:this.streaming,sampleReason:this.decision.reason,sampleBucket:this.decision.bucket,qualityLevel:(r=(t=this.adaptive)==null?void 0:t.level)!=null?r:0,segments:(s=e==null?void 0:e.segmentCount)!=null?s:0,frames:(i=e==null?void 0:e.frameCount)!=null?i:0,captured:this.keyframeId!=null,bufferBytes:(o=e==null?void 0:e.totalBytes)!=null?o:0,droppedSegments:(a=e==null?void 0:e.dropped)!=null?a:0,shedFrames:this.shed,producers:Object.fromEntries(Object.entries(this.producerCounts).map(([c,l])=>[c,{...l}]))}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(ta(),ea)),Promise.resolve().then(()=>(fs(),jo))]);this.segBuf=new t(IS,CS),this.persistBuffer&&(this.replayStore=new Be("pending-replay"),await this.recoverPriorPreRoll(),this.installPersistGuards()),this.encoder=new e,this.disposeEncoder=()=>{var r;return(r=this.encoder)==null?void 0:r.dispose()},await this.arm(),this.unsubSignal=this.ctx.onSignal(()=>this.flush()),this.active=!0}async arm(){var v,y,b,E;if(typeof document=="undefined")return;let e=this.ctx,[{NodeRegistry:t},{takeSnapshot:r},{MutationRecorder:s},{InteractionRecorder:i},{CssomRecorder:o},{IframeManager:a}]=await Promise.all([Promise.resolve().then(()=>(on(),qr)),Promise.resolve().then(()=>(et(),Dr)),Promise.resolve().then(()=>(un(),ra)),Promise.resolve().then(()=>(oa(),ia)),Promise.resolve().then(()=>(Pr(),Xi)),Promise.resolve().then(()=>(pa(),ua))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(v=e.maskInputs)!=null?v:!0,maskSelectors:e.maskSelectors};this.redactPII=((y=e.replaySampling)==null?void 0:y.privacyLevel)==="strict"&&!l.maskAllText,this.reg=c,this.snapOpts=l,this.takeSnapshotFn=r;let u=r(document,c,l);this.keyframeId=`f_${H()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:Hm(),href:$m(),tabId:Yo(),viewId:Qo(),route:Jo(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new ms(TS,w=>this.push(this.delta({mutations:w})));this.deltaBatcher=p;let f=new i(c,w=>{this.push(this.delta({events:w}))},{maskText:!!l.maskAllText,moveFlushMs:MS,beforeImmediateFlush:()=>p.flush()}),m=new s(c,w=>{f.notifyDomActivity(),p.append(w)},l),h=new o(c,w=>{f.notifyDomActivity(),p.append(w)}),g=new a(c,w=>{f.notifyDomActivity(),p.append(w)},l,{onFrame:(w,I)=>f.observeFrame(w,I),onUnframe:w=>f.unobserveFrame(w),frameOrigins:(b=e.replayFrameOrigins)!=null?b:[]});if(((E=e.replayFrameOrigins)!=null?E:[]).length&&Promise.resolve().then(()=>(la(),Om)).then(({installChildSatellite:w})=>{var I;this.childSatelliteStop=w((I=e.replayFrameOrigins)!=null?I:[],l)}),this.mutationRec=m,this.cssomRec=h,m.observe(document.documentElement),f.observe(),h.install(),g.start(),this.disconnectRecorder=()=>m.disconnect(),this.disconnectInteractions=()=>f.disconnect(),this.disconnectCssom=()=>h.disconnect(),this.disconnectIframes=()=>g.disconnect(),e.replayCanvas){let{CanvasRecorder:w}=await Promise.resolve().then(()=>(Bm(),Nm)),I=new w(c,S=>{f.notifyDomActivity(),this.push(this.delta({mutations:S}))},(...S)=>e.log(...S));I.start(),this.disconnectCanvas=()=>I.disconnect()}this.adaptive=new hs(e.egressPending);let{installCadence:x}=await Promise.resolve().then(()=>(Dm(),Fm));this.disconnectCadence=x({keyframeIntervalMs:AS,onCheckpoint:w=>this.checkpoint(w)})}disarm(){var e,t,r,s,i,o,a,c,l,u,d;try{(e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.dispose()}catch{}this.deltaBatcher=void 0,(s=this.disconnectRecorder)==null||s.call(this),(i=this.disconnectInteractions)==null||i.call(this),(o=this.disconnectCssom)==null||o.call(this),(a=this.disconnectCanvas)==null||a.call(this),(c=this.disconnectIframes)==null||c.call(this),(l=this.childSatelliteStop)==null||l.call(this),(u=this.disconnectCadence)==null||u.call(this),(d=this.adaptive)==null||d.dispose(),this.disconnectRecorder=void 0,this.disconnectInteractions=void 0,this.disconnectCssom=void 0,this.disconnectCanvas=void 0,this.disconnectIframes=void 0,this.childSatelliteStop=void 0,this.disconnectCadence=void 0,this.adaptive=void 0,this.reg=void 0,this.mutationRec=void 0,this.cssomRec=void 0,this.takeSnapshotFn=void 0,this.snapOpts=void 0}pause(){!this.active||this.paused||(this.disarm(),this.paused=!0,this.ctx.log("[replay] paused"))}resume(){!this.active||!this.paused||(this.paused=!1,this.arm().then(()=>this.ctx.log("[replay] resumed")))}setPrivacy(e){typeof(e==null?void 0:e.maskAllText)!="boolean"||e.maskAllText===this.maskText||(this.maskText=e.maskAllText,this.active&&!this.paused&&(this.disarm(),this.arm()),this.ctx.log("[replay] privacy set: maskAllText="+this.maskText))}delta(e){return{kind:"frame",renderer:"dom",frameType:"delta",frameId:`f_${H()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:Yo(),viewId:Qo(),route:Jo(),masked:!0,timestamp:P()}}push(e){var i,o;if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&gm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let a=mm(e,this.adaptive.level);if(!a){this.shed++;return}e=a}let t=PS(e),r=(o=(i=this.producerCounts)[t])!=null?o:i[t]={frames:0,bytes:0};if(r.frames++,r.bytes+=Ht(e),this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=Ht(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=qm||this.streamChainBytes>=Ss)&&this.checkpoint(this.streamChainBytes>=Ss?"segment-bytes":"segment-frames"));return}let s=this.segBuf;s&&(e.frameType==="keyframe"?s.openSegment(e):s.append(e),!this.checkpointing&&e.frameType==="delta"&&(s.currentFrameCount>=qm||s.currentBytes>=Ss)&&this.checkpoint(s.currentBytes>=Ss?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r,s;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")){this.checkpointing=!0;try{if((t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush(),(s=this.deltaBatcher)==null||s.flush(),(e==="time"||e==="visible")&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<RS)return;let i=this.takeSnapshotFn(document,this.reg,this.snapOpts),o=`f_${H()}`;this.keyframeId=o,this.streamChainBytes=0,this.streamChainFrames=0;let a={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:o,seq:this.nextSeq(),snapshot:i,viewport:Hm(),href:$m(),masked:!0,trigger:e,timestamp:P()};this.push(a),this.compressInPlace(a,i),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P()}finally{this.checkpointing=!1}}}async recoverPriorPreRoll(){var e;if(this.replayStore)try{let t=await this.replayStore.load();if(Array.isArray(t)&&t.length){let r=0;for(let s of t)this.ctx.emit(s),r=Math.max(r,(e=s.seq)!=null?e:0);this.seq=Mc(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(kt(this.segBuf.drainFrames(),()=>!0,e=>e.frameType==="keyframe"))}installPersistGuards(){typeof window!="undefined"&&(this.onPageHide=()=>{var e;return void((e=this.replayStore)==null?void 0:e.clear())},window.addEventListener("pagehide",this.onPageHide),this.onVisHidden=()=>{typeof document!="undefined"&&document.visibilityState==="hidden"&&this.persistPreRoll()},typeof document!="undefined"&&document.addEventListener("visibilitychange",this.onVisHidden))}compressInPlace(e,t){let r=this.encoder;if(!r)return;let s=r.encodeSnapshot(t).then(i=>{e.snapshot=i}).catch(()=>{}).finally(()=>{this.pendingEncodes.delete(s)});this.pendingEncodes.add(s)}flush(){var e,t,r,s,i;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.flush(),this.segBuf)for(let o of this.segBuf.drainFrames())this.ctx.emit(o);(s=this.segBuf)==null||s.clear(),this.streaming=!0,(i=this.replayStore)==null||i.clear()}teardown(){var e,t,r,s;this.disarm(),(e=this.disposeEncoder)==null||e.call(this),this.onPageHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onPageHide),this.onPageHide=void 0,this.onVisHidden&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisHidden),this.onVisHidden=void 0,(t=this.replayStore)==null||t.clear(),this.replayStore=void 0,(r=this.unsubSignal)==null||r.call(this),(s=this.segBuf)==null||s.clear(),this.segBuf=void 0,this.encoder=void 0,this.pendingEncodes.clear(),this.streaming=!1,this.checkpointing=!1,this.paused=!1,this.active=!1}}});var Wm={};L(Wm,{installWebGLPreserve:()=>OS});function Vm(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[ma])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&_S.has(s)){let o={...i!=null?i:{},preserveDrawingBuffer:!0};return t.call(this,s,o)}return t.call(this,s,i)};return n.getContext=r,e[ma]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[ma]}}function OS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=Vm(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=Vm(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var ma,_S,jm=k(()=>{"use strict";ma="__scalebunWebglPatched",_S=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var Gm={};L(Gm,{ReplayFeature:()=>ha});var NS,Es,BS,Km,ha,Xm=k(()=>{"use strict";pm();ti();NS=400,Es="sdk_replay_capture_failed",BS=5e3,Km=()=>Promise.resolve().then(()=>(Um(),zm)),ha=class{constructor(){this.name="replay"}get isActive(){var e,t;return(t=(e=this.controller)==null?void 0:e.isActive)!=null?t:!1}async setup(e){var r;if(typeof document=="undefined"||typeof MutationObserver=="undefined"){e.trackEvent(Es,{stage:"init",reason:"ENV_UNSUPPORTED"});return}let t=um(e.replaySampling,(r=e.sessionId)!=null?r:"");if(e.log("[replay] sampling:",t.reason,"(bucket",t.bucket+")"),!!t.record){if(e.respectDnt){let{userOptedOutOfTracking:s}=await Promise.resolve().then(()=>(Xo(),wm));if(s()){e.log("[replay] dnt: skip"),e.trackEvent(Es,{stage:"init",reason:"DNT_OPTED_OUT"});return}}if(e.replayCanvas){let{installWebGLPreserve:s}=await Promise.resolve().then(()=>(jm(),Wm));this.uninstallWebGL=s()}this.armed=this.arm(e,t)}}async arm(e,t){var r;try{await this.load(e,t)}catch(s){let i=String((r=s==null?void 0:s.message)!=null?r:s).slice(0,300);e.trackEvent(Es,{stage:"init",reason:ei(i)?"ENGINE_CHUNK_LOAD_FAILED":"RECORDER_INIT_FAILED",message:i})}}async load(e,t){var i;let r=o=>{o.catch(()=>{})};r(Promise.resolve().then(()=>(on(),qr))),r(Promise.resolve().then(()=>(et(),Dr))),r(Promise.resolve().then(()=>(un(),ra))),r(Promise.resolve().then(()=>(oa(),ia))),r(Promise.resolve().then(()=>(Pr(),Xi))),r(Promise.resolve().then(()=>(pa(),ua))),r(Promise.resolve().then(()=>(ta(),ea))),r(Promise.resolve().then(()=>(fs(),jo)));let s;try{({createRecorder:s}=await Km())}catch(o){await new Promise(a=>setTimeout(a,NS)),{createRecorder:s}=await Km(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((i=o==null?void 0:o.message)!=null?i:o).slice(0,300)})}this.controller=await s(e,t),this.watchdog=setTimeout(()=>{var a;let o=(a=this.controller)==null?void 0:a.stats();o!=null&&o.recording&&!o.captured&&e.trackEvent(Es,{stage:"first-frame",reason:"NO_FRAME_AFTER_ARM",streaming:o.streaming,bucket:o.sampleBucket})},BS)}flush(){var e;(e=this.controller)==null||e.flush()}stats(){var e,t;return(t=(e=this.controller)==null?void 0:e.stats())!=null?t:null}checkpoint(e="manual"){var t;(t=this.controller)==null||t.forceCheckpoint(e)}pause(){var e;(e=this.controller)==null||e.pause()}resume(){var e;(e=this.controller)==null||e.resume()}setPrivacy(e){var t;(t=this.controller)==null||t.setPrivacy(e)}teardown(){var e,t;clearTimeout(this.watchdog),this.watchdog=void 0,(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}}});var Ym,we,ga=k(()=>{"use strict";Ym={title:"Inbox",panelAria:"Notifications",open:"Open notifications",openUnread:n=>`Open notifications, ${n} unread`,close:"Close notifications",unread:n=>`${n} unread`,noUnread:"No unread messages",emptyTitle:"You\u2019re all caught up",emptyBody:"Your notifications will appear here.",emptyAnnounce:"No notifications",allTab:"All",viewAll:"View all",pin:"Pin",unpin:"Unpin",archive:"Archive",delete:"Delete"},we={received:"$message_received",seen:"$message_seen",read:"$message_read",cta:"$message_cta_clicked",archived:"$message_archived",unarchived:"$message_unarchived",pinned:"$message_pinned",unpinned:"$message_unpinned",deleted:"$message_deleted",expired:"$message_expired",unreadChanged:"$inbox_unread_changed"}});var ba={};L(ba,{mountInbox:()=>US});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function $S(n){let e=Math.max(0,Math.floor((Date.now()-n)/1e3));if(e<60)return"now";let t=Math.floor(e/60);if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let s=Math.floor(r/24);if(s<7)return`${s}d`;let i=Math.floor(s/7);return i<5?`${i}w`:`${Math.floor(s/30)}mo`}function zS(n,e,t,r,s,i){let o=e.includes("right")?"right":"left",a=t?o==="right"?"left":"right":o,c=e.includes("bottom")?"bottom":"top",l=(M,R)=>{var A;return`var(--scalebun-inbox-${M},${(A=i==null?void 0:i[M])!=null?A:R})`},u=l("bg",n?"#1b1922":"#ffffff"),d=l("fg",n?"#edeaf2":"#221e30"),p=l("sub",n?"#9a95a6":"#6b6580"),f=l("line",n?"rgba(255,255,255,.10)":"#eae7f2"),m=l("surf",n?"#262131":"#f7f6fb"),h=l("accent","#7c6cf0"),g=l("unread",n?"rgba(124,108,240,.10)":"rgba(124,108,240,.06)"),x=l("badge","#ff5b6b"),v=l("font","system-ui,-apple-system,Segoe UI,Roboto,sans-serif"),y=l("shadow","0 0 40px rgba(0,0,0,.22)"),b=l("width","380px"),E=l("gap","11px"),w=l("z","2147483600"),I=M=>l("radius",M),S=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
587
+ `,Zo=class{constructor(){this.worker=null;this.url=null;this.nextId=1;this.pending=new Map;this.tryInitWorker()}tryInitWorker(){if(!(typeof Worker=="undefined"||typeof Blob=="undefined"||typeof URL=="undefined")&&typeof CompressionStream!="undefined")try{let e=new Blob([pS],{type:"application/javascript"});this.url=URL.createObjectURL(e),this.worker=new Worker(this.url),this.worker.onmessage=t=>{let{id:r,out:s,err:i}=t.data,o=this.pending.get(r);o&&(this.pending.delete(r),i!=null?o.reject(new Error(i)):o.resolve(s))},this.worker.onerror=()=>this.disableWorker()}catch{this.disableWorker()}}disableWorker(){var e;try{(e=this.worker)==null||e.terminate()}catch{}if(this.worker=null,this.url){try{URL.revokeObjectURL(this.url)}catch{}this.url=null}for(let t of this.pending.values())t.reject(new Error("worker disabled"));this.pending.clear()}async encodeSnapshot(e){let t;try{t=JSON.stringify(e)}catch{return e}if(this.worker)try{return dn+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return dn+await Im(t)}catch{}return e}viaWorker(e){return new Promise((t,r)=>{let s=this.nextId++,i=setTimeout(()=>{this.pending.delete(s)&&r(new Error("worker timeout"))},5e3);this.pending.set(s,{resolve:o=>{clearTimeout(i),t(o)},reject:o=>{clearTimeout(i),r(o)}}),this.worker.postMessage({id:s,json:e})})}dispose(){this.disableWorker()}}});function Am(n){var e;return(e=n.shadowRoot)!=null?e:null}function ys(n,e){e.remove(n);let t=Am(n);t&&t.childNodes.forEach(r=>ys(r,e)),n.childNodes.forEach(r=>ys(r,e))}function vs(n,e=[]){let t=Am(n);return t&&(e.push(t),t.childNodes.forEach(r=>vs(r,e))),n.childNodes.forEach(r=>vs(r,e)),e}function na(n,e){e.add(n),n.childNodes.forEach(t=>na(t,e))}var Rm=k(()=>{"use strict"});var ra={};L(ra,{MutationRecorder:()=>ft,buildMutations:()=>Tm});function hS(n){ws.add(n),!($t||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&($t=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=$t.call(this,e);if(e&&e.mode==="open")for(let r of ws)try{r(this,t)}catch{}return t})}function gS(n){ws.delete(n),ws.size===0&&$t&&(Element.prototype.attachShadow=$t,$t=null)}function xs(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),xs(s,e)),xs(r,e)})}function Tm(n,e,t){var l,u,d,p,f,m,h;let r=new Map,s=new Map,i=[],o=[];for(let g of n)if(g.type==="attributes"){let x=e.getId(g.target);if(x==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Or.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&Rt(g.target)&&(v=Tt(v)),v!=null){let y=g.target;v=Fr(g.attributeName,v,(u=(l=y.tagName)==null?void 0:l.toLowerCase())!=null?u:"",(p=(d=y.ownerDocument)==null?void 0:d.baseURI)!=null?p:"")}r.set(`${x}:${g.attributeName}`,{op:"attr",id:x,key:g.attributeName,value:v})}else if(g.type==="characterData"){let x=e.getId(g.target);if(x==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,E=(t.maskAllText||Nr(g.target.parentElement,t.maskSel))&&!_r.has(v)?Ge(y):y;s.set(x,{op:"text",id:x,value:E})}else g.type==="childList"&&(g.removedNodes.forEach(x=>{var y;let v=e.getId(x);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),ys(x,e))}),g.addedNodes.forEach(x=>o.push({node:x,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:x,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(x);if(y==null)continue;let b=Xe(g,e,t);b&&(na(g,a),c.push({op:"add",parent:y,next:v&&(h=e.getId(v))!=null?h:null,node:b}))}return[...i,...c,...r.values(),...s.values()]}var ws,$t,ft,un=k(()=>{"use strict";et();Rm();ws=new Set,$t=null;ft=class{constructor(e,t,r={}){this.reg=e;this.onMutations=t;this.observer=null;this.queued=[];this.scheduled=!1;this.rafId=null;this.shadowObservers=new Map;this.shadowHandler=null;this.observedDoc=null;this.o=Ze(r)}observe(e){var t;typeof MutationObserver!="undefined"&&(this.observer=new MutationObserver(r=>this.enqueue(r)),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.observedDoc=(t=e.ownerDocument)!=null?t:e,xs(e,(r,s)=>this.observeShadowRoot(s)),this.shadowHandler=(r,s)=>{if(r.ownerDocument!==this.observedDoc)return;let i=!this.shadowObservers.has(s);this.observeShadowRoot(s);let o=this.reg.getId(r);i&&o!=null&&this.onMutations([{op:"shadow",host:o,shadow:Br(s,this.reg,this.o)}])},hS(this.shadowHandler))}observeShadowRoot(e){if(this.shadowObservers.has(e)||typeof MutationObserver=="undefined")return;let t=new MutationObserver(r=>this.enqueue(r));t.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.shadowObservers.set(e,t),xs(e,(r,s)=>this.observeShadowRoot(s))}enqueue(e){this.queued.push(...e),!this.scheduled&&(this.scheduled=!0,typeof requestAnimationFrame=="function"?this.rafId=requestAnimationFrame(()=>this.drain()):queueMicrotask(()=>this.drain()))}drain(){this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}flush(){this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}disconnect(){var e;this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.shadowObservers.values())t.disconnect();this.shadowObservers.clear(),this.shadowHandler&&(gS(this.shadowHandler),this.shadowHandler=null),this.observedDoc=null,this.queued=[],this.scheduled=!1,this.rafId=null}takeShadowRecords(){for(let e of this.shadowObservers.values())this.queued.push(...e.takeRecords())}process(e){if(!e.length)return;this.releaseRemovedShadowRoots(e);let t=Tm(e,this.reg,this.o);t.length&&this.onMutations(t)}releaseRemovedShadowRoots(e){if(this.shadowObservers.size!==0)for(let t of e)t.type==="childList"&&t.removedNodes.forEach(r=>{if(!r.isConnected)for(let s of vs(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ia={};L(ia,{InteractionRecorder:()=>sa});function Mm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function vS(n){var r;let e=(r=n.getAttribute)==null?void 0:r.call(n,"role");if(e)return e;let t=n.tagName.toLowerCase();if(t==="a")return"link";if(t==="button"||t==="summary")return"button";if(t==="input"||t==="select"||t==="textarea"||t==="label")return"input"}function wS(n,e){var s,i,o,a,c,l,u;let t=d=>d&&d.trim()?d.trim():"",r=t((s=n.getAttribute)==null?void 0:s.call(n,"aria-label"))||t((i=n.getAttribute)==null?void 0:i.call(n,"title"))||t((o=n.getAttribute)==null?void 0:o.call(n,"alt"))||t((a=n.getAttribute)==null?void 0:a.call(n,"name"))||t((c=n.getAttribute)==null?void 0:c.call(n,"placeholder"));if(!r&&!e&&(r=t(n.innerText||n.textContent)),!r){let d=t((l=n.getAttribute)==null?void 0:l.call(n,"id")),p=t((((u=n.getAttribute)==null?void 0:u.call(n,"class"))||"").split(/\s+/)[0]);r=d?`#${d}`:p?`.${p}`:""}return r=r.replace(/\s+/g," ").trim(),r?r.slice(0,40):void 0}function xS(n,e){var t,r;try{let s=n;if(s&&s.nodeType!==1&&(s=s.parentElement),!s||s.nodeType!==1)return;let i=s,o=(r=(t=i.closest)==null?void 0:t.call(i,yS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?vS(a):void 0,label:wS(a,e)}}catch{return}}function Pm(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function SS(n,e){var s,i,o;let t=n,r=0;for(;t&&r++<500;){if(t===e)return!0;let a=(i=t.parentNode)!=null?i:(s=t.getRootNode)==null?void 0:s.call(t);t=a&&a!==t?(o=a.host)!=null?o:a:null}return!1}var bS,sa,yS,oa=k(()=>{"use strict";et();bS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,moveFlushMs:300,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},sa=class{constructor(e,t,r={}){this.reg=e;this.onEvents=t;this.pending=[];this.listeners=[];this.timer=null;this.deadTimers=new Set;this.deadObservers=new Set;this.lastMoveT=0;this.lastScrollT=0;this.lastActivityT=0;this.clickHistory=[];this.startHref="";this.frameOffsets=new Map;this.pendingSince=0;this.onTick=()=>{this.pending.length&&(this.pending.every(e=>e.k==="move")&&Date.now()-this.pendingSince<this.o.moveFlushMs||this.flush())};this.onMove=e=>{let t=e,r=Date.now();if(r-this.lastMoveT<this.o.moveThrottleMs)return;this.lastMoveT=r;let s=this.offsetFor(e.target),i=this.rootScroll(e.target);this.queue({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r},"move")};this.onClick=e=>{var h,g;let t=e,r=Date.now(),s=e.target,i=(h=s==null?void 0:s.hasAttribute)!=null&&h.call(s,"data-scalebun")?null:(g=e.composedPath)==null?void 0:g.call(e)[0],o=i!=null&&i.tagName?i:s,a=this.reg.getId(o),c=this.offsetFor(o),l=this.rootScroll(o),u=t.clientX+c.x,d=t.clientY+c.y;this.clickHistory=this.clickHistory.filter(x=>r-x.t<this.o.rageWindowMs);let p=this.clickHistory.filter(x=>Math.hypot(x.x-u,x.y-d)<=this.o.rageRadius);this.clickHistory.push({x:u,y:d,t:r});let f=p.length+1>=this.o.rageMin,m=xS(o,this.o.maskText);this.queue({k:"click",x:u,y:d,sx:l.sx,sy:l.sy,id:a,t:r,...f?{rage:!0}:{},...m?{el:m}:{}},"immediate"),this.armDeadCheck(o,{x:u,y:d,sx:l.sx,sy:l.sy,id:a,at:r,el:m})};this.onScroll=e=>{var o,a,c,l;let t=Date.now();if(t-this.lastScrollT<this.o.scrollThrottleMs)return;this.lastScrollT=t;let r=e.target,s=(o=r.documentElement)!=null?o:r,i=(a=this.reg.getId(s))!=null?a:0;this.queue({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t},"fast")};this.onInput=e=>{var i;let t=e.target,r=this.reg.getId(t);if(r==null)return;let s=(i=t.value)!=null?i:"";Rt(t)?s=Tt(s):this.o.maskInputs&&(s=Ge(s)),this.queue({k:"input",id:r,value:s,t:Date.now()},"fast")};this.onResize=()=>{this.queue({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()},"fast")};this.o={...bS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Mm(),this.add(document,"mousemove",this.onMove,!0),this.add(document,"click",this.onClick,!0),this.add(document,"scroll",this.onScroll,!0),this.add(document,"input",this.onInput,!0),typeof window!="undefined"&&this.add(window,"resize",this.onResize,!0),this.timer=setInterval(this.onTick,this.o.flushMs))}queue(e,t){var r,s;if(this.pending.length||(this.pendingSince=Date.now()),this.pending.push(e),t==="immediate"){try{(s=(r=this.o).beforeImmediateFlush)==null||s.call(r)}catch{}this.flush()}}observeFrame(e,t){this.frameOffsets.has(e)||(this.frameOffsets.set(e,t),this.add(e,"mousemove",this.onMove,!0),this.add(e,"click",this.onClick,!0),this.add(e,"scroll",this.onScroll,!0),this.add(e,"input",this.onInput,!0))}unobserveFrame(e){this.frameOffsets.delete(e)&&(this.listeners=this.listeners.filter(t=>{if(t.target===e){try{t.target.removeEventListener(t.type,t.fn,t.capture)}catch{}return!1}return!0}))}rootScroll(e){var t,r,s,i,o,a,c,l,u,d;try{let p=e&&e.ownerDocument||(typeof document!="undefined"?document:null);if(!p)return{sx:0,sy:0};let f=p.defaultView,m=(o=(i=(r=f==null?void 0:f.scrollX)!=null?r:(t=p.documentElement)==null?void 0:t.scrollLeft)!=null?i:(s=p.body)==null?void 0:s.scrollLeft)!=null?o:0,h=(d=(u=(c=f==null?void 0:f.scrollY)!=null?c:(a=p.documentElement)==null?void 0:a.scrollTop)!=null?u:(l=p.body)==null?void 0:l.scrollTop)!=null?d:0;return{sx:Math.round(m),sy:Math.round(h)}}catch{return{sx:0,sy:0}}}offsetFor(e){let t=e&&e.ownerDocument||null,r=t?this.frameOffsets.get(t):void 0;if(!r)return{x:0,y:0};try{return r()}catch{return{x:0,y:0}}}flush(){if(!this.pending.length)return;let e=this.pending;this.pending=[],this.onEvents(e)}disconnect(){for(let e of this.listeners)e.target.removeEventListener(e.type,e.fn,e.capture);this.listeners=[],this.timer&&clearInterval(this.timer),this.timer=null;for(let e of this.deadTimers)clearTimeout(e);this.deadTimers.clear();for(let e of this.deadObservers)try{e.disconnect()}catch{}this.deadObservers.clear(),this.frameOffsets.clear(),this.pending=[]}add(e,t,r,s){e.addEventListener(t,r,s),this.listeners.push({target:e,type:t,fn:r,capture:s})}armDeadCheck(e,t){let{x:r,y:s,id:i,at:o,el:a}=t,c=e&&e.nodeType===1&&e.isConnected?e:null,l=!1,u=null,d=()=>{if(u){try{u.disconnect()}catch{}this.deadObservers.delete(u),u=null}};if(typeof MutationObserver!="undefined"&&typeof document!="undefined")try{u=new MutationObserver(f=>{for(let m of f){let h=c?SS(m.target,c):!1,g=m.type==="childList"&&(Pm(m.addedNodes)||Pm(m.removedNodes));if(h||g){l=!0;break}}l&&d()}),u.observe(document,{subtree:!0,childList:!0}),c&&u.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.deadObservers.add(u)}catch{l=!0}else l=!0;let p=setTimeout(()=>{this.deadTimers.delete(p),d(),!l&&Mm()===this.startHref&&this.queue({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}},"immediate")},this.o.deadMs);this.deadTimers.add(p)}};yS='a[href],button,input,select,textarea,label,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=checkbox],[role=radio],[role=switch],[contenteditable=""],[contenteditable=true],[tabindex]:not([tabindex="-1"])'});var Bm={};L(Bm,{bridgeCrossOriginFrame:()=>aa,installChildSatellite:()=>kS,nodeIdBaseFor:()=>ca});function kS(n,e={}){if(typeof window=="undefined"||window.parent===window)return()=>{};let t=Ze(e),r,s=!1,i=o=>{let a=o.data;if(!a||a.scalebun!==Lm||s||!Nm(o.origin,n))return;s=!0;let c=new sn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Xe(document,c,t);u&&l({scalebun:_m,doc:u}),r=new ft(c,d=>l({scalebun:Om,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function aa(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!Nm(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===_m&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Om&&Array.isArray(c.mutations)&&t.emit(c.mutations))};window.addEventListener("message",s);let i="*";try{i=new URL(n.src,location.href).origin}catch{}let o=()=>{try{r.postMessage({scalebun:Lm,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Lm,_m,Om,Nm,ca,la=k(()=>{"use strict";on();et();un();Lm="scalebun:frame-init",_m="scalebun:frame-key",Om="scalebun:frame-mut",Nm=(n,e)=>e.includes("*")||e.includes(n);ca=n=>n*1e6});var ua={};L(ua,{IframeManager:()=>da});var da,pa=k(()=>{"use strict";et();un();la();da=class{constructor(e,t,r={},s={}){this.reg=e;this.onMutations=t;this.attached=new Map;this.loadListeners=[];this.bridges=new Map;this.started=!1;var i,o;this.o=Ze(r),this.onFrame=s.onFrame,this.onUnframe=s.onUnframe,this.maxDepth=(i=s.maxDepth)!=null?i:3,this.frameOrigins=(o=s.frameOrigins)!=null?o:[]}start(){this.started||typeof document=="undefined"||(this.started=!0,this.installLoad(document,0),this.scan(document,0))}scan(e,t){if(!(t>this.maxDepth)){this.sweep();try{e.querySelectorAll("iframe").forEach(r=>this.attach(r,t))}catch{}}}sweep(){var e;if(this.attached.size)for(let[t,{doc:r,rec:s}]of this.attached)t.isConnected||(s.disconnect(),(e=this.onUnframe)==null||e.call(this,r),this.attached.delete(t));if(this.bridges.size)for(let[t,r]of this.bridges)t.isConnected||(r(),this.bridges.delete(t))}installLoad(e,t){let r=s=>{let i=s.target;i&&i.tagName==="IFRAME"&&this.attach(i,t)};try{e.addEventListener("load",r,!0),this.loadListeners.push({doc:e,fn:r})}catch{}}attach(e,t){var c,l;if(t>this.maxDepth)return;let r=null;try{r=e.contentDocument}catch{this.bridgeCrossOrigin(e);return}if(!r||!r.documentElement){this.bridgeCrossOrigin(e);return}let s=this.attached.get(e);if(s){if(s.doc===r)return;s.rec.disconnect(),(c=this.onUnframe)==null||c.call(this,s.doc),this.attached.delete(e)}let i=this.reg.getId(e);if(i==null)return;let o=Xe(r,this.reg,this.o);o&&this.onMutations([{op:"iframe",id:i,doc:o}]);let a=new ft(this.reg,this.onMutations,this.o);a.observe(r.documentElement),this.attached.set(e,{doc:r,rec:a}),(l=this.onFrame)==null||l.call(this,r,()=>{try{let u=e.getBoundingClientRect();return{x:u.left,y:u.top}}catch{return{x:0,y:0}}}),t<this.maxDepth&&(this.installLoad(r,t+1),this.scan(r,t+1))}bridgeCrossOrigin(e){if(!this.frameOrigins.length||this.bridges.has(e))return;let t=this.reg.getId(e);if(t==null)return;let r=aa(e,t,{nodeIdBase:ca(t),allowedChildOrigins:this.frameOrigins,emit:this.onMutations});this.bridges.set(e,r)}subDocuments(){return this.sweep(),[...this.attached.values()].map(e=>e.doc)}disconnect(){for(let{rec:e}of this.attached.values())e.disconnect();this.attached.clear();for(let e of this.bridges.values())e();this.bridges.clear();for(let{doc:e,fn:t}of this.loadListeners)try{e.removeEventListener("load",t,!0)}catch{}this.loadListeners=[],this.started=!1}}});var Fm={};L(Fm,{CanvasRecorder:()=>fa});var ES,fa,Dm=k(()=>{"use strict";ES="data-scalebun-block",fa=class{constructor(e,t,r=()=>{},s={}){this.reg=e;this.onMutations=t;this.log=r;this.timer=null;this.last=new Map;this.tainted=new Set;this.scratch=null;var i,o,a;this.intervalMs=Math.max(50,Math.round(1e3/((i=s.fps)!=null?i:3))),this.maxDim=(o=s.maxDim)!=null?o:1024,this.quality=(a=s.quality)!=null?a:.6,this.getDocs=s.getDocs}start(){typeof document!="undefined"&&(this.capture(),this.timer=setInterval(()=>this.capture(),this.intervalMs))}disconnect(){this.timer&&clearInterval(this.timer),this.timer=null,this.last.clear(),this.tainted.clear(),this.scratch=null}capture(){let e=this.getDocs?this.getDocs():typeof document!="undefined"?[document]:[],t=[],r=new Set;for(let s of e){let i;try{i=s.querySelectorAll("canvas")}catch{continue}i.forEach(o=>{let a=this.reg.getId(o);if(a==null||(r.add(a),o.hasAttribute(ES)))return;let c=o.width,l=o.height;if(!c||!l)return;let u;try{u=this.encode(o,c,l)}catch{this.tainted.has(a)||(this.tainted.add(a),this.log("[scalebun] canvas not capturable (tainted / cross-origin)"));return}this.last.get(a)!==u&&(this.last.set(a,u),t.push({op:"canvas",id:a,data:u,w:c,h:l}))})}if(this.last.size>r.size)for(let s of this.last.keys())r.has(s)||this.last.delete(s);if(this.tainted.size)for(let s of this.tainted)r.has(s)||this.tainted.delete(s);t.length&&this.onMutations(t)}encode(e,t,r){var i;let s=Math.min(1,this.maxDim/Math.max(t,r));if(s<1){let o=(i=this.scratch)!=null?i:this.scratch=document.createElement("canvas");o.width=Math.max(1,Math.round(t*s)),o.height=Math.max(1,Math.round(r*s));let a=o.getContext("2d");if(!a)throw new Error("no 2d context");return a.clearRect(0,0,o.width,o.height),a.drawImage(e,0,0,o.width,o.height),o.toDataURL("image/webp",this.quality)}return e.toDataURL("image/webp",this.quality)}}});var qm={};L(qm,{installCadence:()=>IS});function IS(n){let e=[];if(n.keyframeIntervalMs>0&&n.keyframeIntervalMs!==1/0){let t=setInterval(()=>n.onCheckpoint("time"),n.keyframeIntervalMs);e.push(()=>clearInterval(t))}if(typeof document!="undefined"){let t=()=>{document.visibilityState==="visible"&&n.onCheckpoint("visible")};document.addEventListener("visibilitychange",t),e.push(()=>document.removeEventListener("visibilitychange",t))}if(typeof window!="undefined"&&typeof history!="undefined"&&typeof location!="undefined"){let t=location.href,r=()=>{location.href!==t&&(t=location.href,n.onCheckpoint("url"))};window.addEventListener("popstate",r),window.addEventListener("hashchange",r);let s=history.pushState,i=history.replaceState;history.pushState=function(...o){let a=s.apply(this,o);return r(),a},history.replaceState=function(...o){let a=i.apply(this,o);return r(),a},e.push(()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r),history.pushState!==s&&(history.pushState=s),history.replaceState!==i&&(history.replaceState=i)})}return()=>{for(let t of e)try{t()}catch{}}}var Hm=k(()=>{"use strict"});var Vm={};L(Vm,{RecorderController:()=>ks,createRecorder:()=>OS});function _S(n){if(n.frameType==="keyframe")return"keyframe";let e=n.mutations;if(e!=null&&e.length)return e.every(r=>r.op==="canvas")?"canvas":"mutation";let t=n.events;return t!=null&&t.length?t.some(r=>r.k==="click"||r.k==="deadclick"||r.k==="input")?"interaction":t.some(r=>r.k==="scroll"||r.k==="viewport")?"scroll":"move":"other"}async function OS(n,e){let t=new ks(n,e);return await t.init(),t}function zm(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function Um(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var $m,Ss,AS,RS,TS,MS,PS,LS,ks,Wm=k(()=>{"use strict";$();Wt();Mn();fs();hm();bm();vm();Xo();Em();En();$m=120,Ss=2e5,AS=8,RS=2e6,TS=3e4,MS=5*6e4,PS=100,LS=300;ks=class{constructor(e,t){this.ctx=e;this.decision=t;this.active=!1;this.seq=Ys(0);this.keyframeId="";this.checkpointing=!1;this.dirtySinceKeyframe=!1;this.lastKeyframeAt=0;this.streamChainBytes=0;this.streamChainFrames=0;this.pendingEncodes=new Set;this.shed=0;this.producerCounts={};this.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&Go()&&(this.streaming=!1,e.log("[replay] save-data/slow \u2192 buffered")),this.persistBuffer=!!((r=e.replaySampling)!=null&&r.persistBuffer)&&!this.streaming,this.maskText=(s=e.maskReplayText)!=null?s:!1}nextSeq(){let e=Ys(1);return this.seq=e+1,e}get isActive(){return this.active}stats(){var t,r,s,i,o,a;let e=this.segBuf;return{recording:this.active&&!this.paused,paused:this.paused,streaming:this.streaming,sampleReason:this.decision.reason,sampleBucket:this.decision.bucket,qualityLevel:(r=(t=this.adaptive)==null?void 0:t.level)!=null?r:0,segments:(s=e==null?void 0:e.segmentCount)!=null?s:0,frames:(i=e==null?void 0:e.frameCount)!=null?i:0,captured:this.keyframeId!=null,bufferBytes:(o=e==null?void 0:e.totalBytes)!=null?o:0,droppedSegments:(a=e==null?void 0:e.dropped)!=null?a:0,shedFrames:this.shed,producers:Object.fromEntries(Object.entries(this.producerCounts).map(([c,l])=>[c,{...l}]))}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(ta(),ea)),Promise.resolve().then(()=>(fs(),jo))]);this.segBuf=new t(AS,RS),this.persistBuffer&&(this.replayStore=new Be("pending-replay"),await this.recoverPriorPreRoll(),this.installPersistGuards()),this.encoder=new e,this.disposeEncoder=()=>{var r;return(r=this.encoder)==null?void 0:r.dispose()},await this.arm(),this.unsubSignal=this.ctx.onSignal(()=>this.flush()),this.active=!0}async arm(){var v,y,b,E;if(typeof document=="undefined")return;let e=this.ctx,[{NodeRegistry:t},{takeSnapshot:r},{MutationRecorder:s},{InteractionRecorder:i},{CssomRecorder:o},{IframeManager:a}]=await Promise.all([Promise.resolve().then(()=>(on(),qr)),Promise.resolve().then(()=>(et(),Dr)),Promise.resolve().then(()=>(un(),ra)),Promise.resolve().then(()=>(oa(),ia)),Promise.resolve().then(()=>(Pr(),Xi)),Promise.resolve().then(()=>(pa(),ua))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(v=e.maskInputs)!=null?v:!0,maskSelectors:e.maskSelectors};this.redactPII=((y=e.replaySampling)==null?void 0:y.privacyLevel)==="strict"&&!l.maskAllText,this.reg=c,this.snapOpts=l,this.takeSnapshotFn=r;let u=r(document,c,l);this.keyframeId=`f_${q()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:zm(),href:Um(),tabId:Yo(),viewId:Qo(),route:Jo(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new ms(PS,w=>this.push(this.delta({mutations:w})));this.deltaBatcher=p;let f=new i(c,w=>{this.push(this.delta({events:w}))},{maskText:!!l.maskAllText,moveFlushMs:LS,beforeImmediateFlush:()=>p.flush()}),m=new s(c,w=>{f.notifyDomActivity(),p.append(w)},l),h=new o(c,w=>{f.notifyDomActivity(),p.append(w)}),g=new a(c,w=>{f.notifyDomActivity(),p.append(w)},l,{onFrame:(w,I)=>f.observeFrame(w,I),onUnframe:w=>f.unobserveFrame(w),frameOrigins:(b=e.replayFrameOrigins)!=null?b:[]});if(((E=e.replayFrameOrigins)!=null?E:[]).length&&Promise.resolve().then(()=>(la(),Bm)).then(({installChildSatellite:w})=>{var I;this.childSatelliteStop=w((I=e.replayFrameOrigins)!=null?I:[],l)}),this.mutationRec=m,this.cssomRec=h,m.observe(document.documentElement),f.observe(),h.install(),g.start(),this.disconnectRecorder=()=>m.disconnect(),this.disconnectInteractions=()=>f.disconnect(),this.disconnectCssom=()=>h.disconnect(),this.disconnectIframes=()=>g.disconnect(),e.replayCanvas){let{CanvasRecorder:w}=await Promise.resolve().then(()=>(Dm(),Fm)),I=new w(c,S=>{f.notifyDomActivity(),this.push(this.delta({mutations:S}))},(...S)=>e.log(...S));I.start(),this.disconnectCanvas=()=>I.disconnect()}this.adaptive=new hs(e.egressPending);let{installCadence:x}=await Promise.resolve().then(()=>(Hm(),qm));this.disconnectCadence=x({keyframeIntervalMs:TS,onCheckpoint:w=>this.checkpoint(w)})}disarm(){var e,t,r,s,i,o,a,c,l,u,d;try{(e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.dispose()}catch{}this.deltaBatcher=void 0,(s=this.disconnectRecorder)==null||s.call(this),(i=this.disconnectInteractions)==null||i.call(this),(o=this.disconnectCssom)==null||o.call(this),(a=this.disconnectCanvas)==null||a.call(this),(c=this.disconnectIframes)==null||c.call(this),(l=this.childSatelliteStop)==null||l.call(this),(u=this.disconnectCadence)==null||u.call(this),(d=this.adaptive)==null||d.dispose(),this.disconnectRecorder=void 0,this.disconnectInteractions=void 0,this.disconnectCssom=void 0,this.disconnectCanvas=void 0,this.disconnectIframes=void 0,this.childSatelliteStop=void 0,this.disconnectCadence=void 0,this.adaptive=void 0,this.reg=void 0,this.mutationRec=void 0,this.cssomRec=void 0,this.takeSnapshotFn=void 0,this.snapOpts=void 0}pause(){!this.active||this.paused||(this.disarm(),this.paused=!0,this.ctx.log("[replay] paused"))}resume(){!this.active||!this.paused||(this.paused=!1,this.arm().then(()=>this.ctx.log("[replay] resumed")))}setPrivacy(e){typeof(e==null?void 0:e.maskAllText)!="boolean"||e.maskAllText===this.maskText||(this.maskText=e.maskAllText,this.active&&!this.paused&&(this.disarm(),this.arm()),this.ctx.log("[replay] privacy set: maskAllText="+this.maskText))}delta(e){return{kind:"frame",renderer:"dom",frameType:"delta",frameId:`f_${q()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:Yo(),viewId:Qo(),route:Jo(),masked:!0,timestamp:P()}}push(e){var i,o;if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&ym(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let a=gm(e,this.adaptive.level);if(!a){this.shed++;return}e=a}let t=_S(e),r=(o=(i=this.producerCounts)[t])!=null?o:i[t]={frames:0,bytes:0};if(r.frames++,r.bytes+=Ht(e),this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=Ht(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=$m||this.streamChainBytes>=Ss)&&this.checkpoint(this.streamChainBytes>=Ss?"segment-bytes":"segment-frames"));return}let s=this.segBuf;s&&(e.frameType==="keyframe"?s.openSegment(e):s.append(e),!this.checkpointing&&e.frameType==="delta"&&(s.currentFrameCount>=$m||s.currentBytes>=Ss)&&this.checkpoint(s.currentBytes>=Ss?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r,s;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")){this.checkpointing=!0;try{if((t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush(),(s=this.deltaBatcher)==null||s.flush(),(e==="time"||e==="visible")&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<MS)return;let i=this.takeSnapshotFn(document,this.reg,this.snapOpts),o=`f_${q()}`;this.keyframeId=o,this.streamChainBytes=0,this.streamChainFrames=0;let a={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:o,seq:this.nextSeq(),snapshot:i,viewport:zm(),href:Um(),masked:!0,trigger:e,timestamp:P()};this.push(a),this.compressInPlace(a,i),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P()}finally{this.checkpointing=!1}}}async recoverPriorPreRoll(){var e;if(this.replayStore)try{let t=await this.replayStore.load();if(Array.isArray(t)&&t.length){let r=0;for(let s of t)this.ctx.emit(s),r=Math.max(r,(e=s.seq)!=null?e:0);this.seq=Mc(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(kt(this.segBuf.drainFrames(),()=>!0,e=>e.frameType==="keyframe"))}installPersistGuards(){typeof window!="undefined"&&(this.onPageHide=()=>{var e;return void((e=this.replayStore)==null?void 0:e.clear())},window.addEventListener("pagehide",this.onPageHide),this.onVisHidden=()=>{typeof document!="undefined"&&document.visibilityState==="hidden"&&this.persistPreRoll()},typeof document!="undefined"&&document.addEventListener("visibilitychange",this.onVisHidden))}compressInPlace(e,t){let r=this.encoder;if(!r)return;let s=r.encodeSnapshot(t).then(i=>{e.snapshot=i}).catch(()=>{}).finally(()=>{this.pendingEncodes.delete(s)});this.pendingEncodes.add(s)}flush(){var e,t,r,s,i;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.flush(),this.segBuf)for(let o of this.segBuf.drainFrames())this.ctx.emit(o);(s=this.segBuf)==null||s.clear(),this.streaming=!0,(i=this.replayStore)==null||i.clear()}teardown(){var e,t,r,s;this.disarm(),(e=this.disposeEncoder)==null||e.call(this),this.onPageHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onPageHide),this.onPageHide=void 0,this.onVisHidden&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisHidden),this.onVisHidden=void 0,(t=this.replayStore)==null||t.clear(),this.replayStore=void 0,(r=this.unsubSignal)==null||r.call(this),(s=this.segBuf)==null||s.clear(),this.segBuf=void 0,this.encoder=void 0,this.pendingEncodes.clear(),this.streaming=!1,this.checkpointing=!1,this.paused=!1,this.active=!1}}});var Km={};L(Km,{installWebGLPreserve:()=>BS});function jm(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[ma])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&NS.has(s)){let o={...i!=null?i:{},preserveDrawingBuffer:!0};return t.call(this,s,o)}return t.call(this,s,i)};return n.getContext=r,e[ma]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[ma]}}function BS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=jm(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=jm(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var ma,NS,Gm=k(()=>{"use strict";ma="__scalebunWebglPatched",NS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var Ym={};L(Ym,{ReplayFeature:()=>ha});var FS,Es,DS,Xm,ha,Jm=k(()=>{"use strict";mm();ti();FS=400,Es="sdk_replay_capture_failed",DS=5e3,Xm=()=>Promise.resolve().then(()=>(Wm(),Vm)),ha=class{constructor(){this.name="replay"}get isActive(){var e,t;return(t=(e=this.controller)==null?void 0:e.isActive)!=null?t:!1}async setup(e){var r;if(typeof document=="undefined"||typeof MutationObserver=="undefined"){e.trackEvent(Es,{stage:"init",reason:"ENV_UNSUPPORTED"});return}let t=fm(e.replaySampling,(r=e.sessionId)!=null?r:"");if(e.log("[replay] sampling:",t.reason,"(bucket",t.bucket+")"),!!t.record){if(e.respectDnt){let{userOptedOutOfTracking:s}=await Promise.resolve().then(()=>(Xo(),Sm));if(s()){e.log("[replay] dnt: skip"),e.trackEvent(Es,{stage:"init",reason:"DNT_OPTED_OUT"});return}}if(e.replayCanvas){let{installWebGLPreserve:s}=await Promise.resolve().then(()=>(Gm(),Km));this.uninstallWebGL=s()}this.armed=this.arm(e,t)}}async arm(e,t){var r;try{await this.load(e,t)}catch(s){let i=String((r=s==null?void 0:s.message)!=null?r:s).slice(0,300);e.trackEvent(Es,{stage:"init",reason:ei(i)?"ENGINE_CHUNK_LOAD_FAILED":"RECORDER_INIT_FAILED",message:i})}}async load(e,t){var i;let r=o=>{o.catch(()=>{})};r(Promise.resolve().then(()=>(on(),qr))),r(Promise.resolve().then(()=>(et(),Dr))),r(Promise.resolve().then(()=>(un(),ra))),r(Promise.resolve().then(()=>(oa(),ia))),r(Promise.resolve().then(()=>(Pr(),Xi))),r(Promise.resolve().then(()=>(pa(),ua))),r(Promise.resolve().then(()=>(ta(),ea))),r(Promise.resolve().then(()=>(fs(),jo)));let s;try{({createRecorder:s}=await Xm())}catch(o){await new Promise(a=>setTimeout(a,FS)),{createRecorder:s}=await Xm(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((i=o==null?void 0:o.message)!=null?i:o).slice(0,300)})}this.controller=await s(e,t),this.watchdog=setTimeout(()=>{var a;let o=(a=this.controller)==null?void 0:a.stats();o!=null&&o.recording&&!o.captured&&e.trackEvent(Es,{stage:"first-frame",reason:"NO_FRAME_AFTER_ARM",streaming:o.streaming,bucket:o.sampleBucket})},DS)}flush(){var e;(e=this.controller)==null||e.flush()}stats(){var e,t;return(t=(e=this.controller)==null?void 0:e.stats())!=null?t:null}checkpoint(e="manual"){var t;(t=this.controller)==null||t.forceCheckpoint(e)}pause(){var e;(e=this.controller)==null||e.pause()}resume(){var e;(e=this.controller)==null||e.resume()}setPrivacy(e){var t;(t=this.controller)==null||t.setPrivacy(e)}teardown(){var e,t;clearTimeout(this.watchdog),this.watchdog=void 0,(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}}});var Qm,we,ga=k(()=>{"use strict";Qm={title:"Inbox",panelAria:"Notifications",open:"Open notifications",openUnread:n=>`Open notifications, ${n} unread`,close:"Close notifications",unread:n=>`${n} unread`,noUnread:"No unread messages",emptyTitle:"You\u2019re all caught up",emptyBody:"Your notifications will appear here.",emptyAnnounce:"No notifications",allTab:"All",viewAll:"View all",pin:"Pin",unpin:"Unpin",archive:"Archive",delete:"Delete"},we={received:"$message_received",seen:"$message_seen",read:"$message_read",cta:"$message_cta_clicked",archived:"$message_archived",unarchived:"$message_unarchived",pinned:"$message_pinned",unpinned:"$message_unpinned",deleted:"$message_deleted",expired:"$message_expired",unreadChanged:"$inbox_unread_changed"}});var ba={};L(ba,{mountInbox:()=>WS});function ee(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function US(n){let e=Math.max(0,Math.floor((Date.now()-n)/1e3));if(e<60)return"now";let t=Math.floor(e/60);if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let s=Math.floor(r/24);if(s<7)return`${s}d`;let i=Math.floor(s/7);return i<5?`${i}w`:`${Math.floor(s/30)}mo`}function VS(n,e,t,r,s,i){let o=e.includes("right")?"right":"left",a=t?o==="right"?"left":"right":o,c=e.includes("bottom")?"bottom":"top",l=(M,R)=>{var A;return`var(--scalebun-inbox-${M},${(A=i==null?void 0:i[M])!=null?A:R})`},u=l("bg",n?"#1b1922":"#ffffff"),d=l("fg",n?"#edeaf2":"#221e30"),p=l("sub",n?"#9a95a6":"#6b6580"),f=l("line",n?"rgba(255,255,255,.10)":"#eae7f2"),m=l("surf",n?"#262131":"#f7f6fb"),h=l("accent","#7c6cf0"),g=l("unread",n?"rgba(124,108,240,.10)":"rgba(124,108,240,.06)"),x=l("badge","#ff5b6b"),v=l("font","system-ui,-apple-system,Segoe UI,Roboto,sans-serif"),y=l("shadow","0 0 40px rgba(0,0,0,.22)"),b=l("width","380px"),E=l("gap","11px"),w=l("z","2147483600"),I=M=>l("radius",M),S=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
588
588
  :host{all:initial;direction:${t?"rtl":"ltr"};${C}}
589
589
  *{box-sizing:border-box;font-family:${v}}
590
590
  button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h};outline-offset:2px}
@@ -667,7 +667,7 @@ ${r!=="dropdown"?"":`
667
667
  cursor:pointer;padding:8px;border-radius:${S("8px")}}
668
668
  .foot button:hover{background:${m}}
669
669
  `}
670
- @media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function US(n,e,t){var G,ie,Y,X,ee;let r=(G=e.position)!=null?G:"bottom-right",s=typeof document!="undefined"&&(document.documentElement.getAttribute("dir")==="rtl"||typeof getComputedStyle!="undefined"&&getComputedStyle(document.documentElement).direction==="rtl"),i=(ie=e.rtl)!=null?ie:s,o=e.layout==="dropdown"&&Jm(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Ym,...(Y=t==null?void 0:t.labels)!=null?Y:{},...(X=e.labels)!=null?X:{}},l=(ee=e.formatTime)!=null?ee:$S,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox",""),d.setAttribute("data-scalebun","");let p=d.attachShadow({mode:"open"});Ne(p,zS(u,r,i,o,a,t==null?void 0:t.tokens)),document.body.appendChild(d);let f=Z("div","scrim"),m=Z("div","panel");m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",c.panelAria),m.setAttribute("aria-hidden","true"),i&&m.setAttribute("dir","rtl");let h=Z("div","hd"),g=Z("div"),x=Z("div","ti",c.title),v=Z("div","mt");g.append(x,v);let y=document.createElement("button");y.className="x",y.type="button",y.setAttribute("aria-label",c.close),y.textContent="\xD7",h.append(g,y);let b=Z("div","tabs");b.setAttribute("role","tablist"),b.style.display="none";let E=Z("div","body"),w=Z("div","live");if(w.setAttribute("role","status"),w.setAttribute("aria-live","polite"),m.append(h,b,E,w),e.onViewAll){let T=Z("div","foot"),_=document.createElement("button");_.type="button",_.textContent=c.viewAll,_.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(_),m.appendChild(T)}p.append(f,m);let I,S,C=Jm(e.trigger);C||(I=document.createElement("button"),I.className="bell",I.type="button",I.setAttribute("aria-label",c.open),I.setAttribute("aria-expanded","false"),I.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?I.textContent=e.icon:e.icon?I.appendChild(e.icon):I.innerHTML=HS,S=document.createElement("span"),S.className="badge",S.setAttribute("aria-hidden","true"),I.appendChild(S),p.appendChild(I));let M=C!=null?C:I,R=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),_=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-_:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-_-F))}px`;let re=window.innerHeight-T.bottom;m.style.top=re>=N+F||re>=T.top?`${T.bottom+6}px`:`${Math.max(F,T.top-N-6)}px`},D=T=>{var _,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),I==null||I.setAttribute("aria-expanded",String(T)),T?(A=(N=(_=p.activeElement)!=null?_:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();I==null||I.addEventListener("click",fe),C==null||C.addEventListener("click",fe),y.addEventListener("click",J),f.addEventListener("click",J);let ce=T=>{if(T.key==="Escape"){T.stopPropagation(),J();return}if(T.key==="Tab"){let _=xe(),N=_[0],F=_[_.length-1];if(!N||!F)return;let W=p.activeElement;T.shiftKey&&W===N?(T.preventDefault(),F.focus()):!T.shiftKey&&W===F&&(T.preventDefault(),N.focus())}};m.addEventListener("keydown",ce);function xe(){return[...m.querySelectorAll('button, [tabindex="0"]')]}let Se=n.subscribe(T=>{let _=T.unreadCount;S&&(S.textContent=_>99?"99+":String(_),S.classList.toggle("on",_>0)),v.textContent=_>0?c.unread(_):c.noUnread,I&&I.setAttribute("aria-label",_>0?c.openUnread(_):c.open),R&&Ve()}),le=null;function q(){let T=Z("div","empty");return T.appendChild(Z("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,_,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",_),F.title=_,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ce,Ae;let _=Z("div","row"+(T.state==="unread"?" unread":""));_.setAttribute("role","listitem"),_.tabIndex=0,_.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),_.dataset.id=T.id,_.appendChild(Z("span","dot"));let N=Z("div","ic");if(T.iconUrl){let Re=document.createElement("img");Re.src=T.iconUrl,Re.alt="",N.appendChild(Re)}else N.textContent=((Ce=(he=T.category)==null?void 0:he[0])!=null?Ce:"\u2022").toUpperCase();_.appendChild(N);let F=Z("div","rc"),W=Z("div","rtop");if(W.appendChild(Z("div","rt",T.title)),W.appendChild(Z("span","rtime",l(T.createdAt))),F.appendChild(W),T.body&&F.appendChild(Z("div","rb",T.body)),(Ae=T.cta)!=null&&Ae.length){let Re=Z("div","rcta");T.cta.slice(0,2).forEach((Je,st)=>{let ke=document.createElement("button");st>0&&(ke.className="sec"),ke.textContent=Je.label,ke.addEventListener("click",gn=>{gn.stopPropagation(),n.act(T.id,Je.key)}),Re.appendChild(ke)}),F.appendChild(Re)}_.appendChild(F);let re=Z("div","ract"),ge=V(FS,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(DS,c.archive,()=>void n.archive(T.id)),V(qS,c.delete,()=>void n.remove(T.id))),_.appendChild(re),_.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),_}function de(T){var re,ge,he;let _=T.target.closest(".row");if(!_)return;let N=[...E.querySelectorAll(".row")],F=N.indexOf(_),W=_.dataset.id;T.key==="ArrowDown"?(T.preventDefault(),(re=N[Math.min(N.length-1,F+1)])==null||re.focus()):T.key==="ArrowUp"?(T.preventDefault(),(ge=N[Math.max(0,F-1)])==null||ge.focus()):T.key==="Enter"||T.key===" "?(T.preventDefault(),n.markRead(W)):T.key==="Delete"||T.key==="Backspace"?(T.preventDefault(),n.archive(W),(he=N[Math.min(N.length-1,F+1)])==null||he.focus()):T.key.toLowerCase()==="p"&&(T.preventDefault(),n.pin(W))}E.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let _=(N,F)=>{let W=document.createElement("button");return W.className="tab"+(le===F?" on":""),W.type="button",W.textContent=N,W.setAttribute("role","tab"),W.setAttribute("aria-selected",String(le===F)),W.addEventListener("click",()=>{le=F,Ve()}),W};b.appendChild(_(c.allTab,null));for(let N of T)b.appendChild(_(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ce,Ae,Re,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let _=(Ae=(Ce=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ce.call(he,".row"))==null?void 0:Ae.dataset.id,N=[...new Set(T.messages.map(ke=>ke.category))].sort();me(N);let F=le?T.messages.filter(ke=>ke.category===le):T.messages,W=o==="dropdown"?Math.max(1,(Re=e.maxItems)!=null?Re:5):1/0,re=F.length>W?F.slice(0,W):F;if(E.textContent="",!re.length){E.appendChild(q()),w.textContent=c.emptyAnnounce,O&&(O=!1,y.focus());return}let ge=Z("div","list");ge.setAttribute("role","list");for(let ke of re)ge.appendChild(K(ke));E.appendChild(ge),w.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=E.querySelector(".row"))!=null?Je:y).focus()):_&&((st=E.querySelector(`.row[data-id="${_}"]`))==null||st.focus())}let Ue=!1;function Ve(){Ue||(Ue=!0,queueMicrotask(()=>{Ue=!1,se()}))}return{open:te,close:J,destroy(){Se(),m.removeEventListener("keydown",ce),E.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Jm(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var FS,DS,qS,HS,ya=k(()=>{"use strict";$();ga();FS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z"/></svg>',DS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',qS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',HS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>'});var Qm={};L(Qm,{InboxStore:()=>pn,NOOP_STORE:()=>va});function WS(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(VS+n,1);t.onupgradeneeded=()=>{let r=t.result;r.objectStoreNames.contains(ze)||r.createObjectStore(ze,{keyPath:"id"}),r.objectStoreNames.contains(nt)||r.createObjectStore(nt)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}var VS,ze,nt,pn,va,wa=k(()=>{"use strict";VS="scalebun_inbox_",ze="messages",nt="meta";pn=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=WS(this.scope)),this.dbp}async hydrate(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(ze,"readonly").objectStore(ze).getAll();r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}put(e){return this.putMany([e])}async putMany(e){if(!e.length)return;let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite"),i=s.objectStore(ze);for(let o of e)i.put(o);s.oncomplete=()=>r(),s.onerror=()=>r(),s.onabort=()=>r()}catch{r()}})}async remove(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite");s.objectStore(ze).delete(e),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async getMeta(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(nt,"readonly").objectStore(nt).get(e);s.onsuccess=()=>r(s.result),s.onerror=()=>r(void 0)}catch{r(void 0)}})}async setMeta(e,t){let r=await this.db();if(r)return new Promise(s=>{try{let i=r.transaction(nt,"readwrite");i.objectStore(nt).put(t,e),i.oncomplete=()=>s(),i.onerror=()=>s()}catch{s()}})}async clear(){let e=await this.db();if(e)return new Promise(t=>{try{let r=e.transaction([ze,nt],"readwrite");r.objectStore(ze).clear(),r.objectStore(nt).clear(),r.oncomplete=()=>t(),r.onerror=()=>t()}catch{t()}})}},va={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var Zm={};L(Zm,{InboxSync:()=>xa,InboxTransport:()=>Sa,mergeMessage:()=>ka,stateRank:()=>GS});function ka(n,e){var a,c,l,u,d;if(!n)return e;let t=n;if(e.revision>n.revision){let p={...n},f=e;for(let m of KS)p[m]=f[m];t=p}let r=(a=n.stateAt)!=null?a:0,s=(c=e.stateAt)!=null?c:0;n.state==="deleted"||e.state==="deleted"?t={...t,state:"deleted",stateAt:Math.max(r,s),deletedAt:(l=n.deletedAt)!=null?l:e.deletedAt}:s>=r?t={...t,state:e.state,stateAt:s,readAt:e.readAt,archivedAt:e.archivedAt}:t={...t,state:n.state,stateAt:r};let i=(u=n.pinnedAt)!=null?u:0,o=(d=e.pinnedAt)!=null?d:0;return t={...t,pinned:o>=i?e.pinned:n.pinned,pinnedAt:Math.max(i,o)||void 0},t}function GS(n){return jS[n]}var jS,KS,xa,Sa,Ea=k(()=>{"use strict";Rn();jS={unread:0,read:1,archived:2,deleted:3},KS=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];xa=class{constructor(e){this.deps=e;this.cursor=null;this.cursorLoaded=!1;this.inflight=null}sync(){return this.inflight?this.inflight:(this.inflight=this.run().finally(()=>{this.inflight=null}),this.inflight)}async run(){var e,t,r,s,i;this.deps.onStatus("syncing");try{this.cursorLoaded||(this.cursor=(e=await this.deps.store.getMeta("cursor"))!=null?e:null,this.cursorLoaded=!0);let o=this.deps.runtime.collectDirtyOps(),a=new Map(o.map(u=>[u.id,{stateAt:u.stateAt,pinnedAt:u.pinnedAt}])),c={cursor:this.cursor,ops:o},l=await this.deps.transport.sync(c);if(!l){this.deps.onStatus(ot()?"error":"offline");return}l.theme&&((r=(t=this.deps).onTheme)==null||r.call(t,l.theme)),this.deps.runtime.applyServerDelta((s=l.messages)!=null?s:[],(i=l.tombstones)!=null?i:[],l.unreadCount),this.deps.runtime.ackDirty(a),l.cursor!==void 0&&(this.cursor=l.cursor,await this.deps.store.setMeta("cursor",l.cursor)),this.deps.onStatus("idle")}catch{this.deps.onStatus(ot()?"error":"offline")}}},Sa=class{constructor(e,t,r){this.apiBaseUrl=e;this.clientKey=t;this.deviceId=r}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async sync(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/inbox/sync`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},body:JSON.stringify({schemaVersion:1,deviceId:this.deviceId,...e}),keepalive:!0});return t.ok?await t.json():null}catch{return null}}}});var nh={};L(nh,{InboxRuntime:()=>Ia});function th(n){return`${n.createdAt}_${n.id}`}var eh,XS,Ia,rh=k(()=>{"use strict";ga();wa();Ea();eh={unread:0,read:1,archived:2,deleted:3},XS=20;Ia=class{constructor(e){this.deps=e;this.mem=new Map;this.unread=0;this.ctaSubs=new Set;this.syncStatus="idle";var t;this.store=(t=e.store)!=null?t:e.scope?new pn(e.scope):va}async hydrate(){let e=await this.store.hydrate(),t=this.unread;for(let r of e)this.mem.has(r.id)||(this.mem.set(r.id,r),r.state==="unread"&&t++);this.unread=t,this.emitState()}getState(){let e=0;for(let t of this.mem.values())t.state!=="deleted"&&e++;return{unreadCount:this.unread,total:e,syncStatus:this.syncStatus}}emitState(){this.deps.onState(this.getState())}setSyncStatus(e){e!==this.syncStatus&&(this.syncStatus=e,this.emitState())}stamp(e){let t=this.deps.replayCoord();return t?{...e,replayCoord:t}:e}async ingest(e){var r;let t=[];for(let s of e){let i=this.mem.get(s.id);if(i){if(s.revision<=i.revision)continue;let a={...s,state:i.state,pinned:i.pinned,seenAt:i.seenAt,readAt:i.readAt,archivedAt:i.archivedAt,deletedAt:i.deletedAt};this.mem.set(s.id,a),t.push(a);continue}let o={...s,state:(r=s.state)!=null?r:"unread",pinned:!!s.pinned};this.mem.set(o.id,o),t.push(o),o.state==="unread"&&this.unread++,this.deps.trackEvent(we.received,this.stamp({messageId:o.id,campaignId:o.campaignId,category:o.category,priority:o.priority}))}t.length&&(this.emitUnreadAnd(),await this.store.putMany(t))}emitUnreadAnd(e){e!=null&&e!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-e})),this.emitState()}transition(e,t,r){let s=this.mem.get(e);if(!s)return;if(!(r!=null&&r.allowRegress)&&eh[t]<=eh[s.state])return s;let i=this.unread,o=s.state==="unread";s.state=t;let a=this.deps.now();s.stateAt=a,s._dirty=!0,t==="read"?s.readAt=a:t==="archived"?s.archivedAt=a:t==="deleted"?s.deletedAt=a:t==="unread"&&(s.readAt=void 0);let c=s.state==="unread";return o&&!c?this.unread--:!o&&c&&this.unread++,this.emitUnreadAnd(i),s}async markRead(e){let t=this.transition(e,"read");t&&(this.deps.trackEvent(we.read,this.stamp({messageId:e,category:t.category,priority:t.priority})),await this.store.put(t))}async markUnread(e){let t=this.mem.get(e);t&&t.state==="read"&&(this.transition(e,"unread",{allowRegress:!0}),await this.store.put(t))}async markReadByCampaign(e){for(let t of this.mem.values())if(t.campaignId===e&&t.state==="unread"){await this.markRead(t.id);return}}async markAllRead(e){let t=this.unread,r=[];for(let s of this.mem.values())s.state==="unread"&&(!e||s.category===e)&&(s.state="read",s.readAt=this.deps.now(),this.unread--,r.push(s));this.emitUnreadAnd(t),await this.store.putMany(r)}async archive(e){let t=this.transition(e,"archived");t&&(this.deps.trackEvent(we.archived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async unarchive(e){let t=this.mem.get(e);t&&t.state==="archived"&&(this.transition(e,"read",{allowRegress:!0}),this.deps.trackEvent(we.unarchived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async pin(e,t=!0){let r=this.mem.get(e);!r||r.pinned===t||(r.pinned=t,r.pinnedAt=this.deps.now(),r._dirty=!0,this.deps.trackEvent(t?we.pinned:we.unpinned,this.stamp({messageId:e,category:r.category})),this.emitState(),await this.store.put(r))}async remove(e){let t=this.mem.get(e);if(!t||t.state==="deleted")return;let r=t.state==="unread";this.transition(e,"deleted",{allowRegress:!0}),this.deps.trackEvent(we.deleted,this.stamp({messageId:e,category:t.category,wasUnread:r})),await this.store.put(t)}onCtaAction(e){return this.ctaSubs.add(e),()=>this.ctaSubs.delete(e)}act(e,t){var i;let r=this.mem.get(e),s=(i=r==null?void 0:r.cta)==null?void 0:i.find(o=>o.key===t);if(!(!r||!s)){if(this.deps.trackEvent(we.cta,this.stamp({messageId:e,ctaKey:t,action:s.action,url:s.url})),s.action==="link"&&s.url&&/^https?:\/\//i.test(s.url))try{window.open(s.url,"_blank","noopener")}catch{}else if(s.action==="deep"||s.action==="custom")for(let o of this.ctaSubs)try{o(e,s)}catch{}r.state==="unread"&&this.markRead(e)}}async get(e){let t=this.mem.get(e);return t&&t.state!=="deleted"?t:void 0}async query(e={}){var c;let t=e.state==null?null:new Set(Array.isArray(e.state)?e.state:[e.state]),r=[...this.mem.values()].filter(l=>!((t?!t.has(l.state):l.state==="deleted"||l.state==="archived")||e.category&&l.category!==e.category||e.pinned!=null&&l.pinned!==e.pinned));if(r.sort((l,u)=>l.pinned!==u.pinned?l.pinned?-1:1:e.sort==="priority"&&l.priority!==u.priority?u.priority-l.priority:u.createdAt-l.createdAt||(l.id<u.id?1:-1)),e.cursor){let l=r.findIndex(u=>th(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:XS,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?th(a):null,hasMore:o}}async markSeen(e){let t=this.deps.now(),r=[];for(let s of e){let i=this.mem.get(s);i&&i.seenAt==null&&(i.seenAt=t,r.push(i),this.deps.trackEvent(we.seen,this.stamp({messageId:s,category:i.category})))}await this.store.putMany(r)}async sweepExpired(){let e=this.deps.now(),t=this.unread,r=[];for(let s of this.mem.values())if(s.expiresAt&&s.expiresAt<=e&&s.priority<3&&s.state!=="archived"&&s.state!=="deleted"){let i=s.state==="unread";s.state="archived",s.archivedAt=e,r.push(s),i&&this.unread--,this.deps.trackEvent(we.expired,this.stamp({messageId:s.id,category:s.category,wasUnread:i}))}this.emitUnreadAnd(t),await this.store.putMany(r)}recountUnread(){let e=0;for(let t of this.mem.values())t.state==="unread"&&e++;this.unread=e}collectDirtyOps(){var t;let e=[];for(let r of this.mem.values())r._dirty&&e.push({id:r.id,state:r.state,pinned:r.pinned,stateAt:(t=r.stateAt)!=null?t:0,pinnedAt:r.pinnedAt});return e}applyServerDelta(e,t,r){let s=[];for(let a of e){let c=this.mem.get(a.id),l=ka(c,a);l._dirty=c==null?void 0:c._dirty,this.mem.set(a.id,l),s.push(l),c||this.deps.trackEvent(we.received,this.stamp({messageId:l.id,campaignId:l.campaignId,category:l.category,priority:l.priority}))}let i=this.deps.now();for(let a of t){let c=this.mem.get(a);c&&c.state!=="deleted"&&(c.state="deleted",c.deletedAt=i,c.stateAt=i,s.push(c))}let o=this.unread;this.recountUnread(),typeof r=="number"&&(this.unread=r),o!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-o})),this.emitState(),this.store.putMany(s)}ackDirty(e){var r,s;let t=[];for(let[i,o]of e){let a=this.mem.get(i);a&&a._dirty&&((r=a.stateAt)!=null?r:0)===o.stateAt&&((s=a.pinnedAt)!=null?s:void 0)===o.pinnedAt&&(a._dirty=!1,t.push(a))}this.store.putMany(t)}dispose(){this.mem.clear(),this.ctaSubs.clear(),this.unread=0}}});var ih={};L(ih,{InboxFeature:()=>Ca});var sh,Ca,oh=k(()=>{"use strict";$();sh={unreadCount:0,total:0,syncStatus:"idle"},Ca=class{constructor(){this.name="inbox";this.ctx=null;this.active=!1;this.stateSubs=new Set;this.unreadSubs=new Set;this.pendingCta=new Set;this.lastState=sh;this.controllerRef=null;this.pushState=e=>{let t=this.lastState.unreadCount;this.lastState=e;for(let r of this.stateSubs)try{r(e)}catch{}if(e.unreadCount!==t)for(let r of this.unreadSubs)try{r(e.unreadCount)}catch{}}}get isActive(){return this.active}setup(e){this.ctx=e,typeof window!="undefined"&&(this.active=!0,this.onVisible=()=>{document.visibilityState==="visible"&&this.triggerSync()},this.onAttention=()=>this.triggerSync(),document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("focus",this.onAttention),window.addEventListener("online",this.onAttention),"serviceWorker"in navigator&&(this.onSwMessage=t=>{var s;let r=t.data;if((r==null?void 0:r.type)==="scalebun-inbox-sync"){this.refreshNow();return}if((r==null?void 0:r.type)==="scalebun-push-click"&&((s=r.data)!=null&&s.scalebunCampaignId)){let i=r.data.scalebunCampaignId;this.ensureRuntime().then(o=>o==null?void 0:o.markReadByCampaign(i))}},navigator.serviceWorker.addEventListener("message",this.onSwMessage)))}triggerSync(){this.active&&this.syncEngine&&this.syncEngine.sync()}applyTheme(e){var r;JSON.stringify(e)!==JSON.stringify((r=this.remoteTheme)!=null?r:null)&&(this.remoteTheme=e,this.widget&&Promise.resolve().then(()=>(ya(),ba)).then(({mountInbox:s})=>{var i,o;(i=this.widget)==null||i.destroy(),this.widget=s(this.controller(),(o=this.mountOpts)!=null?o:{},this.remoteTheme)}))}refreshNow(){return this.active?this.ensureRuntime().then(()=>{var e;(e=this.syncEngine)==null||e.sync()}):Promise.resolve()}ensureRuntime(){return this.runtime?Promise.resolve(this.runtime):this.ctx?this.loading?this.loading:(this.loading=(async()=>{var c,l,u,d,p,f,m;let[{InboxRuntime:e},{InboxStore:t}]=await Promise.all([Promise.resolve().then(()=>(rh(),nh)),Promise.resolve().then(()=>(wa(),Qm))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var x;return(x=this.ctx)==null?void 0:x.trackEvent(h,g)},replayCoord:ne,now:P,onState:this.pushState,store:r});this.runtime=s;for(let h of this.pendingCta)s.onCtaAction(h);this.pendingCta.clear(),await s.hydrate();let{InboxSync:i,InboxTransport:o}=await Promise.resolve().then(()=>(Ea(),Zm)),a=new o((u=(l=this.ctx)==null?void 0:l.apiBaseUrl)!=null?u:"",(p=(d=this.ctx)==null?void 0:d.clientKey)!=null?p:"",(m=(f=this.ctx)==null?void 0:f.deviceId)!=null?m:"anon");return this.syncEngine=new i({transport:a,store:r,runtime:s,onStatus:h=>s.setSyncStatus(h),onTheme:h=>this.applyTheme(h)}),this.syncEngine.sync(),s})(),this.loading):Promise.resolve(void 0)}call(e,...t){return this.ensureRuntime().then(r=>{var s;(s=r==null?void 0:r[e])==null||s.call(r,...t)})}controller(){return this.controllerRef?this.controllerRef:(this.controllerRef={subscribe:e=>(this.stateSubs.add(e),e(this.lastState),this.ensureRuntime(),()=>this.stateSubs.delete(e)),onUnreadChange:e=>(this.unreadSubs.add(e),e(this.lastState.unreadCount),this.ensureRuntime(),()=>this.unreadSubs.delete(e)),getState:()=>this.lastState,query:e=>this.ensureRuntime().then(t=>t?t.query(e):{messages:[],cursor:null,hasMore:!1}),get:e=>this.ensureRuntime().then(t=>t==null?void 0:t.get(e)),markRead:e=>this.call("markRead",e),markUnread:e=>this.call("markUnread",e),markAllRead:e=>this.call("markAllRead",e),archive:e=>this.call("archive",e),unarchive:e=>this.call("unarchive",e),pin:(e,t)=>this.call("pin",e,t),remove:e=>this.call("remove",e),ingest:e=>this.call("ingest",e),act:(e,t)=>{this.call("act",e,t)},mount:e=>{typeof document!="undefined"&&this.ensureRuntime().then(async()=>{var r;let{mountInbox:t}=await Promise.resolve().then(()=>(ya(),ba));(r=this.widget)==null||r.destroy(),this.mountOpts=e!=null?e:{},this.widget=t(this.controller(),this.mountOpts,this.remoteTheme)})},open:()=>{var e;return(e=this.widget)==null?void 0:e.open()},close:()=>{var e;return(e=this.widget)==null?void 0:e.close()},unmount:()=>{var e;(e=this.widget)==null||e.destroy(),this.widget=void 0},onCtaAction:e=>this.runtime?this.runtime.onCtaAction(e):(this.pendingCta.add(e),this.ensureRuntime(),()=>{this.pendingCta.delete(e)}),refresh:()=>this.ensureRuntime().then(()=>{var e;return(e=this.syncEngine)==null?void 0:e.sync()})},this.controllerRef)}teardown(){var e,t;typeof window!="undefined"&&(this.onVisible&&document.removeEventListener("visibilitychange",this.onVisible),this.onAttention&&(window.removeEventListener("focus",this.onAttention),window.removeEventListener("online",this.onAttention)),this.onSwMessage&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",this.onSwMessage)),this.onVisible=void 0,this.onAttention=void 0,this.onSwMessage=void 0,(e=this.widget)==null||e.destroy(),this.widget=void 0,(t=this.runtime)==null||t.dispose(),this.runtime=void 0,this.syncEngine=void 0,this.loading=void 0,this.stateSubs.clear(),this.unreadSubs.clear(),this.pendingCta.clear(),this.lastState=sh,this.active=!1}}});var ah={};L(ah,{ProfilerFeature:()=>Aa});function YS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Aa,ch=k(()=>{"use strict";$();Aa=class{constructor(){this.name="profiler";this.ctx=null;this.active=!1;this.startedAt=0}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}available(){return typeof window!="undefined"&&typeof window.Profiler=="function"}start(e=10){if(!this.active||this.profiler||!this.available())return!1;try{let t=window.Profiler;return this.profiler=new t({sampleInterval:e,maxBufferSize:1e4}),this.startedAt=P(),!0}catch{return this.profiler=void 0,!1}}async stop(){var t;if(!this.profiler)return!1;let e=this.profiler;this.profiler=void 0;try{let r=await e.stop(),s=Math.round(P()-this.startedAt);return(t=this.ctx)==null||t.emit({kind:"performance",metric:"js_profile",value:Array.isArray(r.samples)?r.samples.length:0,duration:s,screenName:YS(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${H()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}}});function Ra(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function lh(n,e=10){if(!Ra())return null;try{let t=window.Profiler,r=new t({sampleInterval:e,maxBufferSize:1e4});await new Promise(o=>setTimeout(o,n));let s=await r.stop(),i=Array.isArray(s==null?void 0:s.samples)?s.samples.length:0;return{profile:s,samples:i}}catch{return null}}var dh=k(()=>{"use strict"});function mh(n){return n?{...uh,...n}:uh}var uh,ph,fh,Ta=k(()=>{"use strict";uh={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},ph=10*6e4,fh=10});function JS(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var Cs,Is,hh=k(()=>{"use strict";Ta();Cs=class Cs{constructor(e){this.lag=[];this.pressure="nominal";this.pressureSince=0;this.jankAt=[];this.highSlopeStreak=0;this.memTrend=[];this.lastEmit=new Map;this.emitTimes=[];this.droppedCount=0;this.deps=e,this.th=e.thresholds}get dropped(){return this.droppedCount}onHeartbeat(e){this.lag.push(e),this.lag.length>Cs.LAG_RING&&this.lag.shift(),e>=this.th.mainThreadStallMs&&this.emit({type:"main_thread_stall",severity:e>=2e3?"critical":"warning",confidence:"high",tier:"lag-proxy",value:Math.round(e),likelyCause:"main thread blocked",description:`The main thread was blocked for ${Math.round(e)} ms.`}),this.evaluateCpu()}onPressure(e){e!==this.pressure&&(this.pressure=e,this.pressureSince=this.deps.now(),this.evaluateCpu())}onJank(e){var s,i;let t=this.deps.now();e.frameDurationMs>=this.th.frozenFrameMs&&this.emit({type:"frozen_frame",severity:e.frameDurationMs>=2e3?"critical":"warning",confidence:"high",tier:e.metric,value:Math.round(e.frameDurationMs),script:e.script,likelyCause:(s=e.script)!=null&&s.url?`long frame in ${e.script.url}`:"long animation frame",description:`A single frame took ${Math.round(e.frameDurationMs)} ms.`}),this.jankAt.push(t);let r=t-this.th.jankWindowMs;for(;this.jankAt.length&&this.jankAt[0]<r;)this.jankAt.shift();this.jankAt.length>=this.th.jankBurstCount&&this.emit({type:"jank_burst",severity:"warning",confidence:"medium",tier:e.metric,value:this.jankAt.length,script:e.script,likelyCause:(i=e.script)!=null&&i.url?`repeated jank in ${e.script.url}`:"repeated main-thread jank",description:`${this.jankAt.length} janky frames within ${Math.round(this.th.jankWindowMs/1e3)} s.`})}onMemory(e,t){let r=this.deps.now();if(t>0&&e/t>=this.th.heapUsedRatio&&this.emit({type:"low_memory_pressure",severity:"critical",confidence:"high",tier:"memory",value:Math.round(e/t*100),likelyCause:"JS heap near its limit",description:`Used heap is ${Math.round(e/t*100)}% of the limit.`}),this.prevMem){let s=(r-this.prevMem.at)/1e3,i=s>0?(e-this.prevMem.used)/s:0;i>this.th.memSurgeBytesPerSec?(this.highSlopeStreak++,this.highSlopeStreak>=2&&this.emit({type:"memory_surge",severity:i>2*this.th.memSurgeBytesPerSec?"critical":"warning",confidence:"medium",tier:"memory",value:Math.round(i),likelyCause:"rapid heap allocation",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB/s.`})):this.highSlopeStreak=0}if(this.prevMem={used:e,at:r},this.memTrend.push(e),this.memTrend.length>this.th.leakSamples&&this.memTrend.shift(),this.memTrend.length===this.th.leakSamples){let s=!0;for(let o=1;o<this.memTrend.length;o++)if(this.memTrend[o]<this.memTrend[o-1]){s=!1;break}let i=this.memTrend[this.memTrend.length-1]-this.memTrend[0];s&&i>=this.th.leakMinBytes&&this.emit({type:"memory_leak_suspicion",severity:"warning",confidence:"low",tier:"memory",value:Math.round(i),likelyCause:"monotonic heap growth",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB over ${this.memTrend.length} samples without release.`})}}evaluateCpu(){if(this.deps.pressureAvailable){this.pressure==="critical"&&this.deps.now()-this.pressureSince>=this.th.pressureSustainMs&&this.emit({type:"cpu_spike",severity:"critical",confidence:"high",tier:"pressure",likelyCause:"sustained CPU pressure",description:`CPU stayed under critical pressure for ${Math.round(this.th.pressureSustainMs/1e3)}s+.`});return}if(this.lag.length<6)return;let e=JS([...this.lag].sort((t,r)=>t-r));e>this.th.lagP95Ms&&this.emit({type:"cpu_spike",severity:e>2*this.th.lagP95Ms?"critical":"warning",confidence:"medium",tier:"lag-proxy",value:Math.round(e),likelyCause:"sustained event-loop lag",description:`Event-loop lag p95 was ${Math.round(e)} ms.`})}emit(e){var r;let t=this.deps.now();if(!(t-((r=this.lastEmit.get(e.type))!=null?r:-1/0)<this.th.cooldownMs)){if(this.emitTimes=this.emitTimes.filter(s=>t-s<ph),this.emitTimes.length>=fh){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};Cs.LAG_RING=32;Is=Cs});function gh(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var As,bh=k(()=>{"use strict";$();As=class{constructor(){this.lags=[];this.pressureCounts={nominal:0,fair:0,serious:0,critical:0};this.sawPressure=!1;this.memFirstAt=0;this.memLastAt=0;this.incidents=0}onHeartbeat(e){this.lags.push(e)}onPressure(e){this.pressureCounts[e]++,this.sawPressure=!0}onMemory(e){let t=P();this.memFirst==null&&(this.memFirst=e,this.memFirstAt=t),this.memLast=e,this.memLastAt=t}noteIncident(){this.incidents++}drain(e,t){let r=[...this.lags].sort((i,o)=>i-o),s={lagP50:Math.round(gh(r,.5)),lagP95:Math.round(gh(r,.95)),lagMax:r.length?Math.round(r[r.length-1]):0,heartbeats:this.lags.length,incidents:this.incidents,droppedIncidents:t,tiers:e};if(this.sawPressure&&(s.pressure={...this.pressureCounts}),this.memLast!=null&&this.memFirst!=null){let i=(this.memLastAt-this.memFirstAt)/1e3;s.heap={firstBytes:this.memFirst,lastBytes:this.memLast,slopeBytesPerSec:i>0?Math.round((this.memLast-this.memFirst)/i):0}}return this.lags=[],this.pressureCounts={nominal:0,fair:0,serious:0,critical:0},this.sawPressure=!1,this.incidents=0,this.memLast!=null&&(this.memFirst=this.memLast,this.memFirstAt=P()),s}}});function yh(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function vh(n,e){var d;let t=[],r=P(),s,i=()=>{let p=P(),f=p-r-e.heartbeatMs;r=p,f>=0&&n.onHeartbeat(f),s=setTimeout(i,e.heartbeatMs)},o=()=>{r=P(),s=setTimeout(i,e.heartbeatMs)},a=()=>{s&&clearTimeout(s),s=void 0},c=()=>{yh()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),yh()&&o(),t.push(a);let l=!1;try{let p=globalThis.PressureObserver;if(typeof p=="function"){l=!0;let f=new p(m=>{let h=m[m.length-1];h!=null&&h.state&&n.onPressure(h.state)});f.observe("cpu",{sampleInterval:2e3}).catch(()=>{}),t.push(()=>{try{f.disconnect()}catch{}})}}catch{l=!1}let u=typeof performance!="undefined"&&typeof((d=performance.memory)==null?void 0:d.usedJSHeapSize)=="number";if(u){let p=()=>{var h;let m=performance.memory;m&&typeof m.usedJSHeapSize=="number"&&n.onMemory(m.usedJSHeapSize,(h=m.jsHeapSizeLimit)!=null?h:0)};p();let f=setInterval(p,e.memorySampleMs);t.push(()=>clearInterval(f))}return{stop:()=>{for(let p of t)try{p()}catch{}},pressureAvailable:l,memoryAvailable:u}}var wh=k(()=>{"use strict";$()});var xh={};L(xh,{startWatchdog:()=>rk});function ZS(n,e){let t=e!=null?e:1;return t>=1?!0:t<=0?!1:Ee(`${n!=null?n:""}:wzb-watchdog-v1`)%100<t*100}function ek(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function rk(n){var x,v,y,b;let e=(x=n.watchdogOptions)!=null?x:{};if(!ZS(n.sessionId,e.sampleRate))return QS;let t=(E,w,I,S)=>{let C=ne();n.emit({kind:"performance",metric:E,value:w,screenName:ek(),metadata:C?{...I,replay:C}:I,clientId:S!=null?S:`wd_${H()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=E=>{if(!r||s||!Ra())return;let w=P();w-i<nk||(i=w,s=!0,lh(tk).then(I=>{I&&t("js_profile",I.samples,{profile:I.profile,format:"w3c-js-self-profiling",incidentClientId:E})}).finally(()=>{s=!1}))},a=mh(e.thresholds),c=new As,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new Is({thresholds:a,now:P,pressureAvailable:d,onIncident:E=>{var I;l++,c.noteIncident();let w=`wd_${H()}`;t("resource_incident",(I=E.value)!=null?I:1,E,w),n.signal("resource_pressure"),o(w)}}),f=Cd(E=>p.onJank(E)),m=vh({onHeartbeat:E=>{p.onHeartbeat(E),c.onHeartbeat(E)},onPressure:E=>{p.onPressure(E),c.onPressure(E)},onMemory:(E,w)=>{p.onMemory(E,w),c.onMemory(E)}},{heartbeatMs:Math.max(250,(v=e.heartbeatMs)!=null?v:1e3),memorySampleMs:(y=e.memorySampleMs)!=null?y:2e4}),h=()=>({pressure:d,memory:m.memoryAvailable}),g=setInterval(()=>{u++;let E=c.drain(h(),p.dropped);t("resource_health",E.lagP95,E)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var QS,tk,nk,Sh=k(()=>{"use strict";$();Fe();Ci();dh();hh();bh();wh();Ta();QS={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};tk=1e4,nk=6e4});var kh={};L(kh,{WatchdogFeature:()=>Ma});var sk,Ma,Eh=k(()=>{"use strict";sk={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},Ma=class{constructor(){this.name="watchdog";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startWatchdog:t}=await Promise.resolve().then(()=>(Sh(),xh));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:sk}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}}});function ik(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function ok(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var Ih,Pa,Rs,Ch=k(()=>{"use strict";Ih="scalebun_inapp_outbox";Pa=class{constructor(e,t=ok()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=ik((s=(r=this.storage)==null?void 0:r.getItem(Ih))!=null?s:null)}enqueue(e){this.queue.some(t=>t.id===e.id)||(this.queue.push(e),this.queue.length>200&&this.queue.splice(0,this.queue.length-200),this.persist(),this.schedule())}get size(){return this.queue.length}schedule(){this.timer||this.flushing||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},800))}async flush(){if(!(this.flushing||this.queue.length===0)){this.flushing=!0;try{for(;this.queue.length>0;){let e=this.queue.slice(0,50);if(!await this.post(e))break;let r=new Set(e.map(s=>s.id));this.queue=this.queue.filter(s=>!r.has(s.id)),this.persist()}}finally{this.flushing=!1,this.queue.length>0&&this.schedule()}}}persist(){var e;try{(e=this.storage)==null||e.setItem(Ih,JSON.stringify(this.queue))}catch{}}};Rs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Pa(r=>this.postEvents(r))}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;for(let[r,s]of Object.entries(e))s&&t.set(r,String(s));try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}async postEvents(e){if(!this.usable||e.length===0)return!1;try{return(await fetch(`${this.apiBaseUrl}/sdk/engage/events`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,source:"inapp",events:e}),keepalive:!0})).ok}catch{return!1}}}});function ak(n){let e="";for(let t=0;t<n.length;t++){let r=n[t];r==="*"?n[t+1]==="*"?(e+=".*",t++):e+="[^/]*":"\\^$.|?+()[]{}".includes(r)?e+="\\"+r:e+=r}return new RegExp("^"+e+"$")}function La(n,e){return!n||n.length===0?!0:n.some(t=>ak(t).test(e))}function ck(n,e){var r;if(!n)return!0;let t=(r=e.queryElement)!=null?r:s=>typeof document!="undefined"?!!document.querySelector(s):!1;try{return t(n)}catch{return!1}}function dk(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function uk(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return dk(e).has(t.slice(8).trim());for(let s of lk){let i=t.indexOf(s);if(i>0){let o=t.slice(0,i).trim(),a=t.slice(i+s.length).trim(),c=(r=e==null?void 0:e.attrs)==null?void 0:r[o];if(c===void 0)return!1;let l=Number(c),u=Number(a),d=!Number.isNaN(l)&&!Number.isNaN(u)&&a!=="";switch(s){case"=":return String(c)===a;case"!=":return String(c)!==a;case">":return d&&l>u;case"<":return d&&l<u;case">=":return d&&l>=u;case"<=":return d&&l<=u}}}return!1}function pk(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>uk(t,e))}function Th(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return La(r.route,e.route)?ck(r.element,e)?r.minViewport!=null&&((i=e.viewportWidth)!=null?i:1/0)<r.minViewport?{eligible:!1,reason:"viewport"}:r.selection&&!e.hasSelection?{eligible:!1,reason:"selection"}:pk(r.audience,e.profile)?t.canShow(n,e.now)?{eligible:!0}:{eligible:!1,reason:"frequency"}:{eligible:!1,reason:"audience"}:{eligible:!1,reason:"element"}:{eligible:!1,reason:"route"}}function mk(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function hk(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}var lk,Ah,Rh,fk,Ts,_a=k(()=>{"use strict";os();lk=[">=","<=","!=","=",">","<"];Ah="scalebun_inapp_freq",Rh="scalebun_inapp_freq_session",fk=1,Ts=class{constructor(e=mk(),t="",r=hk()){this.storage=e;this.sessionId=t;this.sessionStore=r;this.map=this.load(),this.session=this.loadSession()}loadSession(){var e;try{let t=(e=this.sessionStore)==null?void 0:e.getItem(Rh),r=t?JSON.parse(t):null;if(r&&r.sid===this.sessionId&&r.recs)return{sid:this.sessionId,recs:r.recs}}catch{}return{sid:this.sessionId,recs:{}}}saveSession(){var e;try{(e=this.sessionStore)==null||e.setItem(Rh,JSON.stringify(this.session))}catch{}}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(Ah);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(Ah,JSON.stringify(this.map))}catch{}}canShow(e,t){var a,c,l;let r=e.frequency,s=this.map[e.id],i=this.session.recs[e.id];if(s!=null&&s.dismissed&&((a=e.dismiss)!=null&&a.persistDismiss||i!=null&&i.dismissed))return!1;let o=(c=r==null?void 0:r.maxImpressionsPerSession)!=null?c:r?0:fk;return o>0&&((l=i==null?void 0:i.n)!=null?l:0)>=o?!1:s?!(r!=null&&r.showOnce&&s.count>0||(r==null?void 0:r.maxImpressions)!=null&&s.count>=r.maxImpressions||(r==null?void 0:r.cooldown)!=null&&t-s.lastShown<r.cooldown):!0}recordImpression(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.n+=1,this.session.recs[e]=s,this.saveSession()}recordDismiss(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.dismissed=!0,this.session.recs[e]=s,this.saveSession()}clear(){this.map={},this.save(),this.session={sid:this.sessionId,recs:{}},this.saveSession()}}});var Mh=k(()=>{"use strict"});function Ph(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return La(n.match?[n.match]:void 0,(t=e.value)!=null?t:"");case"event":return n.match==null||n.match===e.value;case"idle":return((r=e.arg)!=null?r:0)>=((s=n.arg)!=null?s:0);case"element":case"hover":case"selection":case"keyboard":case"right-click":return n.match==null||n.match===e.value;default:return!0}}function Lh(){let n=null,e=null,t=()=>typeof location!="undefined"?location.pathname+location.search:"";return{type:"route",start(r){if(typeof window=="undefined"||typeof history=="undefined")return;let s=()=>r.fire({type:"route",value:t()}),i=history.pushState,o=history.replaceState;history.pushState=function(...a){let c=i.apply(this,a);return s(),c},history.replaceState=function(...a){let c=o.apply(this,a);return s(),c},e=s,window.addEventListener("popstate",s),window.addEventListener("hashchange",s),n=()=>{history.pushState=i,history.replaceState=o},s()},stop(){n==null||n(),n=null,e&&typeof window!="undefined"&&(window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)),e=null}}}function _h(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Oh(){let n=null,e=[],t=[],r=null,s=["mousemove","mousedown","keydown","scroll","touchstart","pointerdown"],i=()=>{for(let a of t)clearTimeout(a);t=[]},o=()=>{if(i(),!!n)for(let a of e)a>0&&t.push(setTimeout(()=>n==null?void 0:n.fire({type:"idle",arg:a}),a))};return{type:"idle",start(a){if(n=a,typeof window!="undefined"){r=o;for(let c of s)window.addEventListener(c,r,{passive:!0});o()}},stop(){if(i(),r&&typeof window!="undefined")for(let a of s)window.removeEventListener(a,r);r=null,n=null},setThresholds(a){e=Array.from(new Set(a.filter(c=>c>0))),o()}}}var Ms,Nh=k(()=>{"use strict";_a();Mh();Ms=class{constructor(e=()=>Date.now()){this.listeners=new Set;this.plugins=[];this.now=e}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}fire(e){var r;let t={...e,at:(r=e.at)!=null?r:this.now()};for(let s of this.listeners)try{s(t)}catch{}}use(e){this.plugins.push(e),e.start(this)}stop(){for(let e of this.plugins)e.stop();this.plugins=[],this.listeners.clear()}}});function yk(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return gk[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=bk[n.category])!=null?s:0)}function Fh(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:yk(b,s)})).sort((b,E)=>E.score-b.score||b.c.id.localeCompare(E.c.id)),o=[],a=(b,E,w,I,S)=>o.push({id:b.id,action:E,reason:w,zone:b.zone,score:I,preempts:S}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>Ps(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,x=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:E}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",E);continue}c.set(b.campaignId,E)}let w=(y=r.guard)==null?void 0:y.call(r,b);if(w){a(b,w.action,w.reason,E);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",E);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",E);continue}if((b.zone==="toast"?3:1)===1&&l.has(b.zone)){a(b,b.cost>0?"QUEUE":"DROP",b.cost>0?"queue:zone-busy":"zone-lost",E);continue}if(Ps(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",E);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",E);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",E);continue}if(b.zone==="modal"&&x>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",E);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",E);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",E);continue}}let S;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!Ps(M.zone)&&Bh[M.tier]<Bh.critical);C&&(S=C.id)}a(b,S?"PREEMPT":"SHOW",S?"preempt:critical":"show",E,S),l.set(b.zone,b.id),b.zone==="toast"&&d++,Ps(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&x++,f=!0,v=s)}return o}var gk,bk,Bh,Ps,Dh=k(()=>{"use strict";gk={critical:1e3,high:400,normal:200,low:100,passive:50},bk={security:300,system:250,billing:200},Bh={critical:4,high:3,normal:2,low:1,passive:0};Ps=n=>n==="modal"||n==="takeover"});function vk(n,e={}){switch(n){case"modal":return{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}};case"fullscreen":return{surface:"takeover",surfaceOptions:{size:"full"}};case"bottom_sheet":return{surface:"slideover",surfaceOptions:{placement:"bottom"}};case"top_banner":return{surface:"banner",surfaceOptions:{placement:"top"}};case"bottom_banner":return{surface:"banner",surfaceOptions:{placement:"bottom"}};case"toast":return{surface:"toast",surfaceOptions:{placement:"bottom-right"}};case"tooltip":return e.anchorSelector?{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}:{surface:"toast",surfaceOptions:{placement:"bottom-right"}};default:return{surface:"modal",surfaceOptions:{placement:"center",backdrop:!0}}}}function wk(n){var s,i;let e=n.spec,t=[];e.imageUrl&&t.push({kind:"image",props:{src:e.imageUrl,alt:(s=e.title)!=null?s:""}}),e.title&&t.push({kind:"heading",props:{text:e.title}}),e.body&&t.push({kind:"text",props:{text:e.body}});let r=[];return e.cta&&r.push({label:e.cta.label,variant:"primary",action:e.cta.action,deepLink:e.cta.deepLink}),e.secondaryCta&&r.push({label:e.secondaryCta.label,variant:"secondary",action:e.secondaryCta.action}),r.length&&t.push({kind:"cta",props:{actions:r}}),t.length===0&&t.push({kind:"text",props:{text:(i=e.body)!=null?i:""}}),t}function xk(n){var t,r,s,i;if(n.preview)return[{type:"manual"}];let e=(r=n.targetScreen)!=null?r:(t=n.triggerConfig)==null?void 0:t.screen;return e?[{type:"route",match:e}]:(s=n.triggerConfig)!=null&&s.event?[{type:"event",match:n.triggerConfig.event}]:(i=n.triggerConfig)!=null&&i.seconds?[{type:"idle",arg:n.triggerConfig.seconds*1e3}]:[{type:"manual"}]}function Sk(n){let e=n.throttle;if(!e)return;let t={};return e.showOnce&&(t.showOnce=!0),e.maxImpressions!=null&&(t.maxImpressions=e.maxImpressions),e.cooldownHours!=null&&(t.cooldown=e.cooldownHours*36e5),Object.keys(t).length?t:void 0}function kk(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=vk(n.layout,e),s=t==="popover",i=(a=n.targetScreen)!=null?a:(o=n.triggerConfig)==null?void 0:o.screen;return{id:n.id,key:`legacy.${n.layout}.${n.id}`,name:(c=n.spec.title)!=null?c:`Legacy ${n.layout}`,category:"misc",platforms:["web"],surface:t,surfaceOptions:r,blocks:wk(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:xk(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:Sk(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function qh(n,e={}){return(n!=null?n:[]).map(t=>kk(t,e))}var Hh=k(()=>{"use strict"});function Ek(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function $h(n){var r;let e=Ek(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...qh(n.legacyMessages)),t.filter(Uu)}var zh=k(()=>{"use strict";Hh();$r()});var Uh={};L(Uh,{InAppEngine:()=>Oa});var Ik,Oa,Vh=k(()=>{"use strict";Ch();Nh();_a();Dh();zh();cs();ro();Mo();$r();Fi();Ik=120,Oa=class{constructor(e){this.deps=e;this.host=new ln;this.slots=new Mt;this.variants=[];this.pending=new Map;this.live=new Map;this.tickTimer=null;this.started=!1;var t;this.now=(t=e.now)!=null?t:()=>Date.now(),this.freq=new Ts(void 0,e.sessionId),this.transport=new Rs(e.apiBaseUrl,e.clientKey),this.bus=new Ms(this.now),this.budget={tokens:5,interruptionsThisSession:0,maxInterruptionsPerSession:5,modalsToday:0,maxModalsPerDay:3,lastInterruptionAt:0,minCooldownMs:3e4}}async start(){this.started||(this.started=!0,await this.load())}async onIdentify(){this.started&&await this.load()}async load(){var s,i;let e;try{e=await this.transport.fetchConfig({platform:"web",appVersion:this.deps.appVersion,deviceId:this.deps.deviceId,endUserId:(i=(s=this.deps).userId)==null?void 0:i.call(s),route:this.deps.route()})}catch{return}if(!this.started)return;let t=Bi(e),r=e==null?void 0:e.variants;this.variants=$h({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(Lh()),this.bus.use(_h()),this.bus.use(Oh()),this.unsub=this.bus.on(o=>this.onSignal(o))),this.bus.fire({type:"route",value:this.deps.route()}))}fireEvent(e){this.started&&this.bus.fire({type:"event",value:e})}onSignal(e){let t=this.targetingCtx();for(let r of this.variants)this.live.has(r.id)||this.pending.has(r.id)||r.triggers.some(s=>Ph(s,e))&&Th(r,t,this.freq).eligible&&this.pending.set(r.id,this.toCandidate(r));this.pending.size&&this.scheduleTick()}toCandidate(e){let t=e.surface==="coachmark"||e.surface==="tour"||e.surface==="hotspot",r=e.surface==="launcher"||e.surface==="palette";return{id:e.id,zone:Lt(e),focus:oo[e.surface],cost:ao[e.surface],tier:e.priority,category:e.category,triggeredAt:this.now(),guidance:t,interactionOnly:r}}targetingCtx(){var t,r,s,i;let e=typeof window!="undefined"?!!((r=(t=window.getSelection)==null?void 0:t.call(window))!=null&&r.toString()):!1;return{route:this.deps.route(),profile:(i=(s=this.deps).profile)==null?void 0:i.call(s),now:this.now(),viewportWidth:typeof window!="undefined"?window.innerWidth:void 0,hasSelection:e}}scheduleTick(){this.tickTimer||(this.tickTimer=setTimeout(()=>{this.tickTimer=null,this.tick()},Ik))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Fh(e,t,this.budget,{now:this.now()});for(let s of r){let i=this.variants.find(o=>o.id===s.id);i&&(s.action==="SHOW"||s.action==="PREEMPT"?(this.pending.delete(i.id),s.action==="PREEMPT"&&s.preempts&&this.close(s.preempts),await this.show(i)):s.action==="DROP"&&this.pending.delete(i.id))}this.pending.size&&this.scheduleTick()}async show(e){let t=this.now.bind(this),r=(i,o)=>{var c,l;let a={id:`${e.id}:${i}:${t()}`,type:i,variantId:e.id,ts:t(),props:o};this.transport.outbox.enqueue(a),(l=(c=this.deps).onEvent)==null||l.call(c,a)},s={onImpression:()=>{this.freq.recordImpression(e.id,t()),r("impression")},onView:()=>r("view"),onCtaClick:i=>r("cta_click",{action:i}),onInteraction:i=>r("interaction",{name:i}),onDismiss:i=>{this.freq.recordDismiss(e.id,t()),this.live.delete(e.id),r("dismiss",{method:i}),this.scheduleTick()}};try{let i=await To(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Lt(e),focus:oo[e.surface],tier:e.priority},surface:i});let o=ao[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Lt(e)==="modal"&&this.budget.modalsToday++)}catch{this.pending.delete(e.id)}}close(e){let t=this.live.get(e);if(t){try{t.surface.close()}catch{}this.live.delete(e)}}stop(){var e;if(this.started){this.started=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=null),(e=this.unsub)==null||e.call(this),this.bus.stop();for(let t of[...this.live.keys()])this.close(t);this.pending.clear(),this.transport.outbox.flush();try{this.host.destroy()}catch{}}}}});var Wh={};L(Wh,{InApp2Feature:()=>Na});var Na,jh=k(()=>{"use strict";Na=class{constructor(){this.name="inapp2";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined"||!e.clientKey||!e.apiBaseUrl)return;this.active=!0;let{InAppEngine:t}=await Promise.resolve().then(()=>(Vh(),Uh));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,sessionId:e.sessionId,appVersion:e.appVersion,userId:()=>{var r;return(r=e.getUserId)==null?void 0:r.call(e)},route:()=>typeof location!="undefined"?location.pathname+location.search:"",config:{engine:"native"}}),this.engine.start())}fireEvent(e){var t;(t=this.engine)==null||t.fireEvent(e)}onIdentify(){var e;(e=this.engine)==null||e.onIdentify()}teardown(){var e;this.active=!1,(e=this.engine)==null||e.stop(),this.engine=void 0}}});var Jh={};L(Jh,{armSoftAsk:()=>Pk});function Xh(){try{let n=Number(localStorage.getItem(Yh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function Tk(n){try{localStorage.setItem(Yh,String(Date.now()+n*864e5))}catch{}}function Mk(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.setAttribute("data-scalebun",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
670
+ @media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function WS(n,e,t){var G,ie,Y,X,te;let r=(G=e.position)!=null?G:"bottom-right",s=typeof document!="undefined"&&(document.documentElement.getAttribute("dir")==="rtl"||typeof getComputedStyle!="undefined"&&getComputedStyle(document.documentElement).direction==="rtl"),i=(ie=e.rtl)!=null?ie:s,o=e.layout==="dropdown"&&Zm(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Qm,...(Y=t==null?void 0:t.labels)!=null?Y:{},...(X=e.labels)!=null?X:{}},l=(te=e.formatTime)!=null?te:US,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox",""),d.setAttribute("data-scalebun","");let p=d.attachShadow({mode:"open"});Ne(p,VS(u,r,i,o,a,t==null?void 0:t.tokens)),document.body.appendChild(d);let f=ee("div","scrim"),m=ee("div","panel");m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",c.panelAria),m.setAttribute("aria-hidden","true"),i&&m.setAttribute("dir","rtl");let h=ee("div","hd"),g=ee("div"),x=ee("div","ti",c.title),v=ee("div","mt");g.append(x,v);let y=document.createElement("button");y.className="x",y.type="button",y.setAttribute("aria-label",c.close),y.textContent="\xD7",h.append(g,y);let b=ee("div","tabs");b.setAttribute("role","tablist"),b.style.display="none";let E=ee("div","body"),w=ee("div","live");if(w.setAttribute("role","status"),w.setAttribute("aria-live","polite"),m.append(h,b,E,w),e.onViewAll){let T=ee("div","foot"),_=document.createElement("button");_.type="button",_.textContent=c.viewAll,_.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(_),m.appendChild(T)}p.append(f,m);let I,S,C=Zm(e.trigger);C||(I=document.createElement("button"),I.className="bell",I.type="button",I.setAttribute("aria-label",c.open),I.setAttribute("aria-expanded","false"),I.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?I.textContent=e.icon:e.icon?I.appendChild(e.icon):I.innerHTML=zS,S=document.createElement("span"),S.className="badge",S.setAttribute("aria-hidden","true"),I.appendChild(S),p.appendChild(I));let M=C!=null?C:I,R=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),_=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-_:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-_-F))}px`;let re=window.innerHeight-T.bottom;m.style.top=re>=N+F||re>=T.top?`${T.bottom+6}px`:`${Math.max(F,T.top-N-6)}px`},D=T=>{var _,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),I==null||I.setAttribute("aria-expanded",String(T)),T?(A=(N=(_=p.activeElement)!=null?_:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},ne=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();I==null||I.addEventListener("click",fe),C==null||C.addEventListener("click",fe),y.addEventListener("click",J),f.addEventListener("click",J);let ce=T=>{if(T.key==="Escape"){T.stopPropagation(),J();return}if(T.key==="Tab"){let _=xe(),N=_[0],F=_[_.length-1];if(!N||!F)return;let W=p.activeElement;T.shiftKey&&W===N?(T.preventDefault(),F.focus()):!T.shiftKey&&W===F&&(T.preventDefault(),N.focus())}};m.addEventListener("keydown",ce);function xe(){return[...m.querySelectorAll('button, [tabindex="0"]')]}let Se=n.subscribe(T=>{let _=T.unreadCount;S&&(S.textContent=_>99?"99+":String(_),S.classList.toggle("on",_>0)),v.textContent=_>0?c.unread(_):c.noUnread,I&&I.setAttribute("aria-label",_>0?c.openUnread(_):c.open),R&&Ve()}),le=null;function H(){let T=ee("div","empty");return T.appendChild(ee("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,_,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",_),F.title=_,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ce,Ae;let _=ee("div","row"+(T.state==="unread"?" unread":""));_.setAttribute("role","listitem"),_.tabIndex=0,_.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),_.dataset.id=T.id,_.appendChild(ee("span","dot"));let N=ee("div","ic");if(T.iconUrl){let Re=document.createElement("img");Re.src=T.iconUrl,Re.alt="",N.appendChild(Re)}else N.textContent=((Ce=(he=T.category)==null?void 0:he[0])!=null?Ce:"\u2022").toUpperCase();_.appendChild(N);let F=ee("div","rc"),W=ee("div","rtop");if(W.appendChild(ee("div","rt",T.title)),W.appendChild(ee("span","rtime",l(T.createdAt))),F.appendChild(W),T.body&&F.appendChild(ee("div","rb",T.body)),(Ae=T.cta)!=null&&Ae.length){let Re=ee("div","rcta");T.cta.slice(0,2).forEach((Je,st)=>{let ke=document.createElement("button");st>0&&(ke.className="sec"),ke.textContent=Je.label,ke.addEventListener("click",gn=>{gn.stopPropagation(),n.act(T.id,Je.key)}),Re.appendChild(ke)}),F.appendChild(Re)}_.appendChild(F);let re=ee("div","ract"),ge=V(qS,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(HS,c.archive,()=>void n.archive(T.id)),V($S,c.delete,()=>void n.remove(T.id))),_.appendChild(re),_.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),_}function de(T){var re,ge,he;let _=T.target.closest(".row");if(!_)return;let N=[...E.querySelectorAll(".row")],F=N.indexOf(_),W=_.dataset.id;T.key==="ArrowDown"?(T.preventDefault(),(re=N[Math.min(N.length-1,F+1)])==null||re.focus()):T.key==="ArrowUp"?(T.preventDefault(),(ge=N[Math.max(0,F-1)])==null||ge.focus()):T.key==="Enter"||T.key===" "?(T.preventDefault(),n.markRead(W)):T.key==="Delete"||T.key==="Backspace"?(T.preventDefault(),n.archive(W),(he=N[Math.min(N.length-1,F+1)])==null||he.focus()):T.key.toLowerCase()==="p"&&(T.preventDefault(),n.pin(W))}E.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let _=(N,F)=>{let W=document.createElement("button");return W.className="tab"+(le===F?" on":""),W.type="button",W.textContent=N,W.setAttribute("role","tab"),W.setAttribute("aria-selected",String(le===F)),W.addEventListener("click",()=>{le=F,Ve()}),W};b.appendChild(_(c.allTab,null));for(let N of T)b.appendChild(_(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ce,Ae,Re,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let _=(Ae=(Ce=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ce.call(he,".row"))==null?void 0:Ae.dataset.id,N=[...new Set(T.messages.map(ke=>ke.category))].sort();me(N);let F=le?T.messages.filter(ke=>ke.category===le):T.messages,W=o==="dropdown"?Math.max(1,(Re=e.maxItems)!=null?Re:5):1/0,re=F.length>W?F.slice(0,W):F;if(E.textContent="",!re.length){E.appendChild(H()),w.textContent=c.emptyAnnounce,O&&(O=!1,y.focus());return}let ge=ee("div","list");ge.setAttribute("role","list");for(let ke of re)ge.appendChild(K(ke));E.appendChild(ge),w.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=E.querySelector(".row"))!=null?Je:y).focus()):_&&((st=E.querySelector(`.row[data-id="${_}"]`))==null||st.focus())}let Ue=!1;function Ve(){Ue||(Ue=!0,queueMicrotask(()=>{Ue=!1,se()}))}return{open:ne,close:J,destroy(){Se(),m.removeEventListener("keydown",ce),E.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Zm(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var qS,HS,$S,zS,ya=k(()=>{"use strict";$();ga();qS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z"/></svg>',HS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',$S='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',zS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>'});var eh={};L(eh,{InboxStore:()=>pn,NOOP_STORE:()=>va});function KS(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(jS+n,1);t.onupgradeneeded=()=>{let r=t.result;r.objectStoreNames.contains(ze)||r.createObjectStore(ze,{keyPath:"id"}),r.objectStoreNames.contains(nt)||r.createObjectStore(nt)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}var jS,ze,nt,pn,va,wa=k(()=>{"use strict";jS="scalebun_inbox_",ze="messages",nt="meta";pn=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=KS(this.scope)),this.dbp}async hydrate(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(ze,"readonly").objectStore(ze).getAll();r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}put(e){return this.putMany([e])}async putMany(e){if(!e.length)return;let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite"),i=s.objectStore(ze);for(let o of e)i.put(o);s.oncomplete=()=>r(),s.onerror=()=>r(),s.onabort=()=>r()}catch{r()}})}async remove(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite");s.objectStore(ze).delete(e),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async getMeta(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(nt,"readonly").objectStore(nt).get(e);s.onsuccess=()=>r(s.result),s.onerror=()=>r(void 0)}catch{r(void 0)}})}async setMeta(e,t){let r=await this.db();if(r)return new Promise(s=>{try{let i=r.transaction(nt,"readwrite");i.objectStore(nt).put(t,e),i.oncomplete=()=>s(),i.onerror=()=>s()}catch{s()}})}async clear(){let e=await this.db();if(e)return new Promise(t=>{try{let r=e.transaction([ze,nt],"readwrite");r.objectStore(ze).clear(),r.objectStore(nt).clear(),r.oncomplete=()=>t(),r.onerror=()=>t()}catch{t()}})}},va={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var th={};L(th,{InboxSync:()=>xa,InboxTransport:()=>Sa,mergeMessage:()=>ka,stateRank:()=>YS});function ka(n,e){var a,c,l,u,d;if(!n)return e;let t=n;if(e.revision>n.revision){let p={...n},f=e;for(let m of XS)p[m]=f[m];t=p}let r=(a=n.stateAt)!=null?a:0,s=(c=e.stateAt)!=null?c:0;n.state==="deleted"||e.state==="deleted"?t={...t,state:"deleted",stateAt:Math.max(r,s),deletedAt:(l=n.deletedAt)!=null?l:e.deletedAt}:s>=r?t={...t,state:e.state,stateAt:s,readAt:e.readAt,archivedAt:e.archivedAt}:t={...t,state:n.state,stateAt:r};let i=(u=n.pinnedAt)!=null?u:0,o=(d=e.pinnedAt)!=null?d:0;return t={...t,pinned:o>=i?e.pinned:n.pinned,pinnedAt:Math.max(i,o)||void 0},t}function YS(n){return GS[n]}var GS,XS,xa,Sa,Ea=k(()=>{"use strict";Rn();GS={unread:0,read:1,archived:2,deleted:3},XS=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];xa=class{constructor(e){this.deps=e;this.cursor=null;this.cursorLoaded=!1;this.inflight=null}sync(){return this.inflight?this.inflight:(this.inflight=this.run().finally(()=>{this.inflight=null}),this.inflight)}async run(){var e,t,r,s,i;this.deps.onStatus("syncing");try{this.cursorLoaded||(this.cursor=(e=await this.deps.store.getMeta("cursor"))!=null?e:null,this.cursorLoaded=!0);let o=this.deps.runtime.collectDirtyOps(),a=new Map(o.map(u=>[u.id,{stateAt:u.stateAt,pinnedAt:u.pinnedAt}])),c={cursor:this.cursor,ops:o},l=await this.deps.transport.sync(c);if(!l){this.deps.onStatus(ot()?"error":"offline");return}l.theme&&((r=(t=this.deps).onTheme)==null||r.call(t,l.theme)),this.deps.runtime.applyServerDelta((s=l.messages)!=null?s:[],(i=l.tombstones)!=null?i:[],l.unreadCount),this.deps.runtime.ackDirty(a),l.cursor!==void 0&&(this.cursor=l.cursor,await this.deps.store.setMeta("cursor",l.cursor)),this.deps.onStatus("idle")}catch{this.deps.onStatus(ot()?"error":"offline")}}},Sa=class{constructor(e,t,r){this.apiBaseUrl=e;this.clientKey=t;this.deviceId=r}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async sync(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/inbox/sync`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},body:JSON.stringify({schemaVersion:1,deviceId:this.deviceId,...e}),keepalive:!0});return t.ok?await t.json():null}catch{return null}}}});var sh={};L(sh,{InboxRuntime:()=>Ia});function rh(n){return`${n.createdAt}_${n.id}`}var nh,JS,Ia,ih=k(()=>{"use strict";ga();wa();Ea();nh={unread:0,read:1,archived:2,deleted:3},JS=20;Ia=class{constructor(e){this.deps=e;this.mem=new Map;this.unread=0;this.ctaSubs=new Set;this.syncStatus="idle";var t;this.store=(t=e.store)!=null?t:e.scope?new pn(e.scope):va}async hydrate(){let e=await this.store.hydrate(),t=this.unread;for(let r of e)this.mem.has(r.id)||(this.mem.set(r.id,r),r.state==="unread"&&t++);this.unread=t,this.emitState()}getState(){let e=0;for(let t of this.mem.values())t.state!=="deleted"&&e++;return{unreadCount:this.unread,total:e,syncStatus:this.syncStatus}}emitState(){this.deps.onState(this.getState())}setSyncStatus(e){e!==this.syncStatus&&(this.syncStatus=e,this.emitState())}stamp(e){let t=this.deps.replayCoord();return t?{...e,replayCoord:t}:e}async ingest(e){var r;let t=[];for(let s of e){let i=this.mem.get(s.id);if(i){if(s.revision<=i.revision)continue;let a={...s,state:i.state,pinned:i.pinned,seenAt:i.seenAt,readAt:i.readAt,archivedAt:i.archivedAt,deletedAt:i.deletedAt};this.mem.set(s.id,a),t.push(a);continue}let o={...s,state:(r=s.state)!=null?r:"unread",pinned:!!s.pinned};this.mem.set(o.id,o),t.push(o),o.state==="unread"&&this.unread++,this.deps.trackEvent(we.received,this.stamp({messageId:o.id,campaignId:o.campaignId,category:o.category,priority:o.priority}))}t.length&&(this.emitUnreadAnd(),await this.store.putMany(t))}emitUnreadAnd(e){e!=null&&e!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-e})),this.emitState()}transition(e,t,r){let s=this.mem.get(e);if(!s)return;if(!(r!=null&&r.allowRegress)&&nh[t]<=nh[s.state])return s;let i=this.unread,o=s.state==="unread";s.state=t;let a=this.deps.now();s.stateAt=a,s._dirty=!0,t==="read"?s.readAt=a:t==="archived"?s.archivedAt=a:t==="deleted"?s.deletedAt=a:t==="unread"&&(s.readAt=void 0);let c=s.state==="unread";return o&&!c?this.unread--:!o&&c&&this.unread++,this.emitUnreadAnd(i),s}async markRead(e){let t=this.transition(e,"read");t&&(this.deps.trackEvent(we.read,this.stamp({messageId:e,category:t.category,priority:t.priority})),await this.store.put(t))}async markUnread(e){let t=this.mem.get(e);t&&t.state==="read"&&(this.transition(e,"unread",{allowRegress:!0}),await this.store.put(t))}async markReadByCampaign(e){for(let t of this.mem.values())if(t.campaignId===e&&t.state==="unread"){await this.markRead(t.id);return}}async markAllRead(e){let t=this.unread,r=[];for(let s of this.mem.values())s.state==="unread"&&(!e||s.category===e)&&(s.state="read",s.readAt=this.deps.now(),this.unread--,r.push(s));this.emitUnreadAnd(t),await this.store.putMany(r)}async archive(e){let t=this.transition(e,"archived");t&&(this.deps.trackEvent(we.archived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async unarchive(e){let t=this.mem.get(e);t&&t.state==="archived"&&(this.transition(e,"read",{allowRegress:!0}),this.deps.trackEvent(we.unarchived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async pin(e,t=!0){let r=this.mem.get(e);!r||r.pinned===t||(r.pinned=t,r.pinnedAt=this.deps.now(),r._dirty=!0,this.deps.trackEvent(t?we.pinned:we.unpinned,this.stamp({messageId:e,category:r.category})),this.emitState(),await this.store.put(r))}async remove(e){let t=this.mem.get(e);if(!t||t.state==="deleted")return;let r=t.state==="unread";this.transition(e,"deleted",{allowRegress:!0}),this.deps.trackEvent(we.deleted,this.stamp({messageId:e,category:t.category,wasUnread:r})),await this.store.put(t)}onCtaAction(e){return this.ctaSubs.add(e),()=>this.ctaSubs.delete(e)}act(e,t){var i;let r=this.mem.get(e),s=(i=r==null?void 0:r.cta)==null?void 0:i.find(o=>o.key===t);if(!(!r||!s)){if(this.deps.trackEvent(we.cta,this.stamp({messageId:e,ctaKey:t,action:s.action,url:s.url})),s.action==="link"&&s.url&&/^https?:\/\//i.test(s.url))try{window.open(s.url,"_blank","noopener")}catch{}else if(s.action==="deep"||s.action==="custom")for(let o of this.ctaSubs)try{o(e,s)}catch{}r.state==="unread"&&this.markRead(e)}}async get(e){let t=this.mem.get(e);return t&&t.state!=="deleted"?t:void 0}async query(e={}){var c;let t=e.state==null?null:new Set(Array.isArray(e.state)?e.state:[e.state]),r=[...this.mem.values()].filter(l=>!((t?!t.has(l.state):l.state==="deleted"||l.state==="archived")||e.category&&l.category!==e.category||e.pinned!=null&&l.pinned!==e.pinned));if(r.sort((l,u)=>l.pinned!==u.pinned?l.pinned?-1:1:e.sort==="priority"&&l.priority!==u.priority?u.priority-l.priority:u.createdAt-l.createdAt||(l.id<u.id?1:-1)),e.cursor){let l=r.findIndex(u=>rh(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:JS,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?rh(a):null,hasMore:o}}async markSeen(e){let t=this.deps.now(),r=[];for(let s of e){let i=this.mem.get(s);i&&i.seenAt==null&&(i.seenAt=t,r.push(i),this.deps.trackEvent(we.seen,this.stamp({messageId:s,category:i.category})))}await this.store.putMany(r)}async sweepExpired(){let e=this.deps.now(),t=this.unread,r=[];for(let s of this.mem.values())if(s.expiresAt&&s.expiresAt<=e&&s.priority<3&&s.state!=="archived"&&s.state!=="deleted"){let i=s.state==="unread";s.state="archived",s.archivedAt=e,r.push(s),i&&this.unread--,this.deps.trackEvent(we.expired,this.stamp({messageId:s.id,category:s.category,wasUnread:i}))}this.emitUnreadAnd(t),await this.store.putMany(r)}recountUnread(){let e=0;for(let t of this.mem.values())t.state==="unread"&&e++;this.unread=e}collectDirtyOps(){var t;let e=[];for(let r of this.mem.values())r._dirty&&e.push({id:r.id,state:r.state,pinned:r.pinned,stateAt:(t=r.stateAt)!=null?t:0,pinnedAt:r.pinnedAt});return e}applyServerDelta(e,t,r){let s=[];for(let a of e){let c=this.mem.get(a.id),l=ka(c,a);l._dirty=c==null?void 0:c._dirty,this.mem.set(a.id,l),s.push(l),c||this.deps.trackEvent(we.received,this.stamp({messageId:l.id,campaignId:l.campaignId,category:l.category,priority:l.priority}))}let i=this.deps.now();for(let a of t){let c=this.mem.get(a);c&&c.state!=="deleted"&&(c.state="deleted",c.deletedAt=i,c.stateAt=i,s.push(c))}let o=this.unread;this.recountUnread(),typeof r=="number"&&(this.unread=r),o!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-o})),this.emitState(),this.store.putMany(s)}ackDirty(e){var r,s;let t=[];for(let[i,o]of e){let a=this.mem.get(i);a&&a._dirty&&((r=a.stateAt)!=null?r:0)===o.stateAt&&((s=a.pinnedAt)!=null?s:void 0)===o.pinnedAt&&(a._dirty=!1,t.push(a))}this.store.putMany(t)}dispose(){this.mem.clear(),this.ctaSubs.clear(),this.unread=0}}});var ah={};L(ah,{InboxFeature:()=>Ca});var oh,Ca,ch=k(()=>{"use strict";$();oh={unreadCount:0,total:0,syncStatus:"idle"},Ca=class{constructor(){this.name="inbox";this.ctx=null;this.active=!1;this.stateSubs=new Set;this.unreadSubs=new Set;this.pendingCta=new Set;this.lastState=oh;this.controllerRef=null;this.pushState=e=>{let t=this.lastState.unreadCount;this.lastState=e;for(let r of this.stateSubs)try{r(e)}catch{}if(e.unreadCount!==t)for(let r of this.unreadSubs)try{r(e.unreadCount)}catch{}}}get isActive(){return this.active}setup(e){this.ctx=e,typeof window!="undefined"&&(this.active=!0,this.onVisible=()=>{document.visibilityState==="visible"&&this.triggerSync()},this.onAttention=()=>this.triggerSync(),document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("focus",this.onAttention),window.addEventListener("online",this.onAttention),"serviceWorker"in navigator&&(this.onSwMessage=t=>{var s;let r=t.data;if((r==null?void 0:r.type)==="scalebun-inbox-sync"){this.refreshNow();return}if((r==null?void 0:r.type)==="scalebun-push-click"&&((s=r.data)!=null&&s.scalebunCampaignId)){let i=r.data.scalebunCampaignId;this.ensureRuntime().then(o=>o==null?void 0:o.markReadByCampaign(i))}},navigator.serviceWorker.addEventListener("message",this.onSwMessage)))}triggerSync(){this.active&&this.syncEngine&&this.syncEngine.sync()}applyTheme(e){var r;JSON.stringify(e)!==JSON.stringify((r=this.remoteTheme)!=null?r:null)&&(this.remoteTheme=e,this.widget&&Promise.resolve().then(()=>(ya(),ba)).then(({mountInbox:s})=>{var i,o;(i=this.widget)==null||i.destroy(),this.widget=s(this.controller(),(o=this.mountOpts)!=null?o:{},this.remoteTheme)}))}refreshNow(){return this.active?this.ensureRuntime().then(()=>{var e;(e=this.syncEngine)==null||e.sync()}):Promise.resolve()}ensureRuntime(){return this.runtime?Promise.resolve(this.runtime):this.ctx?this.loading?this.loading:(this.loading=(async()=>{var c,l,u,d,p,f,m;let[{InboxRuntime:e},{InboxStore:t}]=await Promise.all([Promise.resolve().then(()=>(ih(),sh)),Promise.resolve().then(()=>(wa(),eh))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var x;return(x=this.ctx)==null?void 0:x.trackEvent(h,g)},replayCoord:Z,now:P,onState:this.pushState,store:r});this.runtime=s;for(let h of this.pendingCta)s.onCtaAction(h);this.pendingCta.clear(),await s.hydrate();let{InboxSync:i,InboxTransport:o}=await Promise.resolve().then(()=>(Ea(),th)),a=new o((u=(l=this.ctx)==null?void 0:l.apiBaseUrl)!=null?u:"",(p=(d=this.ctx)==null?void 0:d.clientKey)!=null?p:"",(m=(f=this.ctx)==null?void 0:f.deviceId)!=null?m:"anon");return this.syncEngine=new i({transport:a,store:r,runtime:s,onStatus:h=>s.setSyncStatus(h),onTheme:h=>this.applyTheme(h)}),this.syncEngine.sync(),s})(),this.loading):Promise.resolve(void 0)}call(e,...t){return this.ensureRuntime().then(r=>{var s;(s=r==null?void 0:r[e])==null||s.call(r,...t)})}controller(){return this.controllerRef?this.controllerRef:(this.controllerRef={subscribe:e=>(this.stateSubs.add(e),e(this.lastState),this.ensureRuntime(),()=>this.stateSubs.delete(e)),onUnreadChange:e=>(this.unreadSubs.add(e),e(this.lastState.unreadCount),this.ensureRuntime(),()=>this.unreadSubs.delete(e)),getState:()=>this.lastState,query:e=>this.ensureRuntime().then(t=>t?t.query(e):{messages:[],cursor:null,hasMore:!1}),get:e=>this.ensureRuntime().then(t=>t==null?void 0:t.get(e)),markRead:e=>this.call("markRead",e),markUnread:e=>this.call("markUnread",e),markAllRead:e=>this.call("markAllRead",e),archive:e=>this.call("archive",e),unarchive:e=>this.call("unarchive",e),pin:(e,t)=>this.call("pin",e,t),remove:e=>this.call("remove",e),ingest:e=>this.call("ingest",e),act:(e,t)=>{this.call("act",e,t)},mount:e=>{typeof document!="undefined"&&this.ensureRuntime().then(async()=>{var r;let{mountInbox:t}=await Promise.resolve().then(()=>(ya(),ba));(r=this.widget)==null||r.destroy(),this.mountOpts=e!=null?e:{},this.widget=t(this.controller(),this.mountOpts,this.remoteTheme)})},open:()=>{var e;return(e=this.widget)==null?void 0:e.open()},close:()=>{var e;return(e=this.widget)==null?void 0:e.close()},unmount:()=>{var e;(e=this.widget)==null||e.destroy(),this.widget=void 0},onCtaAction:e=>this.runtime?this.runtime.onCtaAction(e):(this.pendingCta.add(e),this.ensureRuntime(),()=>{this.pendingCta.delete(e)}),refresh:()=>this.ensureRuntime().then(()=>{var e;return(e=this.syncEngine)==null?void 0:e.sync()})},this.controllerRef)}teardown(){var e,t;typeof window!="undefined"&&(this.onVisible&&document.removeEventListener("visibilitychange",this.onVisible),this.onAttention&&(window.removeEventListener("focus",this.onAttention),window.removeEventListener("online",this.onAttention)),this.onSwMessage&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",this.onSwMessage)),this.onVisible=void 0,this.onAttention=void 0,this.onSwMessage=void 0,(e=this.widget)==null||e.destroy(),this.widget=void 0,(t=this.runtime)==null||t.dispose(),this.runtime=void 0,this.syncEngine=void 0,this.loading=void 0,this.stateSubs.clear(),this.unreadSubs.clear(),this.pendingCta.clear(),this.lastState=oh,this.active=!1}}});var lh={};L(lh,{ProfilerFeature:()=>Aa});function QS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Aa,dh=k(()=>{"use strict";$();Aa=class{constructor(){this.name="profiler";this.ctx=null;this.active=!1;this.startedAt=0}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}available(){return typeof window!="undefined"&&typeof window.Profiler=="function"}start(e=10){if(!this.active||this.profiler||!this.available())return!1;try{let t=window.Profiler;return this.profiler=new t({sampleInterval:e,maxBufferSize:1e4}),this.startedAt=P(),!0}catch{return this.profiler=void 0,!1}}async stop(){var t;if(!this.profiler)return!1;let e=this.profiler;this.profiler=void 0;try{let r=await e.stop(),s=Math.round(P()-this.startedAt);return(t=this.ctx)==null||t.emit({kind:"performance",metric:"js_profile",value:Array.isArray(r.samples)?r.samples.length:0,duration:s,screenName:QS(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${q()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}}});function Ra(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function uh(n,e=10){if(!Ra())return null;try{let t=window.Profiler,r=new t({sampleInterval:e,maxBufferSize:1e4});await new Promise(o=>setTimeout(o,n));let s=await r.stop(),i=Array.isArray(s==null?void 0:s.samples)?s.samples.length:0;return{profile:s,samples:i}}catch{return null}}var ph=k(()=>{"use strict"});function gh(n){return n?{...fh,...n}:fh}var fh,mh,hh,Ta=k(()=>{"use strict";fh={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},mh=10*6e4,hh=10});function ZS(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var Cs,Is,bh=k(()=>{"use strict";Ta();Cs=class Cs{constructor(e){this.lag=[];this.pressure="nominal";this.pressureSince=0;this.jankAt=[];this.highSlopeStreak=0;this.memTrend=[];this.lastEmit=new Map;this.emitTimes=[];this.droppedCount=0;this.deps=e,this.th=e.thresholds}get dropped(){return this.droppedCount}onHeartbeat(e){this.lag.push(e),this.lag.length>Cs.LAG_RING&&this.lag.shift(),e>=this.th.mainThreadStallMs&&this.emit({type:"main_thread_stall",severity:e>=2e3?"critical":"warning",confidence:"high",tier:"lag-proxy",value:Math.round(e),likelyCause:"main thread blocked",description:`The main thread was blocked for ${Math.round(e)} ms.`}),this.evaluateCpu()}onPressure(e){e!==this.pressure&&(this.pressure=e,this.pressureSince=this.deps.now(),this.evaluateCpu())}onJank(e){var s,i;let t=this.deps.now();e.frameDurationMs>=this.th.frozenFrameMs&&this.emit({type:"frozen_frame",severity:e.frameDurationMs>=2e3?"critical":"warning",confidence:"high",tier:e.metric,value:Math.round(e.frameDurationMs),script:e.script,likelyCause:(s=e.script)!=null&&s.url?`long frame in ${e.script.url}`:"long animation frame",description:`A single frame took ${Math.round(e.frameDurationMs)} ms.`}),this.jankAt.push(t);let r=t-this.th.jankWindowMs;for(;this.jankAt.length&&this.jankAt[0]<r;)this.jankAt.shift();this.jankAt.length>=this.th.jankBurstCount&&this.emit({type:"jank_burst",severity:"warning",confidence:"medium",tier:e.metric,value:this.jankAt.length,script:e.script,likelyCause:(i=e.script)!=null&&i.url?`repeated jank in ${e.script.url}`:"repeated main-thread jank",description:`${this.jankAt.length} janky frames within ${Math.round(this.th.jankWindowMs/1e3)} s.`})}onMemory(e,t){let r=this.deps.now();if(t>0&&e/t>=this.th.heapUsedRatio&&this.emit({type:"low_memory_pressure",severity:"critical",confidence:"high",tier:"memory",value:Math.round(e/t*100),likelyCause:"JS heap near its limit",description:`Used heap is ${Math.round(e/t*100)}% of the limit.`}),this.prevMem){let s=(r-this.prevMem.at)/1e3,i=s>0?(e-this.prevMem.used)/s:0;i>this.th.memSurgeBytesPerSec?(this.highSlopeStreak++,this.highSlopeStreak>=2&&this.emit({type:"memory_surge",severity:i>2*this.th.memSurgeBytesPerSec?"critical":"warning",confidence:"medium",tier:"memory",value:Math.round(i),likelyCause:"rapid heap allocation",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB/s.`})):this.highSlopeStreak=0}if(this.prevMem={used:e,at:r},this.memTrend.push(e),this.memTrend.length>this.th.leakSamples&&this.memTrend.shift(),this.memTrend.length===this.th.leakSamples){let s=!0;for(let o=1;o<this.memTrend.length;o++)if(this.memTrend[o]<this.memTrend[o-1]){s=!1;break}let i=this.memTrend[this.memTrend.length-1]-this.memTrend[0];s&&i>=this.th.leakMinBytes&&this.emit({type:"memory_leak_suspicion",severity:"warning",confidence:"low",tier:"memory",value:Math.round(i),likelyCause:"monotonic heap growth",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB over ${this.memTrend.length} samples without release.`})}}evaluateCpu(){if(this.deps.pressureAvailable){this.pressure==="critical"&&this.deps.now()-this.pressureSince>=this.th.pressureSustainMs&&this.emit({type:"cpu_spike",severity:"critical",confidence:"high",tier:"pressure",likelyCause:"sustained CPU pressure",description:`CPU stayed under critical pressure for ${Math.round(this.th.pressureSustainMs/1e3)}s+.`});return}if(this.lag.length<6)return;let e=ZS([...this.lag].sort((t,r)=>t-r));e>this.th.lagP95Ms&&this.emit({type:"cpu_spike",severity:e>2*this.th.lagP95Ms?"critical":"warning",confidence:"medium",tier:"lag-proxy",value:Math.round(e),likelyCause:"sustained event-loop lag",description:`Event-loop lag p95 was ${Math.round(e)} ms.`})}emit(e){var r;let t=this.deps.now();if(!(t-((r=this.lastEmit.get(e.type))!=null?r:-1/0)<this.th.cooldownMs)){if(this.emitTimes=this.emitTimes.filter(s=>t-s<mh),this.emitTimes.length>=hh){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};Cs.LAG_RING=32;Is=Cs});function yh(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var As,vh=k(()=>{"use strict";$();As=class{constructor(){this.lags=[];this.pressureCounts={nominal:0,fair:0,serious:0,critical:0};this.sawPressure=!1;this.memFirstAt=0;this.memLastAt=0;this.incidents=0}onHeartbeat(e){this.lags.push(e)}onPressure(e){this.pressureCounts[e]++,this.sawPressure=!0}onMemory(e){let t=P();this.memFirst==null&&(this.memFirst=e,this.memFirstAt=t),this.memLast=e,this.memLastAt=t}noteIncident(){this.incidents++}drain(e,t){let r=[...this.lags].sort((i,o)=>i-o),s={lagP50:Math.round(yh(r,.5)),lagP95:Math.round(yh(r,.95)),lagMax:r.length?Math.round(r[r.length-1]):0,heartbeats:this.lags.length,incidents:this.incidents,droppedIncidents:t,tiers:e};if(this.sawPressure&&(s.pressure={...this.pressureCounts}),this.memLast!=null&&this.memFirst!=null){let i=(this.memLastAt-this.memFirstAt)/1e3;s.heap={firstBytes:this.memFirst,lastBytes:this.memLast,slopeBytesPerSec:i>0?Math.round((this.memLast-this.memFirst)/i):0}}return this.lags=[],this.pressureCounts={nominal:0,fair:0,serious:0,critical:0},this.sawPressure=!1,this.incidents=0,this.memLast!=null&&(this.memFirst=this.memLast,this.memFirstAt=P()),s}}});function wh(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function xh(n,e){var d;let t=[],r=P(),s,i=()=>{let p=P(),f=p-r-e.heartbeatMs;r=p,f>=0&&n.onHeartbeat(f),s=setTimeout(i,e.heartbeatMs)},o=()=>{r=P(),s=setTimeout(i,e.heartbeatMs)},a=()=>{s&&clearTimeout(s),s=void 0},c=()=>{wh()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),wh()&&o(),t.push(a);let l=!1;try{let p=globalThis.PressureObserver;if(typeof p=="function"){l=!0;let f=new p(m=>{let h=m[m.length-1];h!=null&&h.state&&n.onPressure(h.state)});f.observe("cpu",{sampleInterval:2e3}).catch(()=>{}),t.push(()=>{try{f.disconnect()}catch{}})}}catch{l=!1}let u=typeof performance!="undefined"&&typeof((d=performance.memory)==null?void 0:d.usedJSHeapSize)=="number";if(u){let p=()=>{var h;let m=performance.memory;m&&typeof m.usedJSHeapSize=="number"&&n.onMemory(m.usedJSHeapSize,(h=m.jsHeapSizeLimit)!=null?h:0)};p();let f=setInterval(p,e.memorySampleMs);t.push(()=>clearInterval(f))}return{stop:()=>{for(let p of t)try{p()}catch{}},pressureAvailable:l,memoryAvailable:u}}var Sh=k(()=>{"use strict";$()});var kh={};L(kh,{startWatchdog:()=>ik});function tk(n,e){let t=e!=null?e:1;return t>=1?!0:t<=0?!1:Ee(`${n!=null?n:""}:wzb-watchdog-v1`)%100<t*100}function nk(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function ik(n){var x,v,y,b;let e=(x=n.watchdogOptions)!=null?x:{};if(!tk(n.sessionId,e.sampleRate))return ek;let t=(E,w,I,S)=>{let C=Z();n.emit({kind:"performance",metric:E,value:w,screenName:nk(),metadata:C?{...I,replay:C}:I,clientId:S!=null?S:`wd_${q()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=E=>{if(!r||s||!Ra())return;let w=P();w-i<sk||(i=w,s=!0,uh(rk).then(I=>{I&&t("js_profile",I.samples,{profile:I.profile,format:"w3c-js-self-profiling",incidentClientId:E})}).finally(()=>{s=!1}))},a=gh(e.thresholds),c=new As,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new Is({thresholds:a,now:P,pressureAvailable:d,onIncident:E=>{var I;l++,c.noteIncident();let w=`wd_${q()}`;t("resource_incident",(I=E.value)!=null?I:1,E,w),n.signal("resource_pressure"),o(w)}}),f=Cd(E=>p.onJank(E)),m=xh({onHeartbeat:E=>{p.onHeartbeat(E),c.onHeartbeat(E)},onPressure:E=>{p.onPressure(E),c.onPressure(E)},onMemory:(E,w)=>{p.onMemory(E,w),c.onMemory(E)}},{heartbeatMs:Math.max(250,(v=e.heartbeatMs)!=null?v:1e3),memorySampleMs:(y=e.memorySampleMs)!=null?y:2e4}),h=()=>({pressure:d,memory:m.memoryAvailable}),g=setInterval(()=>{u++;let E=c.drain(h(),p.dropped);t("resource_health",E.lagP95,E)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var ek,rk,sk,Eh=k(()=>{"use strict";$();Fe();Ci();ph();bh();vh();Sh();Ta();ek={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};rk=1e4,sk=6e4});var Ih={};L(Ih,{WatchdogFeature:()=>Ma});var ok,Ma,Ch=k(()=>{"use strict";ok={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},Ma=class{constructor(){this.name="watchdog";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startWatchdog:t}=await Promise.resolve().then(()=>(Eh(),kh));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:ok}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}}});function ak(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function ck(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var Ah,Pa,Rs,Rh=k(()=>{"use strict";Ah="scalebun_inapp_outbox";Pa=class{constructor(e,t=ck()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=ak((s=(r=this.storage)==null?void 0:r.getItem(Ah))!=null?s:null)}enqueue(e){this.queue.some(t=>t.id===e.id)||(this.queue.push(e),this.queue.length>200&&this.queue.splice(0,this.queue.length-200),this.persist(),this.schedule())}get size(){return this.queue.length}schedule(){this.timer||this.flushing||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},800))}async flush(){if(!(this.flushing||this.queue.length===0)){this.flushing=!0;try{for(;this.queue.length>0;){let e=this.queue.slice(0,50);if(!await this.post(e))break;let r=new Set(e.map(s=>s.id));this.queue=this.queue.filter(s=>!r.has(s.id)),this.persist()}}finally{this.flushing=!1,this.queue.length>0&&this.schedule()}}}persist(){var e;try{(e=this.storage)==null||e.setItem(Ah,JSON.stringify(this.queue))}catch{}}};Rs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Pa(r=>this.postEvents(r))}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;for(let[r,s]of Object.entries(e))s&&t.set(r,String(s));try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}async postEvents(e){if(!this.usable||e.length===0)return!1;try{return(await fetch(`${this.apiBaseUrl}/sdk/engage/events`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,source:"inapp",events:e}),keepalive:!0})).ok}catch{return!1}}}});function lk(n){let e="";for(let t=0;t<n.length;t++){let r=n[t];r==="*"?n[t+1]==="*"?(e+=".*",t++):e+="[^/]*":"\\^$.|?+()[]{}".includes(r)?e+="\\"+r:e+=r}return new RegExp("^"+e+"$")}function La(n,e){return!n||n.length===0?!0:n.some(t=>lk(t).test(e))}function dk(n,e){var r;if(!n)return!0;let t=(r=e.queryElement)!=null?r:s=>typeof document!="undefined"?!!document.querySelector(s):!1;try{return t(n)}catch{return!1}}function pk(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function fk(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return pk(e).has(t.slice(8).trim());for(let s of uk){let i=t.indexOf(s);if(i>0){let o=t.slice(0,i).trim(),a=t.slice(i+s.length).trim(),c=(r=e==null?void 0:e.attrs)==null?void 0:r[o];if(c===void 0)return!1;let l=Number(c),u=Number(a),d=!Number.isNaN(l)&&!Number.isNaN(u)&&a!=="";switch(s){case"=":return String(c)===a;case"!=":return String(c)!==a;case">":return d&&l>u;case"<":return d&&l<u;case">=":return d&&l>=u;case"<=":return d&&l<=u}}}return!1}function mk(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>fk(t,e))}function Ph(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return La(r.route,e.route)?dk(r.element,e)?r.minViewport!=null&&((i=e.viewportWidth)!=null?i:1/0)<r.minViewport?{eligible:!1,reason:"viewport"}:r.selection&&!e.hasSelection?{eligible:!1,reason:"selection"}:mk(r.audience,e.profile)?t.canShow(n,e.now)?{eligible:!0}:{eligible:!1,reason:"frequency"}:{eligible:!1,reason:"audience"}:{eligible:!1,reason:"element"}:{eligible:!1,reason:"route"}}function gk(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function bk(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}var uk,Th,Mh,hk,Ts,_a=k(()=>{"use strict";os();uk=[">=","<=","!=","=",">","<"];Th="scalebun_inapp_freq",Mh="scalebun_inapp_freq_session",hk=1,Ts=class{constructor(e=gk(),t="",r=bk()){this.storage=e;this.sessionId=t;this.sessionStore=r;this.map=this.load(),this.session=this.loadSession()}loadSession(){var e;try{let t=(e=this.sessionStore)==null?void 0:e.getItem(Mh),r=t?JSON.parse(t):null;if(r&&r.sid===this.sessionId&&r.recs)return{sid:this.sessionId,recs:r.recs}}catch{}return{sid:this.sessionId,recs:{}}}saveSession(){var e;try{(e=this.sessionStore)==null||e.setItem(Mh,JSON.stringify(this.session))}catch{}}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(Th);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(Th,JSON.stringify(this.map))}catch{}}canShow(e,t){var a,c,l;let r=e.frequency,s=this.map[e.id],i=this.session.recs[e.id];if(s!=null&&s.dismissed&&((a=e.dismiss)!=null&&a.persistDismiss||i!=null&&i.dismissed))return!1;let o=(c=r==null?void 0:r.maxImpressionsPerSession)!=null?c:r?0:hk;return o>0&&((l=i==null?void 0:i.n)!=null?l:0)>=o?!1:s?!(r!=null&&r.showOnce&&s.count>0||(r==null?void 0:r.maxImpressions)!=null&&s.count>=r.maxImpressions||(r==null?void 0:r.cooldown)!=null&&t-s.lastShown<r.cooldown):!0}recordImpression(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.n+=1,this.session.recs[e]=s,this.saveSession()}recordDismiss(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.dismissed=!0,this.session.recs[e]=s,this.saveSession()}clear(){this.map={},this.save(),this.session={sid:this.sessionId,recs:{}},this.saveSession()}}});var Lh=k(()=>{"use strict"});function _h(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return La(n.match?[n.match]:void 0,(t=e.value)!=null?t:"");case"event":return n.match==null||n.match===e.value;case"idle":return((r=e.arg)!=null?r:0)>=((s=n.arg)!=null?s:0);case"element":case"hover":case"selection":case"keyboard":case"right-click":return n.match==null||n.match===e.value;default:return!0}}function Oh(){let n=null,e=null,t=()=>typeof location!="undefined"?location.pathname+location.search:"";return{type:"route",start(r){if(typeof window=="undefined"||typeof history=="undefined")return;let s=()=>r.fire({type:"route",value:t()}),i=history.pushState,o=history.replaceState;history.pushState=function(...a){let c=i.apply(this,a);return s(),c},history.replaceState=function(...a){let c=o.apply(this,a);return s(),c},e=s,window.addEventListener("popstate",s),window.addEventListener("hashchange",s),n=()=>{history.pushState=i,history.replaceState=o},s()},stop(){n==null||n(),n=null,e&&typeof window!="undefined"&&(window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)),e=null}}}function Nh(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Bh(){let n=null,e=[],t=[],r=null,s=["mousemove","mousedown","keydown","scroll","touchstart","pointerdown"],i=()=>{for(let a of t)clearTimeout(a);t=[]},o=()=>{if(i(),!!n)for(let a of e)a>0&&t.push(setTimeout(()=>n==null?void 0:n.fire({type:"idle",arg:a}),a))};return{type:"idle",start(a){if(n=a,typeof window!="undefined"){r=o;for(let c of s)window.addEventListener(c,r,{passive:!0});o()}},stop(){if(i(),r&&typeof window!="undefined")for(let a of s)window.removeEventListener(a,r);r=null,n=null},setThresholds(a){e=Array.from(new Set(a.filter(c=>c>0))),o()}}}var Ms,Fh=k(()=>{"use strict";_a();Lh();Ms=class{constructor(e=()=>Date.now()){this.listeners=new Set;this.plugins=[];this.now=e}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}fire(e){var r;let t={...e,at:(r=e.at)!=null?r:this.now()};for(let s of this.listeners)try{s(t)}catch{}}use(e){this.plugins.push(e),e.start(this)}stop(){for(let e of this.plugins)e.stop();this.plugins=[],this.listeners.clear()}}});function wk(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return yk[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=vk[n.category])!=null?s:0)}function qh(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:wk(b,s)})).sort((b,E)=>E.score-b.score||b.c.id.localeCompare(E.c.id)),o=[],a=(b,E,w,I,S)=>o.push({id:b.id,action:E,reason:w,zone:b.zone,score:I,preempts:S}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>Ps(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,x=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:E}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",E);continue}c.set(b.campaignId,E)}let w=(y=r.guard)==null?void 0:y.call(r,b);if(w){a(b,w.action,w.reason,E);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",E);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",E);continue}if((b.zone==="toast"?3:1)===1&&l.has(b.zone)){a(b,b.cost>0?"QUEUE":"DROP",b.cost>0?"queue:zone-busy":"zone-lost",E);continue}if(Ps(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",E);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",E);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",E);continue}if(b.zone==="modal"&&x>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",E);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",E);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",E);continue}}let S;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!Ps(M.zone)&&Dh[M.tier]<Dh.critical);C&&(S=C.id)}a(b,S?"PREEMPT":"SHOW",S?"preempt:critical":"show",E,S),l.set(b.zone,b.id),b.zone==="toast"&&d++,Ps(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&x++,f=!0,v=s)}return o}var yk,vk,Dh,Ps,Hh=k(()=>{"use strict";yk={critical:1e3,high:400,normal:200,low:100,passive:50},vk={security:300,system:250,billing:200},Dh={critical:4,high:3,normal:2,low:1,passive:0};Ps=n=>n==="modal"||n==="takeover"});function xk(n,e={}){switch(n){case"modal":return{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}};case"fullscreen":return{surface:"takeover",surfaceOptions:{size:"full"}};case"bottom_sheet":return{surface:"slideover",surfaceOptions:{placement:"bottom"}};case"top_banner":return{surface:"banner",surfaceOptions:{placement:"top"}};case"bottom_banner":return{surface:"banner",surfaceOptions:{placement:"bottom"}};case"toast":return{surface:"toast",surfaceOptions:{placement:"bottom-right"}};case"tooltip":return e.anchorSelector?{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}:{surface:"toast",surfaceOptions:{placement:"bottom-right"}};default:return{surface:"modal",surfaceOptions:{placement:"center",backdrop:!0}}}}function Sk(n){var s,i;let e=n.spec,t=[];e.imageUrl&&t.push({kind:"image",props:{src:e.imageUrl,alt:(s=e.title)!=null?s:""}}),e.title&&t.push({kind:"heading",props:{text:e.title}}),e.body&&t.push({kind:"text",props:{text:e.body}});let r=[];return e.cta&&r.push({label:e.cta.label,variant:"primary",action:e.cta.action,deepLink:e.cta.deepLink}),e.secondaryCta&&r.push({label:e.secondaryCta.label,variant:"secondary",action:e.secondaryCta.action}),r.length&&t.push({kind:"cta",props:{actions:r}}),t.length===0&&t.push({kind:"text",props:{text:(i=e.body)!=null?i:""}}),t}function kk(n){var t,r,s,i;if(n.preview)return[{type:"manual"}];let e=(r=n.targetScreen)!=null?r:(t=n.triggerConfig)==null?void 0:t.screen;return e?[{type:"route",match:e}]:(s=n.triggerConfig)!=null&&s.event?[{type:"event",match:n.triggerConfig.event}]:(i=n.triggerConfig)!=null&&i.seconds?[{type:"idle",arg:n.triggerConfig.seconds*1e3}]:[{type:"manual"}]}function Ek(n){let e=n.throttle;if(!e)return;let t={};return e.showOnce&&(t.showOnce=!0),e.maxImpressions!=null&&(t.maxImpressions=e.maxImpressions),e.cooldownHours!=null&&(t.cooldown=e.cooldownHours*36e5),Object.keys(t).length?t:void 0}function Ik(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=xk(n.layout,e),s=t==="popover",i=(a=n.targetScreen)!=null?a:(o=n.triggerConfig)==null?void 0:o.screen;return{id:n.id,key:`legacy.${n.layout}.${n.id}`,name:(c=n.spec.title)!=null?c:`Legacy ${n.layout}`,category:"misc",platforms:["web"],surface:t,surfaceOptions:r,blocks:Sk(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:kk(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:Ek(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function $h(n,e={}){return(n!=null?n:[]).map(t=>Ik(t,e))}var zh=k(()=>{"use strict"});function Ck(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Uh(n){var r;let e=Ck(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...$h(n.legacyMessages)),t.filter(Wu)}var Vh=k(()=>{"use strict";zh();$r()});var Wh={};L(Wh,{InAppEngine:()=>Oa});var Ak,Oa,jh=k(()=>{"use strict";Rh();Fh();_a();Hh();Vh();cs();ro();Mo();$r();Fi();Ak=120,Oa=class{constructor(e){this.deps=e;this.host=new ln;this.slots=new Mt;this.variants=[];this.pending=new Map;this.live=new Map;this.tickTimer=null;this.started=!1;var t;this.now=(t=e.now)!=null?t:()=>Date.now(),this.freq=new Ts(void 0,e.sessionId),this.transport=new Rs(e.apiBaseUrl,e.clientKey),this.bus=new Ms(this.now),this.budget={tokens:5,interruptionsThisSession:0,maxInterruptionsPerSession:5,modalsToday:0,maxModalsPerDay:3,lastInterruptionAt:0,minCooldownMs:3e4}}async start(){this.started||(this.started=!0,await this.load())}async onIdentify(){this.started&&await this.load()}async load(){var s,i;let e;try{e=await this.transport.fetchConfig({platform:"web",appVersion:this.deps.appVersion,deviceId:this.deps.deviceId,endUserId:(i=(s=this.deps).userId)==null?void 0:i.call(s),route:this.deps.route()})}catch{return}if(!this.started)return;let t=Bi(e),r=e==null?void 0:e.variants;this.variants=Uh({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(Oh()),this.bus.use(Nh()),this.bus.use(Bh()),this.unsub=this.bus.on(o=>this.onSignal(o))),this.bus.fire({type:"route",value:this.deps.route()}))}fireEvent(e){this.started&&this.bus.fire({type:"event",value:e})}onSignal(e){let t=this.targetingCtx();for(let r of this.variants)this.live.has(r.id)||this.pending.has(r.id)||r.triggers.some(s=>_h(s,e))&&Ph(r,t,this.freq).eligible&&this.pending.set(r.id,this.toCandidate(r));this.pending.size&&this.scheduleTick()}toCandidate(e){let t=e.surface==="coachmark"||e.surface==="tour"||e.surface==="hotspot",r=e.surface==="launcher"||e.surface==="palette";return{id:e.id,zone:Lt(e),focus:oo[e.surface],cost:ao[e.surface],tier:e.priority,category:e.category,triggeredAt:this.now(),guidance:t,interactionOnly:r}}targetingCtx(){var t,r,s,i;let e=typeof window!="undefined"?!!((r=(t=window.getSelection)==null?void 0:t.call(window))!=null&&r.toString()):!1;return{route:this.deps.route(),profile:(i=(s=this.deps).profile)==null?void 0:i.call(s),now:this.now(),viewportWidth:typeof window!="undefined"?window.innerWidth:void 0,hasSelection:e}}scheduleTick(){this.tickTimer||(this.tickTimer=setTimeout(()=>{this.tickTimer=null,this.tick()},Ak))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=qh(e,t,this.budget,{now:this.now()});for(let s of r){let i=this.variants.find(o=>o.id===s.id);i&&(s.action==="SHOW"||s.action==="PREEMPT"?(this.pending.delete(i.id),s.action==="PREEMPT"&&s.preempts&&this.close(s.preempts),await this.show(i)):s.action==="DROP"&&this.pending.delete(i.id))}this.pending.size&&this.scheduleTick()}async show(e){let t=this.now.bind(this),r=(i,o)=>{var c,l;let a={id:`${e.id}:${i}:${t()}`,type:i,variantId:e.id,ts:t(),props:o};this.transport.outbox.enqueue(a),(l=(c=this.deps).onEvent)==null||l.call(c,a)},s={onImpression:()=>{this.freq.recordImpression(e.id,t()),r("impression")},onView:()=>r("view"),onCtaClick:i=>r("cta_click",{action:i}),onInteraction:i=>r("interaction",{name:i}),onDismiss:i=>{this.freq.recordDismiss(e.id,t()),this.live.delete(e.id),r("dismiss",{method:i}),this.scheduleTick()}};try{let i=await To(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Lt(e),focus:oo[e.surface],tier:e.priority},surface:i});let o=ao[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Lt(e)==="modal"&&this.budget.modalsToday++)}catch{this.pending.delete(e.id)}}close(e){let t=this.live.get(e);if(t){try{t.surface.close()}catch{}this.live.delete(e)}}stop(){var e;if(this.started){this.started=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=null),(e=this.unsub)==null||e.call(this),this.bus.stop();for(let t of[...this.live.keys()])this.close(t);this.pending.clear(),this.transport.outbox.flush();try{this.host.destroy()}catch{}}}}});var Kh={};L(Kh,{InApp2Feature:()=>Na});var Na,Gh=k(()=>{"use strict";Na=class{constructor(){this.name="inapp2";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined"||!e.clientKey||!e.apiBaseUrl)return;this.active=!0;let{InAppEngine:t}=await Promise.resolve().then(()=>(jh(),Wh));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,sessionId:e.sessionId,appVersion:e.appVersion,userId:()=>{var r;return(r=e.getUserId)==null?void 0:r.call(e)},route:()=>typeof location!="undefined"?location.pathname+location.search:"",config:{engine:"native"}}),this.engine.start())}fireEvent(e){var t;(t=this.engine)==null||t.fireEvent(e)}onIdentify(){var e;(e=this.engine)==null||e.onIdentify()}teardown(){var e;this.active=!1,(e=this.engine)==null||e.stop(),this.engine=void 0}}});var Zh={};L(Zh,{armSoftAsk:()=>_k});function Jh(){try{let n=Number(localStorage.getItem(Qh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function Pk(n){try{localStorage.setItem(Qh,String(Date.now()+n*864e5))}catch{}}function Lk(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.setAttribute("data-scalebun",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
671
671
  <style>
672
672
  :host{all:initial}
673
673
  .c{width:min(340px,calc(100vw - 32px));box-sizing:border-box;padding:16px 18px;border-radius:14px;
@@ -693,7 +693,7 @@ ${r!=="dropdown"?"":`
693
693
  <button class="no" type="button"></button>
694
694
  <button class="yes" type="button"></button>
695
695
  </div>
696
- </div>`,r.querySelector(".t").textContent=n.title,r.querySelector(".b").textContent=n.body;let s=r.querySelector(".no"),i=r.querySelector(".yes");s.textContent=n.denyText,i.textContent=n.allowText;let o=a=>{t.remove(),e(a)};s.addEventListener("click",()=>o(!1)),i.addEventListener("click",()=>o(!0)),document.body.appendChild(t)})}async function Pk(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||Xh())return;let r={...Rk,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||Xh())return;if(!await Mk(r)){Tk(r.remindAfterDays),(l=e.log)==null||l.call(e,"soft-ask declined \u2014 snoozed");return}let c=await e.enable();(u=e.log)==null||u.call(e,`soft-ask accepted \u2192 enable() = ${c}`),c==="denied"&&((d=e.log)==null||d.call(e,"browser permission denied \u2014 the SDK cannot re-ask"))},i=(o=n.trigger)!=null?o:"immediate";if(i==="immediate")return void s();if(typeof i=="object"&&"afterMs"in i){setTimeout(()=>void s(),Math.max(0,i.afterMs));return}if(typeof i=="object"&&"onSelector"in i){let a=c=>{let l=c.target;l&&l.closest&&l.closest(i.onSelector)&&(document.removeEventListener("click",a,!0),s())};document.addEventListener("click",a,!0)}}var Yh,Rk,Qh=k(()=>{"use strict";Yh="scalebun.push.softAsk.snoozedUntil",Rk={title:"Stay in the loop",body:"Get notified about important updates. You can turn this off any time.",allowText:"Allow notifications",denyText:"Not now",remindAfterDays:7,accent:"#5B4FE0"}});var Zh={};L(Zh,{buildBugReportPayload:()=>_k});function Lk(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function _k(n,e=[],t={}){var s;let r=t.replayCoord;return{clientReportId:`bug_${H()}`,...n.title?{title:j(n.title)}:{},message:j((s=n.message)!=null?s:""),...n.email?{email:n.email}:{},url:Lk(),...e.length?{console:e.slice(-20)}:{},...typeof(r==null?void 0:r.seq)=="number"?{replaySeq:r.seq}:{},...r!=null&&r.segmentId?{replaySegmentId:r.segmentId}:{},timestamp:P()}}var eg=k(()=>{"use strict";$()});function Ok(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Nk(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var Bk,Ls,tg=k(()=>{"use strict";ko();$();Bk=`
696
+ </div>`,r.querySelector(".t").textContent=n.title,r.querySelector(".b").textContent=n.body;let s=r.querySelector(".no"),i=r.querySelector(".yes");s.textContent=n.denyText,i.textContent=n.allowText;let o=a=>{t.remove(),e(a)};s.addEventListener("click",()=>o(!1)),i.addEventListener("click",()=>o(!0)),document.body.appendChild(t)})}async function _k(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||Jh())return;let r={...Mk,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||Jh())return;if(!await Lk(r)){Pk(r.remindAfterDays),(l=e.log)==null||l.call(e,"soft-ask declined \u2014 snoozed");return}let c=await e.enable();(u=e.log)==null||u.call(e,`soft-ask accepted \u2192 enable() = ${c}`),c==="denied"&&((d=e.log)==null||d.call(e,"browser permission denied \u2014 the SDK cannot re-ask"))},i=(o=n.trigger)!=null?o:"immediate";if(i==="immediate")return void s();if(typeof i=="object"&&"afterMs"in i){setTimeout(()=>void s(),Math.max(0,i.afterMs));return}if(typeof i=="object"&&"onSelector"in i){let a=c=>{let l=c.target;l&&l.closest&&l.closest(i.onSelector)&&(document.removeEventListener("click",a,!0),s())};document.addEventListener("click",a,!0)}}var Qh,Mk,eg=k(()=>{"use strict";Qh="scalebun.push.softAsk.snoozedUntil",Mk={title:"Stay in the loop",body:"Get notified about important updates. You can turn this off any time.",allowText:"Allow notifications",denyText:"Not now",remindAfterDays:7,accent:"#5B4FE0"}});var tg={};L(tg,{buildBugReportPayload:()=>Nk});function Ok(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function Nk(n,e=[],t={}){var s;let r=t.replayCoord;return{clientReportId:`bug_${q()}`,...n.title?{title:j(n.title)}:{},message:j((s=n.message)!=null?s:""),...n.email?{email:n.email}:{},url:Ok(),...e.length?{console:e.slice(-20)}:{},...typeof(r==null?void 0:r.seq)=="number"?{replaySeq:r.seq}:{},...r!=null&&r.segmentId?{replaySegmentId:r.segmentId}:{},timestamp:P()}}var ng=k(()=>{"use strict";$()});function Bk(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Fk(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var Dk,Ls,rg=k(()=>{"use strict";ko();$();Dk=`
697
697
  :host{all:initial}
698
698
  *{box-sizing:border-box;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
699
699
  .spot{position:fixed;border-radius:8px;box-shadow:0 0 0 9999px rgba(12,10,20,.55);z-index:2147483600;pointer-events:none;transition:all .2s ease}
@@ -712,6 +712,6 @@ button{font:inherit;cursor:pointer;border-radius:8px;border:none}
712
712
  .back{background:#262131;color:#edeaf2;font-size:12px;font-weight:600;padding:7px 12px}
713
713
  .next{background:#7c6cf0;color:#fff;font-size:12px;font-weight:600;padding:7px 14px}
714
714
  .x{position:absolute;top:10px;right:12px;background:none;color:#9a95a6;font-size:17px;line-height:1;padding:2px}
715
- @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ls=class{constructor(){this.host=null;this.root=null;this.card=null;this.spot=null;this.ctx=null;this.onReflow=()=>this.position()}ensure(){return this.root?this.root:(this.host=document.createElement("div"),this.host.setAttribute("data-scalebun-coach",""),this.host.setAttribute("data-scalebun",""),this.root=this.host.attachShadow({mode:"open"}),Ne(this.root,Bk),document.body.appendChild(this.host),window.addEventListener("scroll",this.onReflow,!0),window.addEventListener("resize",this.onReflow),this.root)}render(e){var d,p;let t=this.ensure();this.ctx=e,[...t.querySelectorAll(".spot,.backdrop,.card")].forEach(f=>f.remove()),this.card=null,this.spot=null;let r=!!e.el&&!e.degraded;if(r)this.spot=document.createElement("div"),this.spot.className="spot",t.appendChild(this.spot);else{let f=document.createElement("div");f.className="backdrop",f.addEventListener("click",()=>e.controls.close()),t.appendChild(f)}let s=document.createElement("div");s.className=r?"card":"card modal",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),e.step.title&&s.setAttribute("aria-label",e.step.title);let i=document.createElement("button");if(i.className="x",i.type="button",i.textContent="\xD7",i.setAttribute("aria-label","Close"),i.addEventListener("click",()=>e.controls.close()),s.appendChild(i),e.step.title){let f=document.createElement("div");f.className="t",f.textContent=e.step.title,s.appendChild(f)}if(e.step.body){let f=document.createElement("div");f.className="b",f.textContent=e.step.body,s.appendChild(f)}let o=document.createElement("div");o.className="ft";let a=document.createElement("span");a.className="count",a.textContent=`${e.index+1} of ${e.total}`;let c=document.createElement("div");c.className="btns";let l=document.createElement("button");if(l.className="skip",l.type="button",l.textContent="Skip",l.addEventListener("click",()=>e.controls.skip()),c.appendChild(l),e.index>0){let f=document.createElement("button");f.className="back",f.type="button",f.textContent="Back",f.addEventListener("click",()=>e.controls.back()),c.appendChild(f)}let u=document.createElement("button");if(u.className="next",u.type="button",u.textContent=e.index+1>=e.total?"Done":"Next",u.addEventListener("click",()=>e.controls.next()),c.appendChild(u),o.append(a,c),s.appendChild(o),r){let f=document.createElement("div");f.className="arrow",s.appendChild(f)}t.appendChild(s),this.card=s,(p=(d=(e.step.title,u)).focus)==null||p.call(d),this.position()}position(){var o;let e=this.ctx;if(!e||!this.card||!e.el||e.degraded)return;let t=Ok(e.el);this.spot&&(this.spot.style.left=`${t.x-6}px`,this.spot.style.top=`${t.y-6}px`,this.spot.style.width=`${t.width+6*2}px`,this.spot.style.height=`${t.height+6*2}px`);let r={width:this.card.offsetWidth||320,height:this.card.offsetHeight||120},s=rs({anchor:t,tooltip:r,boundary:Nk(),preferred:(o=e.step.placement)!=null?o:{side:"bottom",align:"center"}});this.card.style.left=`${s.x}px`,this.card.style.top=`${s.y}px`;let i=this.card.querySelector(".arrow");i&&(i.style.left=s.arrow.y===0||s.arrow.y===r.height?`${s.arrow.x-6}px`:s.placement.side==="left"?`${r.width-6}px`:"-6px",i.style.top=s.arrow.x===0||s.arrow.x===r.width?`${s.arrow.y-6}px`:s.placement.side==="top"?`${r.height-6}px`:"-6px")}hide(){var e;window.removeEventListener("scroll",this.onReflow,!0),window.removeEventListener("resize",this.onReflow),(e=this.host)==null||e.remove(),this.host=null,this.root=null,this.card=null,this.spot=null,this.ctx=null}}});var rg={};L(rg,{CoachmarkFeature:()=>Fa});var ng,Fa,sg=k(()=>{"use strict";ss();tg();Eo();ts();os();ng="scalebun_coach_progress",Fa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ls;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new qt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>is(t,r,s),render:t=>this.renderer.render(t),hide:()=>this.renderer.hide(),emit:(t,r)=>this.emit(t,r),now:()=>Date.now(),persist:(t,r)=>this.persist(t,r),loadIndex:t=>this.loadIndex(t)})}start(e,t){this.reportAnchors(),this.engine.start(e,t)}reportAnchors(){for(let e of rf())this.reportedAnchors.has(e)||(this.reportedAnchors.add(e),this.emit("$coachmark_anchor_seen",{anchorKey:e}))}async fetchTours(e){var s;if(!e&&this.toursCache)return this.toursCache;let{apiBaseUrl:t,clientKey:r}=this.deps;if(!t||!r||typeof fetch=="undefined")return e?[]:this.toursCache=[];try{let i=`${t}/sdk/coach/config${e?`?preview=${encodeURIComponent(e)}`:""}`,o=await fetch(i,{headers:{"x-scalebun-client-key":r},cache:"no-store"});if(!o.ok)return e?[]:this.toursCache=[];let c=(s=(await o.json()).tours)!=null?s:[];return e?c:this.toursCache=c}catch{return e?[]:this.toursCache=[]}}async startById(e,t){let r=(await this.fetchTours(t==null?void 0:t.preview)).find(s=>s.id===e);return r?(this.engine.start(r,t),!0):!1}next(){this.engine.next()}back(){this.engine.back()}skip(){this.engine.skip()}end(){this.engine.end("abandoned","api")}notify(e){this.engine.notify(e)}current(){return this.engine.state}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{var s;(s=this.listeners.get(e))==null||s.delete(t)}}emit(e,t){var o,a;let r=this.deps.replayCoord(),s={...t,...r?{replayCoord:r}:{}};this.deps.trackEvent(e,s);let i={event:e,...s};for(let c of(o=this.listeners.get(e))!=null?o:[])try{c(i)}catch{}for(let c of(a=this.listeners.get("*"))!=null?a:[])try{c(i)}catch{}}progress(){try{return JSON.parse(localStorage.getItem(ng)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(ng,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function _s(n){return n.supported?n.permission==="denied"?n.everSubscribed?"revoked":"blocked":n.permission==="default"?"never-granted":n.hasSubscription?"subscribed":n.everSubscribed?"expired":"never-granted":"unsupported"}var ig,Da=k(()=>{"use strict";ig={subscribed:{title:"Notifications are on",detail:"This browser is registered and can receive push.",actionable:!1},"never-granted":{title:"Not asked yet",detail:"This browser has never been prompted. Ask from a click \u2014 browsers ignore the prompt otherwise.",actionable:!0},blocked:{title:"Blocked in this browser",detail:"Notifications were declined, and the browser will not show the prompt again. Only the person can re-enable it, from the site settings beside the address bar.",actionable:!1},revoked:{title:"Turned off after being enabled",detail:"This browser had notifications and they were switched off. Like blocking, only the person can restore it from the site settings \u2014 but unlike a first refusal, they opted in once, so a reminder in-product is fair.",actionable:!1},expired:{title:"Registration expired",detail:"Permission is still granted but the subscription is gone \u2014 browsers drop them after long inactivity or a data clear. Re-registering fixes it and does NOT prompt.",actionable:!0},unsupported:{title:"Not supported in this browser",detail:"Web push needs a service worker, the Push API and Notifications. This browser is missing at least one.",actionable:!1}}});var qa={};L(qa,{notInitializedReport:()=>zk,runPushDiagnostics:()=>$k});function Fk(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Dk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}function qk(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Hk(n){return new Promise(e=>{let t=n.active;if(!t||typeof MessageChannel=="undefined"){e(null);return}let r=!1,s=i=>{r||(r=!0,e(i))};try{let i=new MessageChannel;i.port1.onmessage=o=>{let a=o.data;s(a&&a.type==="scalebun-sw-pong"?{version:a.version}:null)},t.postMessage({type:"scalebun-sw-ping"},[i.port2]),setTimeout(()=>s(null),1500)}catch{s(null)}})}async function $k(n){var m,h,g,x,v,y,b,E,w;let e=[],t=I=>(e.push(I),I),r=(I,S,C)=>{t({id:I,status:"unknown",label:S,detail:`Not evaluated \u2014 ${C}`})},s=typeof window!="undefined"&&window.isSecureContext===!0;t({id:"secure_context",status:s?"pass":"fail",label:"Secure context (HTTPS)",detail:s?void 0:"Page is not a secure context",fix:s?void 0:"Serve the site over HTTPS. Web Push is unavailable on plain HTTP (localhost is exempt)."});let i=[];(typeof navigator=="undefined"||!("serviceWorker"in navigator))&&i.push("ServiceWorker"),(typeof window=="undefined"||!("PushManager"in window))&&i.push("PushManager"),(typeof window=="undefined"||!("Notification"in window))&&i.push("Notification");let o=i.length===0&&Fk(),a=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"");if(t({id:"api_support",status:o?"pass":"fail",label:"Browser supports Web Push",detail:o?void 0:`Missing: ${i.join(", ")||"push APIs"}`,fix:o?void 0:a?"On iOS, Web Push only works when the site is installed to the Home Screen as a PWA (iOS 16.4+). In a normal Safari tab these APIs are absent.":"This browser cannot receive Web Push. Hide your opt-in UI when ScaleBun.push.check() reports this."}),!o)return r("sw_reachable","Service worker file is reachable","push APIs are unavailable"),r("sw_registered","Service worker is registered","push APIs are unavailable"),r("sw_version","Service worker is up to date","push APIs are unavailable"),r("vapid_configured","Web Push configured for this app","push APIs are unavailable"),r("permission","Notification permission","push APIs are unavailable"),r("subscription_valid","Push subscription is valid","push APIs are unavailable"),r("device_registered","Device registered with ScaleBun","push APIs are unavailable"),r("identified","User is identified","push APIs are unavailable"),og(e);let c=null;try{let I=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=I.ok,t({id:"sw_reachable",status:I.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${I.status}`,fix:I.ok?void 0:`Copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root so it is served at ${n.serviceWorkerUrl}.`})}catch{t({id:"sw_reachable",status:"unknown",label:"Service worker file is reachable",detail:`Could not fetch ${n.serviceWorkerUrl}`,fix:"Check that the file is served from the same origin and not blocked by CSP."})}let l=null;try{l=(m=await navigator.serviceWorker.getRegistration(n.serviceWorkerUrl))!=null?m:null}catch{l=null}let u=(b=(y=(x=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?x:(g=l==null?void 0:l.installing)==null?void 0:g.scriptURL)!=null?y:(v=l==null?void 0:l.waiting)==null?void 0:v.scriptURL)!=null?b:null,d=!!u&&u.indexOf("scalebun-push-sw")>=0;if(t({id:"sw_registered",status:l&&d?"pass":"fail",label:"Service worker is registered",detail:l?d?`Active: ${u}`:`A different worker owns this scope: ${u}`:"No registration found for this scope",fix:l?d?void 0:"Another service worker controls this scope. Serve the ScaleBun worker at a path it can own, and pass serviceWorkerScope to enablePush().":c===!1?"The worker file is missing (see the check above) \u2014 fix that first, then call ScaleBun.enablePush().":"Call ScaleBun.enablePush() from a user gesture to register the worker."}),l&&d){let I=await Hk(l);!I||typeof I.version!="number"?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:"The worker did not answer a version ping",fix:`Your copy of scalebun-push-sw.js is older than v${n.expectedSwVersion} (versions before v3 cannot report themselves). Re-copy it from @scalebun/web/dist/.`}):I.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${I.version}, this SDK expects v${n.expectedSwVersion}`,fix:"Re-copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root \u2014 the deployed copy is stale."}):t({id:"sw_version",status:"pass",label:"Service worker is up to date",detail:`v${I.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),S=I.ok?await I.json():null;p=(S==null?void 0:S.enabled)===!1?null:(E=S==null?void 0:S.vapidPublicKey)!=null?E:null,t({id:"vapid_configured",status:p?"pass":"fail",label:"Web Push configured for this app",detail:p?void 0:"No VAPID key served for this client key",fix:p?void 0:"In the ScaleBun dashboard: Settings \u2192 Integrations \u2192 Web Push (VAPID) \u2192 Generate VAPID keys."})}catch{t({id:"vapid_configured",status:"unknown",label:"Web Push configured for this app",detail:"Could not reach the ScaleBun API",fix:"Check apiBaseUrl, network access, and CORS."})}let f=typeof Notification=="undefined"?"default":Notification.permission;t({id:"permission",status:f==="granted"?"pass":f==="denied"?"fail":"warn",label:"Notification permission",detail:f,fix:f==="granted"?void 0:f==="denied"?"The user blocked notifications. This cannot be re-prompted from code \u2014 they must re-allow it in browser site settings.":"Not asked yet. Call ScaleBun.enablePush() from a click handler."});try{let I=l?await l.pushManager.getSubscription():null;if(!I)t({id:"subscription_valid",status:"fail",label:"Push subscription is valid",detail:"No subscription on this browser",fix:f==="granted"?"Permission is granted but no subscription exists \u2014 call ScaleBun.enablePush() to create one.":"Call ScaleBun.enablePush() from a user gesture."});else{let S=I.toJSON(),C=typeof S.expirationTime=="number"&&S.expirationTime<=Date.now(),M=null;if(p){let A=(w=I.options)==null?void 0:w.applicationServerKey;M=A?qk(new Uint8Array(A),Dk(p)):null}t({id:"subscription_valid",status:C||M===!1?"fail":M===null&&p?"warn":"pass",label:"Push subscription is valid",detail:C?"Subscription has expired":M===!1?"Subscription was created with a DIFFERENT VAPID key than this app now uses":M===null&&p?"Could not read the subscription key to compare against the tenant VAPID key":I.endpoint,fix:C?"Call ScaleBun.enablePush() again to mint a fresh subscription.":M===!1?"The VAPID keypair was rotated after this browser subscribed, so pushes to it will fail. Call ScaleBun.push.disable() then ScaleBun.enablePush() to re-subscribe.":void 0})}}catch{t({id:"subscription_valid",status:"unknown",label:"Push subscription is valid",detail:"Could not read the push subscription"})}try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/device-token/status?deviceId=${encodeURIComponent(n.deviceId)}`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),S=I.ok?await I.json():null;if(!S)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${I.status}`}),r("identified","User is identified","the server did not answer");else{let C=S.tokenStatus==="dead";t({id:"device_registered",status:S.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:S.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:S.registered?C?"The browser push service rejected this token (410 Gone). Call ScaleBun.enablePush() to re-subscribe.":void 0:"Call ScaleBun.enablePush() \u2014 the subscription never reached the backend."}),t({id:"identified",status:S.identified?"pass":"warn",label:"User is identified",detail:S.identified?"Bound to a person":"Anonymous device",fix:S.identified?void 0:"Call ScaleBun.identify() \u2014 journeys and lifecycle programs only target identified people, so this browser can receive broadcasts but never an automated lifecycle push."})}}catch{t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:"Could not reach the ScaleBun API"}),r("identified","User is identified","the server was unreachable")}return og(e)}function zk(){return{ok:!1,blocking:"api_support",checks:[{id:"api_support",status:"fail",label:"ScaleBun is initialized",detail:"push.check() was called before ScaleBun.init()",fix:"Call ScaleBun.init({ clientKey, apiBaseUrl }) first \u2014 diagnostics need the resolved config."}]}}function og(n){var t;let e=n.find(r=>r.status==="fail");return{ok:!e,blocking:(t=e==null?void 0:e.id)!=null?t:null,checks:n}}var Ha=k(()=>{"use strict"});var cg={};L(cg,{DEFAULT_SW_URL:()=>$a,EXPECTED_SW_VERSION:()=>ag,PUSH_STATE_COPY:()=>ig,PushFeature:()=>za,resolvePushState:()=>_s});function Os(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Uk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}var ag,$a,mn,za,lg=k(()=>{"use strict";Da();Da();ag=5,$a="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=$a;this.openedCbs=new Set;this.swMessageBound=!1;this.deps=e}log(...e){var t,r;(r=(t=this.deps).log)==null||r.call(t,"[scalebun:push]",...e)}permission(){return typeof Notification=="undefined"?"default":Notification.permission}async enable(e={}){try{if(!Os())return this.log("unsupported browser \u2014 skipping"),"unsupported";if(!this.deps.clientKey||!this.deps.apiBaseUrl)return"error";if(this.permission()==="denied")return"denied";let t=await this.fetchPushConfig();if(!t||t.enabled===!1||!t.vapidPublicKey)return this.log("web push not configured for this app"),"not-configured";let r=await Notification.requestPermission();if(r!=="granted")return r==="denied"?"denied":"error";let s=e.serviceWorkerUrl||$a;this.swUrl=s,this.reg=await navigator.serviceWorker.register(s,e.serviceWorkerScope?{scope:e.serviceWorkerScope}:void 0),await navigator.serviceWorker.ready,this.bindSwMessages();let o=await this.reg.pushManager.getSubscription()||await this.reg.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Uk(t.vapidPublicKey)}),a=await this.registerDeviceToken(o);return this.lastEndpoint=o.endpoint,a?"subscribed":"error"}catch(t){return this.log("enable failed",t),"error"}}async disable(e={}){var t,r;try{let s=this.reg||(Os()?await navigator.serviceWorker.getRegistration():null),i=s?await s.pushManager.getSubscription():null,o=(r=(t=i==null?void 0:i.endpoint)!=null?t:this.lastEndpoint)!=null?r:null,a=i?await i.unsubscribe():!0;return this.lastEndpoint=null,e.revokeServerSide!==!1&&await this.revokeDeviceToken(o),a}catch{return!1}}async revokeDeviceToken(e){if(!this.deps.clientKey||!this.deps.apiBaseUrl)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token/revoke`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({deviceId:this.deps.deviceId,...e?{endpoint:e}:{}})})).ok}catch{return!1}}onNotificationOpened(e){return this.openedCbs.add(e),this.bindSwMessages(),()=>this.openedCbs.delete(e)}async getSubscription(){try{let e=this.reg||(Os()?await navigator.serviceWorker.getRegistration():null),t=e?await e.pushManager.getSubscription():null;return t?t.toJSON():null}catch{return null}}async check(e={}){let{runPushDiagnostics:t}=await Promise.resolve().then(()=>(Ha(),qa));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:ag})}everSubscribed(){try{return localStorage.getItem(mn.EVER_KEY)==="1"}catch{return!1}}markEverSubscribed(){try{localStorage.setItem(mn.EVER_KEY,"1")}catch{}}async status(){var r,s;let e=Os(),t=e?await this.getSubscription():null;return t&&this.markEverSubscribed(),{supported:e,permission:this.permission(),subscribed:!!t,endpoint:(s=(r=t==null?void 0:t.endpoint)!=null?r:this.lastEndpoint)!=null?s:null,state:_s({supported:e,permission:this.permission(),hasSubscription:!!t,everSubscribed:this.everSubscribed()})}}bindSwMessages(){this.swMessageBound||typeof navigator=="undefined"||!("serviceWorker"in navigator)||(this.swMessageBound=!0,navigator.serviceWorker.addEventListener("message",e=>{var r,s;let t=e.data;if(!(!t||typeof t.type!="string"))if(t.type==="scalebun-push-click"){let i=(r=t.data)!=null?r:{};for(let o of this.openedCbs)try{o({data:i,action:(s=t.action)!=null?s:null})}catch{}}else t.type==="scalebun-push-resubscribe"&&t.subscription&&this.registerDeviceTokenJson(t.subscription).then(i=>{var o;i&&((o=t.subscription)!=null&&o.endpoint)&&(this.lastEndpoint=t.subscription.endpoint)})}))}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.deps.clientKey}}async fetchPushConfig(){try{let e=await fetch(`${this.deps.apiBaseUrl}/sdk/engage/push-config`,{headers:this.headers(),cache:"no-store"});return e.ok?await e.json():null}catch{return null}}registerDeviceToken(e){return this.registerDeviceTokenJson(e.toJSON())}async registerDeviceTokenJson(e){if(!e||!e.endpoint)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({schemaVersion:1,deviceId:this.deps.deviceId,platform:"web",pushProvider:"webpush",pushToken:JSON.stringify(e),tokenStatus:"active",...this.deps.sdkVersion?{sdkVersion:this.deps.sdkVersion}:{}})})).ok}catch{return!1}}};mn.EVER_KEY="scalebun.push.everSubscribed";za=mn});var bn=new Map,yn=n=>typeof n=="string"?n.replace(/[;:|]/g,"").trim().slice(0,32):"";function Ka(n,e){let t=yn(n),r=yn(e);t&&r&&bn.set(t,r)}function Ga(n){n===void 0?bn.clear():bn.delete(yn(n))}function Xa(){let n=new Map;document.querySelectorAll("[aria-expanded],dialog").forEach(e=>{let t=e.getAttribute("aria-expanded"),r=t==="true"||t===null&&e.hasAttribute("open")?"open":"closed",s=yn(e.getAttribute("data-scalebun-state")||e.getAttribute("aria-controls")||e.id);s&&n.set(s,r)});for(let[e,t]of bn)n.set(e,t);if(n.size)return[...n.keys()].sort().map(e=>`${e}:${n.get(e)}`).join(";").slice(0,96)}var Ya="https://api.scalebun.com/api/v1";var fg=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ja(n){var r,s,i,o,a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve,G,ie,Y,X,ee,T,_,N,F,W,re,ge,he,Ce,Ae,Re,Je,st,ke,gn,Va,Wa,ja;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=(r=n.apiBaseUrl)==null?void 0:r.replace(/\/$/,""),t=e&&/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?([/?#]|$)/.test(e)?e:Ya;return{clientKey:n.clientKey,apiBaseUrl:t,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(s=n.flushIntervalMs)!=null?s:5e3,sessionTimeoutMs:n.sessionTimeoutMs,sessionMaxDurationMs:n.sessionMaxDurationMs,replay:n.replay,errors:n.errors,network:n.network,performance:n.performance,analytics:n.analytics,flags:n.flags,replayCanvas:(i=n.replayCanvas)!=null?i:!1,signSessionLane:(o=n.signSessionLane)!=null?o:!1,replayFrameOrigins:(a=n.replayFrameOrigins)!=null?a:[],autocapture:(c=n.autocapture)!=null?c:!0,tracePropagation:(l=n.tracePropagation)!=null?l:!0,tracePropagationOrigins:(u=n.tracePropagationOrigins)!=null?u:[],maxBatchSize:(d=n.maxBatchSize)!=null?d:50,maxQueueSize:(p=n.maxQueueSize)!=null?p:1e3,debug:(f=n.debug)!=null?f:!1,features:{errors:(h=(m=n.features)==null?void 0:m.errors)!=null?h:!0,network:(x=(g=n.features)==null?void 0:g.network)!=null?x:!0,console:(y=(v=n.features)==null?void 0:v.console)!=null?y:!0,webVitals:(E=(b=n.features)==null?void 0:b.webVitals)!=null?E:!0,performance:(I=(w=n.features)==null?void 0:w.performance)!=null?I:!0,journey:(C=(S=n.features)==null?void 0:S.journey)!=null?C:!0,replay:(R=(M=n.features)==null?void 0:M.replay)!=null?R:!1,bugReport:(O=(A=n.features)==null?void 0:A.bugReport)!=null?O:!0,crash:(D=(z=n.features)==null?void 0:z.crash)!=null?D:!0,config:(J=(te=n.features)==null?void 0:te.config)!=null?J:!0,engage:(fe=(Q=n.features)==null?void 0:Q.engage)!=null?fe:!0,analytics:(xe=(ce=n.features)==null?void 0:ce.analytics)!=null?xe:!0,webPerf:(le=(Se=n.features)==null?void 0:Se.webPerf)!=null?le:!0,profiler:(V=(q=n.features)==null?void 0:q.profiler)!=null?V:!1,watchdog:(de=(K=n.features)==null?void 0:K.watchdog)!=null?de:!1,inbox:(se=(me=n.features)==null?void 0:me.inbox)!=null?se:!1,inapp2:(Ve=(Ue=n.features)==null?void 0:Ue.inapp2)!=null?Ve:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(ie=(G=n.privacy)==null?void 0:G.captureNetworkBodies)!=null?ie:!1,denylist:[...fg,...(X=(Y=n.privacy)==null?void 0:Y.denylist)!=null?X:[]].map(ug=>ug.toLowerCase()),maskSelectors:(T=(ee=n.privacy)==null?void 0:ee.maskSelectors)!=null?T:[],maskReplayText:(N=(_=n.privacy)==null?void 0:_.maskReplayText)!=null?N:!1,maskInputs:(W=(F=n.privacy)==null?void 0:F.maskInputs)!=null?W:!0,respectDnt:(ge=(re=n.privacy)==null?void 0:re.respectDnt)!=null?ge:!1,maskEventText:(Ce=(he=n.privacy)==null?void 0:he.maskEventText)!=null?Ce:!1},consent:{required:(Ae=n.requireConsent)!=null?Ae:!1,initial:(Re=n.initialConsent)!=null?Re:"unknown"},bugReport:{launcher:(st=(Je=n.bugReportOptions)==null?void 0:Je.launcher)!=null?st:!1,position:(gn=(ke=n.bugReportOptions)==null?void 0:ke.position)!=null?gn:"bottom-right",label:(Wa=(Va=n.bugReportOptions)==null?void 0:Va.label)!=null?Wa:"Report a bug"},...(ja=n.engageOptions)!=null&&ja.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}$();$();En();var In=class{constructor(e){this.config=e;var r,s;let t=Rc((r=e.sessionTimeoutMs)!=null?r:Vt,(s=e.sessionMaxDurationMs)!=null?s:Xs);this.sessionId=t.id,this.deviceId=Za()}client(){return sc()}device(){return ic(this.deviceId)}app(){return oc(this.config)}context(){return Tc(),ac()}};En();var An=class An{constructor(e){this.config=e;this.suspendedUntil=0}isSuspended(){return Date.now()<this.suspendedUntil}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.config.clientKey}}async signedHeaders(e){let t=this.headers();if(!this.config.signSessionLane)return t;let{signatureHeaders:r}=await Promise.resolve().then(()=>(Zs(),Qs));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c,l;await this.post(`${this.config.apiBaseUrl}/ingestion/sessions`,{sessionId:e.sessionId,deviceId:e.device.id,platform:e.client.platform,appVersion:(s=(t=e.app)==null?void 0:t.version)!=null?s:(r=e.app)==null?void 0:r.release,osVersion:e.device.osVersion,deviceModel:(i=e.device.model)!=null?i:e.device.browser,locale:(o=e.context)==null?void 0:o.locale,timezone:(a=e.context)==null?void 0:a.timezone,idleThresholdMs:(c=this.config.sessionTimeoutMs)!=null?c:Vt,sdkVersion:(l=e.client.sdk)==null?void 0:l.version,startedAt:Date.now()})}async sendBatch(e,t){var i,o;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`,s=await this.post(r,e,t==null?void 0:t.keepalive);if(!s)return null;try{return(o=(i=await s.json())==null?void 0:i.results)!=null?o:{}}catch{return{}}}async finalize(e){let t=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/finalize`;await this.post(t,{endedAt:Date.now()},!0)}async submitBugReport(e,t){if(this.isSuspended())return null;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/bug-reports`;try{let s=JSON.stringify(t),i=await fetch(r,{method:"POST",headers:await this.signedHeaders(s),body:s});return i.ok?await i.json().catch(()=>({})):null}catch{return null}}async post(e,t,r=!1){if(this.isSuspended())return null;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>An.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(Oc(),_c)),l=await c(s);l&&(o=new Blob([l]),i["content-encoding"]="gzip")}let a=await fetch(e,{method:"POST",headers:i,body:o,keepalive:r});return a.status===403&&this.maybeEnterSuspended(a),a.ok?a:null}catch{return null}}maybeEnterSuspended(e){let t=Number(e.headers.get("retry-after"))||0;e.clone().json().then(r=>{if(!((r==null?void 0:r.code)==="workspace_suspended"||(r==null?void 0:r.enabled)===!1)&&!t)return;let i=Number(r==null?void 0:r.retryAfterSeconds)||t||3600;this.suspendedUntil=Date.now()+i*1e3}).catch(()=>{t&&(this.suspendedUntil=Date.now()+t*1e3)})}};An.GZIP_MIN_BYTES=1024;var Cn=An;Wt();$();Rn();Mn();var $g=1,Bc=n=>n.kind==="frame",Pn=n=>n.frameType==="keyframe",zg=n=>Bc(n)&&!Pn(n),Ug=3,Ln=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.queuedCount=0;this.attemptedCount=0;this.retriedCount=0;this.recoveredCount=0;this.expiredCount=0;this.ackedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new St;this.flushing=!1;this.sessionStarted=Promise.resolve();this.sessionOk=!1;this.sessionRetries=0;this.keyframePending=!1;this.inFlight=[];var s,i;this.consentGranted=!((s=e.consent)!=null&&s.required)||((i=e.consent)==null?void 0:i.initial)==="granted"}setConsentGranted(e){this.consentGranted=e}canEgress(){return this.consentGranted&&!this.dead}async start(){var e;if(!this.started){this.started=!0,this.dead=!1,this.armSession();try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=Tn(s,o=>o.timestamp,P());this.expiredCount+=s.length-i.length,i.length&&(this.recoveredCount+=i.length,r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush(),this.queue.some(Pn)&&this.flush()}}armSession(){this.sessionOk=!1,this.sessionStarted=this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}).then(()=>{this.sessionOk=!0}).catch(()=>{})}emit(e){if(!this.consentGranted){this.droppedCount++;return}if(this.queue.length>=this.config.maxQueueSize){let t=this.queue.findIndex(zg);this.queue.splice(t>=0?t:0,1),this.droppedCount++}this.queuedCount++,this.queue.push(e),this.started&&Pn(e)&&(this.flushing?this.keyframePending=!0:this.flush())}reportDrop(e,t){var r;e&&((r=this.reported)!=null||(this.reported=new Set),!this.reported.has(e)&&(this.reported.add(e),this.emit({kind:"event",name:"sdk_replay_capture_failed",timestamp:P(),props:{stage:"ingest-rejected",lane:e,reason:t!=null?t:"unknown"}})))}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,kt(e,Bc,Pn)])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){var r;if(this.dead||this.flushing||this.queue.length===0)return;this.flushing=!0;let t=this.queue.splice(0,this.config.maxBatchSize);this.inFlight=t;try{await this.sessionStarted,this.started&&!this.sessionOk&&this.sessionRetries<Ug&&(this.sessionRetries++,this.armSession(),await this.sessionStarted),this.attemptedCount++;let s=await this.transport.sendBatch(this.buildEnvelope(t),e);if(s){this.inFlight=[],this.ackedCount+=t.length;let i=[],o=0;for(let a of t){let c=(r=a.kind)!=null?r:"",l=s[c];!l||l.ok||(this.ackedCount--,l.retry?(i.push(a),this.retriedCount++):(o++,this.droppedCount++,this.reportDrop(c,l.reason)))}i.length?(t.length-i.length-o===0?(this.backoff.fail(P()),this.queue.push(...i)):(this.backoff.reset(),this.queue.unshift(...i)),this.persistQueue()):this.backoff.reset()}else this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}catch{this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}this.keyframePending&&(this.keyframePending=!1,this.flush(e))}emitFor(e,t){if(!this.consentGranted||!e||e===this.session.sessionId){this.consentGranted&&e===this.session.sessionId&&this.emit(t);return}this.drainOrphans(e,[t])}async drainOrphans(e,t){let r=null;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}let s=r?t.filter(i=>{var a;let o=r[(a=i.kind)!=null?a:""];return o&&!o.ok&&o.retry}):t;s.length&&this.buffer.save([e,s])}buildEnvelope(e){return{schemaVersion:$g,sessionId:this.session.sessionId,sentAt:P(),client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context(),items:e}}installLifecycleFlush(){if(typeof document=="undefined")return;let e=()=>{this.dead||(this.persistQueue(),this.flush({keepalive:!0}))},t=()=>{document.visibilityState==="hidden"&&e()};this.addLifecycle(document,"visibilitychange",t),typeof window!="undefined"&&(this.addLifecycle(window,"pagehide",e),this.addLifecycle(window,"online",()=>{this.backoff.reset(),this.autoFlush()}))}addLifecycle(e,t,r){e.addEventListener(t,r),this.lifecycle.push({target:e,type:t,fn:r})}removeLifecycle(){for(let e of this.lifecycle)try{e.target.removeEventListener(e.type,e.fn)}catch{}this.lifecycle=[]}async stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),await this.flush({keepalive:!0}),await this.transport.finalize(this.session.sessionId),await this.buffer.clear(),this.started=!1}async discard(){this.dead=!0,this.consentGranted=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),this.queue=[],this.started=!1;try{await this.buffer.clear()}catch{}}get pendingCount(){return this.queue.length}get dropped(){return this.droppedCount}get ledger(){return{queued:this.queuedCount,attempted:this.attemptedCount,retried:this.retriedCount,recovered:this.recoveredCount,dropped:this.droppedCount,expired:this.expiredCount,acked:this.ackedCount}}};ti();$();var Fc={drop:!1,warnings:[]};function Dc(n,e,t){var o,a;if(!n||e.startsWith("$"))return Fc;let r=n.strict===!0,s=(o=n.events)==null?void 0:o[e];if(!s)return n.allowUnknownEvents===!1?{drop:r,warnings:[`event "${e}" is not in the tracking plan`]}:Fc;let i=[];for(let c of(a=s.required)!=null?a:[])(t==null||!(c in t))&&i.push(`event "${e}" missing required prop "${c}"`);if(s.props){for(let c of Object.keys(s.props))if(t&&c in t){let l=typeof t[c];l!==s.props[c]&&i.push(`event "${e}" prop "${c}" expected ${s.props[c]}, got ${l}`)}}return{drop:r&&i.length>0,warnings:i}}var Vg=/^[A-Za-z]{3}$/;function Wg(n){return Vg.test(n)?n.toUpperCase():n}function On(n){let{revenue:e,currency:t,transactionId:r,type:s,productId:i,quantity:o,recurrence:a,...c}=n;if(typeof e!="number"||!Number.isFinite(e)||!t||!r)return null;let l=s!=null?s:"one_time",u=l==="refund"?-Math.abs(e):e,d={...c,transaction_id:r,revenue_type:l};return i&&(d.product_id=i),o!=null&&(d.quantity=o),a&&(d.recurrence=a),{revenue:u,currency:Wg(t),props:d}}var jg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],Kg=new Set(["trial_started","trial_converted","started","plan_changed"]);function Nn(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function Gg(n){return{...n.id?{id:String(n.id)}:{},...n.name?{name:String(n.name)}:{},amount:n.amount,currency:String(n.currency).toUpperCase().slice(0,3),interval:n.interval,...typeof n.intervalCount=="number"&&n.intervalCount>0?{intervalCount:Math.floor(n.intervalCount)}:{}}}function qc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!jg.includes(t))return null;let r=n.plan;return Kg.has(t)&&(!r||typeof r.amount!="number"||!Number.isFinite(r.amount)||r.amount<0||!r.currency||!r.interval)?null:{subscriptionId:e,status:t,...r?{plan:Gg(r)}:{},...Nn(n.trialEndAt)?{trialEndAt:Nn(n.trialEndAt)}:{},...Nn(n.effectiveAt)?{effectiveAt:Nn(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var Xg="wzb-analytics-v1",Yg=new Set(["$identify","$group","$alias","purchase"]);function Hc(n,e,t){return t>=1||Yg.has(n)?!0:t<=0?!1:Ee(`${e}:${Xg}`)%1e4<t*1e4}Wt();Rn();Mn();var vb=50,wb=5e3,xb=2e3,Qe="scalebun_anonymous_id",oi="scalebun_user_id",Hn="scalebun_super_props",si="scalebun_groups",al="scalebun_installation_id",cl="scalebun_first_open_done",ai="scalebun_attribution_click_id",ll="scalebun_attribution",ul=/^[0-9a-f]{16,64}$/i,Sb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function kb(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(ll);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return{props:t,isNew:!1}}}}catch{}let n={};try{if(typeof location!="undefined"){let e=new URL(location.href);for(let t of Sb){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,200))}for(let t of["fbclid","gclid"]){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,512))}}if(typeof document!="undefined"&&document.referrer)try{let e=new URL(document.referrer);n.referrer=(e.origin+e.pathname).slice(0,512),n.referrer_domain=e.hostname}catch{n.referrer=document.referrer.split("?")[0].slice(0,512)}}catch{}if(!n.referrer&&!n.utm_source&&!n.fbclid&&!n.gclid)return{props:{},isNew:!1};try{typeof location!="undefined"&&(n.landing_url=location.pathname.slice(0,512)),typeof localStorage!="undefined"&&localStorage.setItem(ll,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var Eb="pending-analytics";function Ib(){try{if(typeof localStorage!="undefined")return localStorage.getItem(oi)||void 0}catch{}}function ii(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(oi,n):localStorage.removeItem(oi)}catch{}}function ci(){return`anon_${H()}`}function dl(n){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(n);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return t}}}catch{}return{}}function Kt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function Cb(n){try{if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)")),t=e==null?void 0:e[1];return t!=null?decodeURIComponent(t):null}catch{return null}}function li(n,e,t){try{if(typeof document=="undefined")return;let r=[`${n}=${encodeURIComponent(e)}`,"path=/","max-age=31536000","SameSite=Lax"];t&&r.push(`domain=${t}`),document.cookie=r.join("; ")}catch{}}function Ab(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(al))!=null?r:"",e||(e=n||`web_${H()}`,localStorage.setItem(al,e)),t=(s=localStorage.getItem(ai))!=null?s:void 0)}catch{}e||(e=n||`web_${H()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&ul.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(ai,o)}catch{}i.searchParams.delete("scalebun_click_id");try{history.replaceState(history.state,"",i.pathname+i.search+i.hash)}catch{}}}}catch{}return t?{installationId:e,clickId:t}:{installationId:e}}function Rb(n){if(n){let t=Cb(Qe);if(t){try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,t)}catch{}return t}}try{if(typeof localStorage!="undefined"){let t=localStorage.getItem(Qe),r=t!=null?t:ci();return t||localStorage.setItem(Qe,r),n&&li(Qe,r,n),r}}catch{}let e=ci();return n&&li(Qe,e,n),e}var $n=class{constructor(){this.name="analytics";this.ctx=null;this.active=!1;this.clientKey="";this.apiBaseUrl="";this.deviceId="";this.installationId="";this.attributionProps={};this.anonymousId="";this.userId=Ib();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(Eb);this.persisted=!1;this.backoff=new St;this.sampleRate=1;this.droppedCount=0;this.sampledOutCount=0;this.flushCount=0}get pending(){return this.queue.length}get dropped(){return this.droppedCount}get stats(){return{pending:this.queue.length,dropped:this.droppedCount,sampledOut:this.sampledOutCount,flushes:this.flushCount,sampleRate:this.sampleRate}}get isActive(){return this.active}setup(e){var i,o,a,c,l,u,d;this.ctx=e,this.clientKey=(i=e.clientKey)!=null?i:"",this.apiBaseUrl=(o=e.apiBaseUrl)!=null?o:"",this.deviceId=(a=e.deviceId)!=null?a:"";let t=Ab(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=kb();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Rb(this.cookieDomain),this.superProps=dl(Hn),this.groups=dl(si),this.plan=(l=e.analyticsOptions)==null?void 0:l.plan;let s=(u=e.analyticsOptions)==null?void 0:u.sampleRate;typeof s=="number"&&s>=0&&s<=1&&(this.sampleRate=s),!(!this.clientKey||!this.apiBaseUrl)&&(r.isNew&&this.recordTouchpoint(),this.timer=setInterval(()=>this.autoFlush(),wb),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Nc(()=>{this.backoff.reset(),this.autoFlush()}),this.active=!0,this.maybeFirstOpen(),this.offSignal=(d=e.onSignal)==null?void 0:d.call(e,(p,f)=>{this.active&&(p==="rage"?this.track("$rageclick"):p==="dead"?this.track("$deadclick"):p==="shake"?this.track("$shake"):p==="error"?this.track("$exception",f):p==="web_vital"?this.track("$web_vital",f):p==="exit_intent"&&this.track("$exit_intent",f))}),this.buffer.load().then(p=>{let f=Array.isArray(p)?p:[],m=Tn(f,h=>h.event_time,P());this.droppedCount+=f.length-m.length,this.active&&m.length?(this.queue.unshift(...m),this.trim(),this.persisted=!0,this.autoFlush()):m.length<f.length&&this.buffer.clear()}),e.autocapture!==!1&&Promise.resolve().then(()=>(ol(),il)).then(({installAutocapture:p})=>{this.active&&(this.stopAutocapture=p({onEvent:f=>this.track(f.name,{...f.props,capture_source:"automatic"}),maskText:e.maskEventText===!0}))}).catch(()=>{}))}get usable(){return this.active&&!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}get sessionId(){var e;return(e=this.ctx)==null?void 0:e.sessionId}async recordTouchpoint(){if(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")return;let e=this.attributionProps;try{await fetch(`${this.apiBaseUrl}/ingestion/attribution`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},keepalive:!0,body:JSON.stringify({sessionId:this.sessionId,anonymousId:this.anonymousId||void 0,source:e.utm_source,medium:e.utm_medium,campaign:e.utm_campaign,content:e.utm_content,term:e.utm_term,landingUrl:e.landing_url,referrer:e.referrer,referrerDomain:e.referrer_domain,clickToken:this.clickId})})}catch{}}maybeFirstOpen(){let e=!1;try{e=typeof localStorage!="undefined"&&localStorage.getItem(cl)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(cl,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!ul.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(ai,e)}catch{}}}build(e,t){let r=ne(),s=Object.keys(this.attributionProps).length?{...this.attributionProps,...this.superProps}:this.superProps,i=Object.keys(s).length?{...s,...t}:t,o=i&&Object.keys(i).length?mt(i):void 0,a=Object.keys(this.groups).length>0;return{event_id:H(),event_name:e.trim(),event_time:P(),platform:"web",installation_id:this.installationId,...this.deviceId?{device_id:this.deviceId}:{},anonymous_id:this.anonymousId,...this.sessionId?{session_id:this.sessionId}:{},...this.userId?{user_id:this.userId}:{},...this.clickId?{identifiers:{click_id:this.clickId}}:{},...o?{properties:o}:{},...a?{groups:{...this.groups}}:{},...r?{replay:r}:{},context:{sdk_version:Fs}}}get identity(){return{anonymousId:this.anonymousId,userId:this.userId,groups:this.groups,superProps:this.superProps}}evaluate(e,t){if(!this.plan)return{drop:!1};let r=Dc(this.plan,e,t);if(r.warnings.length)try{for(let s of r.warnings)console.warn(`[scalebun] tracking-plan: ${s}`)}catch{}return{drop:r.drop}}register(e){!e||typeof e!="object"||(this.superProps={...this.superProps,...e},Kt(Hn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,Kt(Hn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},Kt(si,this.groups),this.usable&&this.enqueue(this.build("$group",{group_type:e,group_key:t,...r!=null?r:{}})))}alias(e,t){var s;if(!e)return;let r=(s=t!=null?t:this.userId)!=null?s:this.anonymousId;this.userId=e,ii(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ii(void 0),this.anonymousId=ci();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&li(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},Kt(Hn,this.superProps),Kt(si,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Hc(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=On(e);if(!t)return;let r=this.build("purchase",t.props);r.revenue=t.revenue,r.currency=t.currency,this.enqueue(r)}trackSubscription(e){if(!this.usable)return;let t=qc(e);if(!t)return;let r=ne();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ii(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=vb&&this.autoFlush()}trim(){let e=this.queue.length-xb;e>0&&(this.queue.splice(0,e),this.droppedCount+=e)}autoFlush(){!ot()||!this.backoff.ready(P())||this.flush()}async flush(e=!1){if(!this.usable||!this.queue.length)return;let t=this.queue.splice(0,this.queue.length),r=JSON.stringify({events:t});try{let{signatureHeaders:s}=await Promise.resolve().then(()=>(Zs(),Qs)),i=await s(this.clientKey,r);(await fetch(`${this.apiBaseUrl}/batch`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey,...i},body:r,keepalive:e})).ok?(this.backoff.reset(),this.flushCount++):(this.backoff.fail(P()),this.requeue(t))}catch{this.backoff.fail(P()),this.requeue(t)}this.persist()}requeue(e){this.queue.unshift(...e),this.trim()}async persist(){this.queue.length?(this.persisted=!0,await this.buffer.save(kt(this.queue))):this.persisted&&(this.persisted=!1,await this.buffer.clear())}teardown(){var e,t,r;(e=this.stopAutocapture)==null||e.call(this),this.stopAutocapture=void 0,this.timer&&clearInterval(this.timer),this.timer=void 0,this.onHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onHide),this.onHide=void 0,(t=this.offOnline)==null||t.call(this),(r=this.offSignal)==null||r.call(this),this.offSignal=void 0,this.offOnline=void 0,this.queue=[],this.persisted=!1,this.buffer.clear(),this.active=!1}};$();Fe();function Tb(n,e){if(e in n)return n[e];if(e.indexOf(".")===-1)return;let t=n;for(let r of e.split(".")){if(t==null||typeof t!="object")return;t=t[r]}return t}function pl(n,e){let t=Tb(n,e.attr),r=e.value;switch(e.op){case"exists":return t!=null;case"eq":return t===r;case"neq":return t!==r;case"in":return Array.isArray(r)&&r.includes(t);case"nin":return Array.isArray(r)&&!r.includes(t);case"contains":return typeof t=="string"&&typeof r=="string"&&t.includes(r);case"gt":return typeof t=="number"&&typeof r=="number"&&t>r;case"lt":return typeof t=="number"&&typeof r=="number"&&t<r;default:return!1}}function Mb(n,e){var o,a;let t=(o=e.all)!=null?o:[],r=(a=e.any)!=null?a:[];if(t.length===0&&r.length===0)return!0;let s=t.every(c=>pl(n,c)),i=r.length===0||r.some(c=>pl(n,c));return s&&i}function Gt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Mb(e,t))return t;return null}var fl="scalebun_config",di="scalebun_flag_overrides";function zn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ml(){let n=zn();if(!n)return null;try{let e=n.getItem(fl);if(!e)return null;let t=JSON.parse(e);return t&&typeof t.version=="string"&&Array.isArray(t.flags)?t:null}catch{return null}}function hl(n){let e=zn();if(e)try{e.setItem(fl,JSON.stringify(n))}catch{}}function gl(){let n=zn();if(!n)return{};try{let e=n.getItem(di),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Un(n){let e=zn();if(e)try{Object.keys(n).length?e.setItem(di,JSON.stringify(n)):e.removeItem(di)}catch{}}var ui={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var Pb=5*60*1e3,bl=n=>{var e;return(e=n.salt)!=null?e:n.key},Vn=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=ui;this.exposed=new Set;this.deviceId="";this.clientKey="";this.apiBaseUrl="";this.lastFetch=0;this.overrides={};this.changeListeners=new Set;this.settled=!1;this.readyPromise=new Promise(e=>this.resolveReady=e)}get isActive(){return this.active}setup(e){var t,r,s,i,o;this.ctx=e,this.deviceId=(t=e.deviceId)!=null?t:"",this.clientKey=(r=e.clientKey)!=null?r:"",this.apiBaseUrl=(s=e.apiBaseUrl)!=null?s:"",Oe({deviceId:this.deviceId}),this.overrides=gl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:ml())!=null?o:ui,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Pb&&this.refresh()},document.addEventListener("visibilitychange",this.onVisible)),e.flagsRealtime!==!1&&this.openStream(),this.active=!0}openStream(){if(!(typeof EventSource=="undefined"||!this.clientKey||!this.apiBaseUrl))try{this.es=new EventSource(`${this.apiBaseUrl}/config/stream?key=${encodeURIComponent(this.clientKey)}`),this.es.onmessage=e=>{try{if(e.data&&JSON.parse(e.data).type==="ping")return}catch{}this.refresh()}}catch{}}seedFromBootstrap(e){return!e||typeof e!="object"||!["flags","remoteConfig","experiments","rollouts"].some(r=>Array.isArray(e[r]))?null:{version:typeof e.version=="string"?e.version:"bootstrap",flags:Array.isArray(e.flags)?e.flags:[],remoteConfig:Array.isArray(e.remoteConfig)?e.remoteConfig:[],experiments:Array.isArray(e.experiments)?e.experiments:[],rollouts:Array.isArray(e.rollouts)?e.rollouts:[],entitlements:e.entitlements,holdout:e.holdout}}markReady(){var e;this.settled||(this.settled=!0,(e=this.resolveReady)==null||e.call(this))}emitChange(){for(let e of this.changeListeners)try{e()}catch{}}async refresh(){var e,t,r,s;if(!(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")){this.lastFetch=P();try{let i={"x-scalebun-client-key":this.clientKey};this.payload.version&&(i["if-none-match"]=`"${this.payload.version}"`);let o=await fetch(`${this.apiBaseUrl}/config`,{headers:i});if(o.status===304||!o.ok)return;let a=await o.json();if(a&&typeof a.version=="string"){let c=a.version!==this.payload.version;this.payload={version:a.version,flags:(e=a.flags)!=null?e:[],remoteConfig:(t=a.remoteConfig)!=null?t:[],experiments:(r=a.experiments)!=null?r:[],rollouts:(s=a.rollouts)!=null?s:[],entitlements:a.entitlements,holdout:a.holdout,sdkFlags:a.sdkFlags},hl(this.payload),c&&(this.exposed.clear(),this.emitChange())}}catch{}}}ready(){return this.readyPromise}onChange(e){return this.changeListeners.add(e),()=>{this.changeListeners.delete(e)}}override(e,t){this.overrides[e]=t,Un(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],Un(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},Un(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=yt();if(e){let i=t[e];if(i!=null&&i!=="")return String(i)}if((s=this.payload.sdkFlags)!=null&&s.stableBucketingId)return this.deviceId;let r=t.userId;return r!=null&&r!==""?String(r):this.deviceId}knows(e){return!this.hasOverride(e)&&this.payload.flags.some(t=>t.key===e)}isEnabled(e){var r;if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.flags.find(s=>s.key===e);if(!t)return!1;if(t.variations&&t.variations.length)return!!this.variationDetail(e,!1).value;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),bl(t))<s.rollout:(r=s.serve)!=null?r:!0}return t.enabled}variationDetail(e,t){var c,l,u;let r=this.payload.flags.find(d=>d.key===e);if(this.hasOverride(e)){let d=this.overrides[e];if(typeof d=="string"&&(r!=null&&r.variations)){let p=r.variations.find(f=>f.key===d);if(p)return{value:p.value,variant:p.key,reason:"DEFAULT"}}return{value:d!=null?d:t,variant:typeof d=="string"?d:null,reason:"DEFAULT"}}if(!r)return{value:t,variant:null,reason:"FLAG_NOT_FOUND"};let s=r.variations,i=()=>this.bucketingId(r.bucketBy),o=(d,p)=>{var m,h;let f=(m=d!=null?d:r.defaultVariant)!=null?m:null;if(f&&s){let g=s.find(x=>x.key===f);if(g)return{value:g.value,variant:f,reason:p}}return{value:(h=r.defaultValue)!=null?h:t,variant:f,reason:p}},a=()=>{if(s&&s.some(d=>typeof d.allocationPct=="number")){let d=ni(i(),e,s.map(p=>{var f;return{key:p.key,allocationPct:(f=p.allocationPct)!=null?f:0}}));return o(d,"ROLLOUT")}return s?o(null,"DEFAULT"):{value:r.enabled,variant:null,reason:"DEFAULT"}};if(r.targeting&&r.targeting.length){let d=Gt(r.targeting,yt());if(d)return typeof d.rollout=="number"?Le(i(),bl(r))>=d.rollout?a():s?o((c=d.variation)!=null?c:null,"ROLLOUT"):{value:!0,variant:null,reason:"ROLLOUT"}:d.variation||s?o((l=d.variation)!=null?l:null,"TARGETING_MATCH"):{value:(u=d.serve)!=null?u:!0,variant:null,reason:"TARGETING_MATCH"}}return a()}variation(e,t){return this.variationDetail(e,t).value}get(e,t){let r=this.payload.remoteConfig.find(s=>s.key===e);if(!r)return t;try{switch(r.type){case"number":{let s=Number(r.value);return Number.isFinite(s)?s:t}case"boolean":return r.value==="true";case"json":return JSON.parse(r.value);default:return r.value}}catch{return t}}isOn(e){if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.rollouts.find(s=>s.key===e);if(!t)return!1;let r=t.percentage;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());s&&typeof s.percentage=="number"&&(r=s.percentage)}return Le(this.bucketingId(t.bucketBy),t.salt)<r}inHoldout(){let e=this.payload.holdout;return!!e&&e.percentage>0&&Le(this.bucketingId(),e.salt)<e.percentage}inLayerSlot(e){if(!e.layer||!e.layerRange)return!0;let[t,r]=e.layerRange,s=Le(this.bucketingId(),`layer:${e.layer}`);return s>=t&&s<r}variant(e){var o;if(this.hasOverride(e)){let a=this.overrides[e];return a==null?null:String(a)}let t=this.payload.experiments.find(a=>a.key===e);if(!t||this.inHoldout()||!this.inLayerSlot(t))return null;let r=t.variants;if(t.targeting&&t.targeting.length){let a=Gt(t.targeting,yt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=ni(this.bucketingId(t.bucketBy),t.salt,r),i=`${e}=${s}`;if(s&&!this.exposed.has(i)){this.exposed.add(i);let a=ne();(o=this.ctx)==null||o.emit({kind:"event",name:"experiment_exposure",props:{experiment:e,variant:s,reason:"ENROLLED",...a?{$replay:a}:{}},timestamp:P()})}return s}entitlement(e){let t=this.payload.entitlements;return(t==null?void 0:t[e])!==!1}teardown(){var e;this.onVisible&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisible),this.onVisible=void 0,(e=this.es)==null||e.close(),this.es=void 0,this.active=!1}};$();$();function yl(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function vl(n){if(!n)return n;let e=!1,t={};for(let r in n){let s=n[r];if(typeof s=="string"){let i=j(s);t[r]=i,i!==s&&(e=!0)}else t[r]=s}return e?t:n}var wl=16*1024;function xl(n,e={}){var u,d,p,f;let{droppedSince:t=0,extra:r,frames:s,fingerprint:i,causes:o,scope:a}=e,c=n.stack;return!c&&n.source&&(c=`${n.message} at ${n.source}:${(u=n.lineno)!=null?u:0}:${(d=n.colno)!=null?d:0}`),c&&c.length>wl&&(c=c.slice(0,wl)),c=yl(c),{kind:"error",type:n.type,message:j((p=n.message)!=null?p:""),stack:c,source:"js",...n.mechanism?{mechanism:n.mechanism}:{},...s&&s.length?{frames:s}:{},...i?{fingerprint:i}:{},...o&&o.length?{causes:o}:{},...a!=null&&a.level?{level:a.level}:{},...a!=null&&a.tags?{tags:a.tags}:{},...a!=null&&a.context?{context:a.context}:{},...Lb(),..._b(),screenName:Ob(),clientId:`err_${H()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=vl(r))!=null?f:{}}}function Lb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function _b(){let n=ne();return n?{replay:n}:{}}function Ob(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Wn=class{constructor(e){this.lastSeen=new Map;this.recent=[];this.dropped=0;var t,r,s;this.dedupWindowMs=(t=e==null?void 0:e.dedupWindowMs)!=null?t:5e3,this.capCount=(r=e==null?void 0:e.capCount)!=null?r:20,this.capWindowMs=(s=e==null?void 0:e.capWindowMs)!=null?s:1e4}accept(e){let t=Date.now();if(this.lastSeen.size>512)for(let[s,i]of this.lastSeen)t-i>=this.dedupWindowMs&&this.lastSeen.delete(s);let r=this.lastSeen.get(e);return r!=null&&t-r<this.dedupWindowMs?(this.dropped++,!1):(this.recent=this.recent.filter(s=>t-s<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.lastSeen.set(e,t),this.recent.push(t),!0))}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var It={tags:{},context:{}};function Sl(n,e){It.tags[n]=e}function kl(n,e){It.context[n]=e}function El(n){It.level=n}function Il(n){var i;let e={...It.tags,...n==null?void 0:n.tags},t={...It.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:It.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var Nb="wzb-errors-v1";function Cl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,Nb)<n*100:!0}$();var zb=()=>[];function Ub(n){if(!n)return"";let e=n.split(`
716
- `).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var Fl=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Dl(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var jn=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new Wn;this.ignore=Fl;this.denyUrls=[];this.captureResourceErrors=!1;this.sampled=!0;this.counters={captured:0,droppedThrottle:0,droppedIgnore:0,droppedBeforeSend:0,byType:{},lastFingerprint:void 0}}stats(){return{captured:this.counters.captured,droppedThrottle:this.counters.droppedThrottle,droppedIgnore:this.counters.droppedIgnore,droppedBeforeSend:this.counters.droppedBeforeSend,byType:{...this.counters.byType},lastFingerprint:this.counters.lastFingerprint,breadcrumbs:We.snapshot().length,sampled:this.sampled}}get isActive(){return this.active}setup(e){var r,s,i;this.ctx=e;let t=e.errorsOptions;t&&(this.ignore=[...Fl,...(r=t.ignoreErrors)!=null?r:[]],this.denyUrls=(s=t.denyUrls)!=null?s:[],this.captureResourceErrors=(i=t.captureResourceErrors)!=null?i:!1,this.beforeSend=t.beforeSend),this.sampled=Cl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(Bl(),Nl)).then(o=>{this.parseStack=o.parseStack,this.computeFingerprint=o.computeFingerprint,this.extractCauses=o.extractCauses}).catch(()=>{}),typeof window!="undefined"&&(this.onError=o=>{var l,u;let a=o.target;if(!!a&&a!==window&&typeof a.tagName=="string"&&!o.error&&!o.message){if(!this.captureResourceErrors)return;let d=a.src||a.href||"";this.handleAuto({type:"fatal",message:`Failed to load ${a.tagName.toLowerCase()}${d?` ${d}`:""}`,source:d,mechanism:"resource"});return}this.handleAuto({type:"fatal",message:o.message||((l=o.error)==null?void 0:l.message)||"Uncaught error",stack:(u=o.error)==null?void 0:u.stack,source:o.filename,lineno:o.lineno,colno:o.colno,mechanism:"onerror"},o.error)},this.onRejection=o=>{var c;let a=o.reason;this.handleAuto({type:"unhandledrejection",message:(c=a==null?void 0:a.message)!=null?c:String(o.reason),stack:a==null?void 0:a.stack,mechanism:"onunhandledrejection"},o.reason)},this.sampled&&(window.addEventListener("error",this.onError,!0),window.addEventListener("unhandledrejection",this.onRejection)),this.active=!0)}shouldIgnore(e){for(let t of this.ignore)if(Dl(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Dl(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${Ub(e.stack)}`;if(!this.throttle.accept(r)){this.counters.droppedThrottle++;return}this.buildAndEmit(e,{droppedSince:this.throttle.takeDropped(),original:t})}captureHandled(e,t,r){var i;let s=e;this.buildAndEmit({type:"handled",message:(i=s==null?void 0:s.message)!=null?i:String(e),stack:s==null?void 0:s.stack,mechanism:"captureError"},{extra:t,scopeOver:r,original:e})}buildAndEmit(e,t){var a,c,l,u,d,p,f,m,h;let r=(a=this.parseStack)==null?void 0:a.call(this,e.stack),s=(u=(c=t.scopeOver)==null?void 0:c.fingerprint)!=null?u:(l=this.computeFingerprint)==null?void 0:l.call(this,e.type,r,e.message),i=t.original!=null&&this.extractCauses?this.extractCauses(t.original,(d=this.parseStack)!=null?d:zb):void 0,o=xl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:Il(t.scopeOver)});if(this.beforeSend)try{let g=this.beforeSend(o);if(!g){this.counters.droppedBeforeSend++;return}o=g}catch{}(p=this.ctx)==null||p.emit(o),this.counters.captured++,this.counters.byType[e.type]=((f=this.counters.byType[e.type])!=null?f:0)+1,s&&(this.counters.lastFingerprint=s),(h=this.ctx)==null||h.signal("error",{fingerprint:s,type:e.type,message:((m=e.message)!=null?m:"").slice(0,200),handled:e.type==="handled"})}teardown(){typeof window!="undefined"&&(this.onError&&window.removeEventListener("error",this.onError,!0),this.onRejection&&window.removeEventListener("unhandledrejection",this.onRejection),this.active=!1)}};var fi;function Vb(){return fi||(fi=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Kn(n){try{let e=Vb();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function Gn(n){try{return n==null?void 0:typeof n=="string"?Kn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Kn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Xt(n){if(!n)return;let e=parseInt(n,10);return Number.isFinite(e)&&e>=0?e:void 0}function lt(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function ql(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var x,v,y,b,E,w,I,S,C,M,R;let c=jb(o),l=Kb(o,a);if(t(c))return s.call(this,o,a);let u,d=a,p=r==null?void 0:r(c);if(p){u=p.traceId;let A=new Headers((x=a==null?void 0:a.headers)!=null?x:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=Gb(d==null?void 0:d.body),g=Xb(o,d);try{let A=await s.call(this,o,d),O=null;try{O=typeof A.clone=="function"?A.clone():null}catch{O=null}return e({method:l,url:c,status:A.status,startedAt:f,duration:Math.round(lt()-m),requestSize:(y=Gn(d==null?void 0:d.body))!=null?y:Xt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Xt((E=(b=A.headers)==null?void 0:b.get)==null?void 0:E.call(b,"content-length")),reqBody:h,reqContentType:(I=(w=g==null?void 0:g.get)==null?void 0:w.call(g,"content-type"))!=null?I:void 0,resContentType:(M=(C=(S=A.headers)==null?void 0:S.get)==null?void 0:C.call(S,"content-type"))!=null?M:void 0,readResponseText:O?()=>Wb(O):void 0,traceId:u}),A}catch(A){let O=A,z=(O==null?void 0:O.name)==="AbortError",D=(O==null?void 0:O.name)==="TimeoutError";throw e({method:l,url:c,status:0,startedAt:f,duration:Math.round(lt()-m),error:(R=O==null?void 0:O.message)!=null?R:"network error",aborted:z,timedOut:D}),A}},()=>{n.fetch=s})}var Xn=64*1024;async function Wb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>Xn?i.slice(0,Xn):i}let t=e.getReader(),r=typeof TextDecoder!="undefined"?new TextDecoder:void 0,s="";for(;;){let{done:i,value:o}=await t.read();if(i)break;if(o&&r&&(s+=r.decode(o,{stream:!0})),s.length>=Xn){try{await t.cancel()}catch{}return s.slice(0,Xn)}}return r&&(s+=r.decode()),s}catch{return null}}function jb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function Kb(n,e){var r;let t=(r=e==null?void 0:e.method)!=null?r:typeof n!="string"&&!(n instanceof URL)?n.method:void 0;return(t!=null?t:"GET").toUpperCase()}function Gb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function Xb(n,e){try{if(e!=null&&e.headers)return new Headers(e.headers);if(typeof Request!="undefined"&&n instanceof Request)return n.headers}catch{}}function Hl(n,e,t,r){let s=n.XMLHttpRequest;if(typeof s!="function")return()=>{};let i=s.prototype.open,o=s.prototype.send,a=s.prototype.setRequestHeader;return s.prototype.open=function(c,l,...u){return this.__scalebun={method:String(c).toUpperCase(),url:String(l)},i.call(this,c,l,...u)},s.prototype.setRequestHeader=function(c,l){return this.__scalebun&&typeof c=="string"&&c.toLowerCase()==="content-type"&&(this.__scalebun.reqContentType=String(l)),a.call(this,c,l)},s.prototype.send=function(c){let l=this.__scalebun;if(l&&!t(l.url)){let u=r==null?void 0:r(l.url);if(u){l.traceId=u.traceId;try{this.setRequestHeader("traceparent",u.header)}catch{}}let d=Date.now(),p=lt(),f=typeof c=="string"?c:void 0,m=Gn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let x=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:Jb(this),error:x?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:Yb(this,"content-type"),readResponseText:async()=>{try{return typeof this.responseText=="string"?this.responseText:null}catch{return null}},traceId:l.traceId})})}return o.call(this,c)},()=>{s.prototype.open=i,s.prototype.send=o,s.prototype.setRequestHeader=a}}function Yb(n,e){var t,r;try{return(r=(t=n.getResponseHeader)==null?void 0:t.call(n,e))!=null?r:void 0}catch{return}}function Jb(n){var t;let e=Xt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Kn(n.responseText):void 0}catch{return}}$();function $l(n){let{status:e,error:t,aborted:r,timedOut:s}=n;if(r)return"abort";if(s)return"timeout";if((e===0||e===void 0)&&t)return Qb(t)?"abort":Zb(t)?"timeout":ey(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function zl(n,e=2e3){return typeof n=="number"&&n>=e}function Qb(n){return/\babort(ed)?\b/i.test(n)}function Zb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function ey(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var ty=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,}|[0-9A-HJKMNP-TV-Z]{26})$/i;function ny(n){return n?!!(ty.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Ul(n){let e=n;try{let s=typeof location!="undefined"?location.href:"http://x";e=new URL(n,s).pathname}catch{let s=e.indexOf("?");s>=0&&(e=e.slice(0,s));let i=e.indexOf("#");i>=0&&(e=e.slice(0,i))}if(e==="/"||e==="")return e||"/";let t=e.split("/"),r=!1;for(let s=0;s<t.length;s++){let i=t[s];i!==void 0&&ny(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Vl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?$l({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=zl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Ul(n.url);return{kind:"network",method:n.method,url:n.url,status:n.status,startedAt:n.startedAt,duration:n.duration,error:n.error,requestSize:n.requestSize,responseSize:n.responseSize,route:i,screenName:ry(),...t!=="http"?{protocol:t}:{},...r?{failure:r}:{},...s?{slow:!0}:{},...n.transferSize!==void 0?{transferSize:n.transferSize}:{},...n.graphql?{graphql:n.graphql}:{},...n.timing?{timing:n.timing}:{},...n.ws?{ws:n.ws}:{},...n.request?{request:n.request}:{},...n.response?{response:n.response}:{},...n.traceId?{traceId:n.traceId}:{},clientId:`net_${H()}`,timestamp:P()}}function ry(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Wl(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);let r="";for(let s of e)r+=s.toString(16).padStart(2,"0");return r}function sy(){let n=Wl(16),e=Wl(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function iy(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function jl(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=iy(t);return r&&e.has(r)?sy():null}}var oy=new Set(["fetch","xmlhttprequest"]);function ay(n){let e={},t=n.domainLookupEnd-n.domainLookupStart,r=n.connectEnd-n.connectStart,s=n.secureConnectionStart>0?n.connectEnd-n.secureConnectionStart:0,i=n.responseStart-n.requestStart,o=n.responseEnd-n.responseStart;t>0&&(e.dns=Yt(t)),r>0&&(e.tcp=Yt(r)),s>0&&(e.tls=Yt(s)),i>0&&(e.ttfb=Yt(i)),o>0&&(e.download=Yt(o));let a={};return Object.keys(e).length&&(a.timing=e),typeof n.transferSize=="number"&&n.transferSize>0&&(a.transferSize=n.transferSize),a}function Yt(n){return Math.round(n*100)/100}var Ct=class Ct{constructor(){this.byUrl=new Map;this.timeOriginMs=0}install(){var e;if(typeof PerformanceObserver=="undefined"||typeof performance=="undefined")return!1;this.timeOriginMs=(e=performance.timeOrigin)!=null?e:0;try{return this.observer=new PerformanceObserver(t=>{for(let r of t.getEntries()){let s=r;oy.has(s.initiatorType)&&this.add(s)}}),this.observer.observe({type:"resource",buffered:!0}),!0}catch{return!1}}add(e){let t=e.name,r=this.byUrl.get(t);r||(r=[],this.byUrl.set(t,r)),r.push(e),r.length>Ct.MAX_PER_URL&&r.shift(),this.prune()}match(e,t){let r=this.byUrl.get(e);if(!r||!r.length)return{};let s=t-this.timeOriginMs,i=0,o=1/0;for(let c=0;c<r.length;c++){let l=r[c];if(!l)continue;let u=Math.abs(l.startTime-s);u<o&&(o=u,i=c)}let[a]=r.splice(i,1);return r.length||this.byUrl.delete(e),a?ay(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-Ct.TTL_MS;for(let[t,r]of this.byUrl){let s=r.filter(i=>i.startTime>=e);s.length?this.byUrl.set(t,s):this.byUrl.delete(t)}}teardown(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0,this.byUrl.clear()}};Ct.TTL_MS=6e4,Ct.MAX_PER_URL=8;var Jn=Ct;Fe();function Kl(n,e){if(n.failed||n.slow)return!0;let t=e>=1?1:e<=0?0:e;return t>=1?!0:t<=0?!1:Ee(n.key)%1e4<Math.round(t*1e4)}var Qn=class{constructor(e,t,r){this.windowMs=e;this.emit=t;this.onSuppress=r;this.map=new Map}push(e){var s,i,o,a;let t=`${e.method}|${(s=e.route)!=null?s:e.url}|${(o=(i=e.status)!=null?i:e.error)!=null?o:""}`,r=this.map.get(t);return r?(r.count++,r.item=e,clearTimeout(r.timer),r.timer=setTimeout(()=>this.flush(t),this.windowMs),(a=this.onSuppress)==null||a.call(this),!1):(this.map.size>=500&&this.evictOldest(),this.map.set(t,{count:0,item:e,timer:setTimeout(()=>this.flush(t),this.windowMs)}),this.emit(e),!0)}flush(e){let t=this.map.get(e);this.map.delete(e),t&&t.count>0&&this.emit({...t.item,repeat:t.count})}evictOldest(){let e=this.map.keys().next().value;if(e!==void 0){let t=this.map.get(e);t&&clearTimeout(t.timer),this.flush(e)}}get pending(){return this.map.size}dispose(){for(let e of this.map.values())clearTimeout(e.timer);this.map.clear()}};function fy(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var er=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Jn;this.timingOn=!1;this.counters={captured:0,byProtocol:{http:0,ws:0,sse:0,beacon:0},byFailure:{http_4xx:0,http_5xx:0,network_error:0,timeout:0,cors:0,abort:0},dropped:0,sampledIn:0,bodiesCaptured:0}}stats(){return{captured:this.counters.captured,byProtocol:{...this.counters.byProtocol},byFailure:{...this.counters.byFailure},dropped:this.counters.dropped,sampledIn:this.counters.sampledIn,bodiesCaptured:this.counters.bodiesCaptured}}get isActive(){return this.active}setup(e){var u,d,p,f,m,h;if(typeof window=="undefined")return;let t=(u=e.networkOptions)!=null?u:{};this.slowMs=(d=t.slowRequestMs)!=null?d:2e3,this.sampleRate=typeof t.sampleRate=="number"?t.sampleRate:1;let r=t.dedupWindowMs;this.dedupMs=typeof r=="number"&&r>0?r:0,this.dedupMs>0&&(this.deduper=new Qn(this.dedupMs,g=>{this.record(g),e.emit(g)},()=>{this.counters.dropped++})),this.denyUrls=(p=t.denyUrls)!=null?p:[],this.beforeSend=t.beforeSend,t.captureBodies&&(this.bodyOpts={bodyMaxBytes:Math.min(Math.max(0,(f=t.bodyMaxBytes)!=null?f:8192),64*1024),contentTypeAllowlist:t.contentTypeAllowlist&&t.contentTypeAllowlist.length?t.contentTypeAllowlist:["application/json","text/plain"]}),this.timingOn=this.timingIndex.install();let s=e.apiBaseUrl,i=g=>!!s&&g.startsWith(s),o=g=>this.handle(e,g),a=(h=jl((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(ql(window,o,i,a)),this.uninstalls.push(Hl(window,o,i,a));let c={ws:t.trackWebSocket!==!1,sse:t.trackSse!==!1,beacon:!0},l=typeof navigator!="undefined"?navigator:void 0;Promise.resolve().then(()=>(Zl(),Ql)).then(g=>{this.active&&this.uninstalls.push(...g.installStreams(window,l,o,i,c))}).catch(()=>{}),this.active=!0}handle(e,t){var s;if(this.denyUrls.some(i=>fy(i,t.url))){this.counters.dropped++;return}let r=(s=t.protocol)!=null?s:"http";if(this.timingOn&&r==="http"&&t.timing===void 0){setTimeout(()=>{if(!this.active)return;let i=this.timingIndex.match(t.url,t.startedAt);i.timing&&(t.timing=i.timing),i.transferSize!==void 0&&t.transferSize===void 0&&(t.transferSize=i.transferSize),this.finalize(e,t)},0);return}this.finalize(e,t)}finalize(e,t){var o;let r=(o=t.protocol)!=null?o:"http",s=r==="http"&&t.graphql===void 0&&this.maybeGraphql(t),i=!!this.bodyOpts&&r==="http";if(s||i){Promise.resolve().then(()=>(cd(),ad)).then(a=>a.enrichHttpCapture(t,{graphql:s,body:i?this.bodyOpts:void 0})).catch(()=>{}).finally(()=>{this.active&&this.emit(e,t)});return}this.emit(e,t)}maybeGraphql(e){return e.method!=="POST"?!1:/graphql/i.test(e.url)||!!e.reqBody&&e.reqBody.includes("query")}emit(e,t){let r=Vl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!Kl({failed:!!r.failure,slow:!!r.slow,key:`${t.url}|${t.startedAt}`},this.sampleRate)){this.counters.dropped++;return}this.counters.sampledIn++}if(this.beforeSend)try{let s=this.beforeSend(r);if(s==null){this.counters.dropped++;return}r=s}catch{}r.failure&&r.failure!=="abort"&&e.signal("network_error"),this.emitItem(e,r)}emitItem(e,t){if(this.deduper){this.deduper.push(t);return}this.record(t),e.emit(t)}record(e){var s;this.counters.captured++;let t=(s=e.protocol)!=null?s:"http";this.counters.byProtocol[t]++;let r=e.failure;r&&this.counters.byFailure[r]++,(e.request||e.response)&&this.counters.bodiesCaptured++}teardown(){var e;for(let t of this.uninstalls)t();this.uninstalls=[],(e=this.deduper)==null||e.dispose(),this.deduper=void 0,this.timingIndex.teardown(),this.timingOn=!1,this.active=!1}};$s();function ld(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function xi(){return{max:0,cur:0,first:0,last:0}}function dd(n,e){for(let t of e){if(t.hadRecentInput||typeof t.value!="number")continue;let r=typeof t.startTime=="number"?t.startTime:n.last;n.cur>0&&r-n.last<1e3&&r-n.first<5e3?(n.cur+=t.value,n.last=r):(n.cur=t.value,n.first=r,n.last=r),n.cur>n.max&&(n.max=n.cur)}return n}function ud(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function Si(n){if(n)return n.replace(/[?#].*$/,"")}function pd(){if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let n=performance.getEntriesByType("navigation")[0];if(!n||!(n.responseStart>0))return;let e=(t,r)=>t>0&&r>=t?Math.round(r-t):0;return{redirect:e(n.redirectStart,n.redirectEnd),worker:e(n.workerStart,n.fetchStart),dns:e(n.domainLookupStart,n.domainLookupEnd),tcp:e(n.connectStart,n.connectEnd),tls:e(n.secureConnectionStart,n.connectEnd),request:e(n.requestStart,n.responseStart)}}function fd(n){var a,c,l,u;if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let e=performance.getEntriesByType("navigation")[0],t=Math.max(0,(a=e==null?void 0:e.responseStart)!=null?a:0),r=(l=(c=n.renderTime)!=null?c:n.loadTime)!=null?l:0;if(r<=0)return;let s=t,i=(u=n.loadTime)!=null?u:r;if(n.url){let d=performance.getEntriesByName(n.url)[0];d&&(s=Math.max(t,d.requestStart||d.startTime||t),i=n.loadTime||d.responseEnd||i)}let o=d=>Math.round(Math.max(0,d));return{ttfb:o(t),resourceLoadDelay:o(s-t),resourceLoadTime:n.url?o(i-s):0,elementRenderDelay:o(r-(n.url?i:t))}}function md(n,e){let t;for(let r of n)if(!(r.end<e.start||r.start>e.end))for(let s of r.scripts)s.url&&(!t||s.dur>t.duration)&&(t={url:s.url,duration:Math.round(s.dur),fn:s.fn,invokerType:s.invokerType});return t}var my={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function hd(n,e){let t=my[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function ki(n){if(!n||typeof n.tagName!="string")return;let e=[],t=n,r=0;for(;t&&t.nodeType===1&&r<5;){if(t.id){e.unshift(`#${gd(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${gd(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=hy(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function hy(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function gd(n){return n.replace(/([^\w-])/g,"\\$1")}function bd(n){if(n)return{x:De(n.x),y:De(n.y),width:De(n.width),height:De(n.height)}}function De(n){return typeof n=="number"&&isFinite(n)?n:0}function yd(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=ki(e),s=e&&typeof e.tagName=="string"?e.tagName.toLowerCase():void 0,i=typeof n.loadTime=="number"?n.loadTime:void 0,o=typeof n.renderTime=="number"?n.renderTime:void 0;if(!r&&!t&&!s&&i===void 0&&o===void 0)return;let a={};return r&&(a.element=r),s&&(a.elementTag=s),t&&(a.url=t),i!==void 0&&(a.loadTime=Jt(i)),o!==void 0&&(a.renderTime=Jt(o)),a}function Ei(){return{largestValue:0,sources:[]}}function vd(n,e,t=5){var r;for(let s of e){if(s.hadRecentInput)continue;let i=De(s.value);if(i<=0||i<=n.largestValue)continue;let o=s.sources||[],a=[];for(let c of o.slice(0,t)){let l=(r=c.node)!=null?r:void 0;a.push({selector:ki(l),previousRect:bd(c.previousRect),currentRect:bd(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function wd(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function Ii(){return{duration:0}}function xd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=gy(t))}return n}function gy(n){var c;let e=(c=n.target)!=null?c:void 0,t=De(n.startTime),r=De(n.processingStart),s=De(n.processingEnd),i=De(n.duration),o={},a=ki(e);return a&&(o.element=a),e&&typeof e.tagName=="string"&&(o.elementTag=e.tagName.toLowerCase()),typeof n.name=="string"&&(o.eventType=n.name),r>0&&(o.inputDelay=Jt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Jt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Jt(Math.max(0,t+i-s))),o}function Sd(n){return n.duration>0?n.attribution:void 0}function Jt(n){return Math.round(n)}$();var nr=class nr{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=xi();this.inp=0;this.clsAcc=Ei();this.inpAcc=Ii();this.route="/";this.loaf=[]}get isActive(){return this.active}setup(e){this.ctx=e,typeof PerformanceObserver!="undefined"&&(this.disconnects.push(Pe("largest-contentful-paint",t=>{var s,i;let r=ld(t);r&&(this.lcp=r,this.lcpAttr=(s=yd(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=Si(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{dd(this.clsState,t),vd(this.clsAcc,t)})),this.disconnects.push(Pe("event",t=>{let r=this.inp;for(let s of t)typeof s.duration=="number"&&s.duration>r&&typeof s.startTime=="number"&&(r=s.duration,this.inpWindow={start:s.startTime,end:s.startTime+s.duration});this.inp=ud(this.inp,t),xd(this.inpAcc,t)},{durationThreshold:40})),this.disconnects.push(Pe("long-animation-frame",t=>{var r,s,i;for(let o of t){if(this.loaf.length>=nr.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=Si(l.sourceURL||l.name||""))!=null?u:"",dur:typeof l.duration=="number"?l.duration:0,fn:l.sourceFunctionName,invokerType:l.invokerType}});this.loaf.push({start:a,end:a+((i=o.duration)!=null?i:0),scripts:c})}})),this.disconnects.push(Pe("paint",t=>{let r=t.find(s=>s.name==="first-contentful-paint");r&&this.emit("fcp",r.startTime,"ms")})),this.route=Ed(kd()),this.installRouteDetection(),this.emitTtfb(),typeof document!="undefined"&&(this.hideHandler=()=>{document.visibilityState==="hidden"&&this.finalizeRoute()},document.addEventListener("visibilitychange",this.hideHandler)),this.active=!0)}emitTtfb(){try{let e=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0;e&&e.responseStart>0&&this.emit("ttfb",e.responseStart,"ms",{ttfbPhases:pd()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=fd(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=Sd(this.inpAcc);if(t&&this.inpWindow){let r=md(this.loaf,this.inpWindow);r&&(t.loafScript=r)}this.emit("inp",this.inp,"ms",t)}e>0&&this.emit("cls",Math.round(e*1e3)/1e3,"score",wd(this.clsAcc)),this.lcp=this.inp=0,this.clsState=xi(),this.lcpAttr=void 0,this.clsAcc=Ei(),this.inpAcc=Ii(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=Ed(kd());e!==this.route&&(this.finalizeRoute(),this.route=e)}installRouteDetection(){let e=typeof window!="undefined"?window:void 0;if(!e)return;let t=()=>this.onRouteChange(),r=e.navigation;if(r&&typeof r.addEventListener=="function"){r.addEventListener("currententrychange",t),this.routeStop=()=>r.removeEventListener("currententrychange",t);return}e.addEventListener("popstate",t);let s=e.history,i=s.pushState,o=s.replaceState,a=c=>function(...l){let u=c.apply(this,l);return t(),u};try{s.pushState=a(i),s.replaceState=a(o)}catch{}this.routeStop=()=>{e.removeEventListener("popstate",t);try{s.pushState=i,s.replaceState=o}catch{}}}emit(e,t,r,s){var o,a,c;let i={kind:"performance",metric:e,value:r==="score"?t:Math.round(t),unit:r,screenName:this.route,clientId:`vit_${H()}`,timestamp:P()};s&&(i.attribution=s),(o=this.ctx)==null||o.emit(i),(c=(a=this.ctx)==null?void 0:a.signal)==null||c.call(a,"web_vital",{metric:e,value:i.value,unit:r,rating:hd(e,i.value),path:this.route})}teardown(){var e;for(let t of this.disconnects)t();this.disconnects=[],this.hideHandler&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.hideHandler),(e=this.routeStop)==null||e.call(this),this.routeStop=void 0,this.active=!1}};nr.LOAF_CAP=30;var tr=nr;function kd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function Ed(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}$();Ci();$();var by=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Qt(n,e,t={}){var r;return{kind:"performance",metric:j(n),value:Math.round(e*1e3)/1e3,unit:(r=t.unit)!=null?r:"ms",screenName:by(),clientId:`perf_${H()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Zt=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:60,this.windowMs=(r=e==null?void 0:e.windowMs)!=null?r:1e4}accept(){let e=Date.now();return this.recent=this.recent.filter(t=>e-t<this.windowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(e),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var sr=class{constructor(e){this.open=new Map;this.dropped=0;var t,r,s;this.maxOpen=(t=e==null?void 0:e.maxOpen)!=null?t:100,this.ttlMs=(r=e==null?void 0:e.ttlMs)!=null?r:6e4,this.clock=(s=e==null?void 0:e.clock)!=null?s:Date.now}start(e){if(e){if(this.expire(),!this.open.has(e)&&this.open.size>=this.maxOpen){this.dropped++;return}this.open.set(e,this.clock())}}stop(e){this.expire();let t=this.open.get(e);return t==null?null:(this.open.delete(e),{name:e,durationMs:this.clock()-t})}expire(){let e=this.clock();for(let[t,r]of this.open)e-r>this.ttlMs&&(this.open.delete(t),this.dropped++)}takeDropped(){let e=this.dropped;return this.dropped=0,e}clear(){this.open.clear(),this.dropped=0}};$();function Ad(n){var t,r;let e=n;return{value:(t=e.duration)!=null?t:0,metadata:{startTime:Math.round((r=e.startTime)!=null?r:0)}}}function Rd(n){var i,o,a,c,l,u,d,p,f,m;let e=n,t=Array.isArray(e.scripts)?e.scripts:[],r;for(let h of t)(!r||((i=h.duration)!=null?i:0)>((o=r.duration)!=null?o:0))&&(r=h);let s={frameDuration:Math.round((a=e.duration)!=null?a:0),startTime:Math.round((c=e.startTime)!=null?c:0)};if(r){let h={url:j(String((u=(l=r.sourceURL)!=null?l:r.name)!=null?u:"")),invoker:j(String((d=r.invoker)!=null?d:"")),duration:Math.round((p=r.duration)!=null?p:0)};r.sourceFunctionName&&(h.fn=String(r.sourceFunctionName)),r.sourceCharPosition!=null&&r.sourceCharPosition>=0&&(h.pos=r.sourceCharPosition),r.forcedStyleAndLayoutDuration&&(h.forcedLayout=Math.round(r.forcedStyleAndLayoutDuration)),r.invokerType&&(h.invokerType=String(r.invokerType)),s.script=h}return{value:(m=(f=e.blockingDuration)!=null?f:e.duration)!=null?m:0,metadata:s}}var yy=new Set(["fetch","xmlhttprequest","beacon"]);function vy(n){return n.replace(/[?#].*$/,"")}function en(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ai="";function Td(n){Ai=(n!=null?n:"").replace(/\/$/,"")}function wy(n){return!!Ai&&n.startsWith(Ai)}function Md(n){if(yy.has(n.initiatorType)||wy(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:vy(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",en(n.domainLookupStart,n.domainLookupEnd)),r("tcp",en(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?en(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",en(n.requestStart,n.responseStart)),r("download",en(n.responseStart,n.responseEnd)),r("transferSize",n.transferSize||void 0),r("encodedSize",n.encodedBodySize||void 0),r("decodedSize",n.decodedBodySize||void 0);let s=n.renderBlockingStatus;return s&&(t.renderBlocking=s),{value:e,metadata:t}}function Pd(n){if(typeof window=="undefined"||typeof history=="undefined"||typeof location=="undefined")return()=>{};let e=()=>location.pathname+location.search,t=e(),r=()=>{let o=e();if(o!==t){t=o;try{n(o)}catch{}}},s=history.pushState,i=history.replaceState;return history.pushState=function(...a){let c=s.apply(this,a);return r(),c},history.replaceState=function(...a){let c=i.apply(this,a);return r(),c},window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{history.pushState=s,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}}Fe();var xy="wzb-traces-v1";function Ld(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${xy}`)%100<n.sampleRate*100}ar();var ky=1e3,Ey=3e3,Iy=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function Cy(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var dr=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Zt;this.resCap=new Zt({capCount:100,windowMs:1e4});this.traces=new sr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=Ey;this.droppedTxns=0;this.txnCount=0;this.resourceCount=0;this.jankCount=0}get isActive(){return this.active}setup(e){if(this.active)return;this.ctx=e,Td(e.apiBaseUrl);let t=e.performanceOptions;t&&(typeof t.tracesSampleRate=="number"&&(this.tracesSampleRate=t.tracesSampleRate),typeof t.slowTransactionMs=="number"&&(this.slowTxnMs=t.slowTransactionMs)),Promise.resolve().then(()=>(Hd(),qd)).then(s=>{this.engine=s,this.tryEmitPageload()}).catch(()=>{});let r=()=>{var i,o;let s=(o=(i=performance.getEntriesByType)==null?void 0:i.call(performance,"navigation"))==null?void 0:o[0];s&&(this.navEntry=s,this.tryEmitPageload())};if(typeof document!="undefined"&&document.readyState==="complete"?r():typeof window!="undefined"&&window.addEventListener("load",()=>setTimeout(r,0),{once:!0}),this.disconnects.push(Pd(s=>this.onRouteChange(s))),typeof window!="undefined"){let s=()=>this.finishRouteTxn();window.addEventListener("pagehide",s),this.disconnects.push(()=>window.removeEventListener("pagehide",s))}if(e.onSignal&&this.disconnects.push(e.onSignal(s=>{var i;s==="error"&&((i=this.activeTxn)==null||i.noteError())})),typeof PerformanceObserver=="undefined"){this.active=!0;return}Cy()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,Rd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,Ad(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=Md(i);o&&this.emitResource(o)}})),this.active=!0}emitResource(e){var s;if(!this.resCap.accept())return;let t=this.resCap.takeDropped(),r=t>0?{...e.metadata,droppedSince:t}:e.metadata;this.resourceCount++,(s=this.ctx)==null||s.emit(Qt("resource",e.value,{unit:"ms",duration:e.value,metadata:r}))}perfStats(){return{transactions:this.txnCount,droppedTransactions:this.droppedTxns,resources:this.resourceCount,jank:this.jankCount,activeTransaction:!!this.activeTxn,sampleRate:this.tracesSampleRate}}emitCapped(e,t,r){var a,c,l;if(!this.cap.accept())return;let s=this.cap.takeDropped(),i=s>0?{...r.metadata,droppedSince:s}:r.metadata;this.jankCount++,(a=this.ctx)==null||a.emit(Qt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;Id({metric:e,blockingMs:r.value,frameDurationMs:e==="loaf"?Number((c=i.frameDuration)!=null?c:t.duration):t.duration,script:o?{url:o.url,invoker:o.invoker}:void 0}),(l=this.activeTxn)==null||l.addSpan(e,t.startTime,t.startTime+t.duration,r.metadata)}startTransaction(e){if(!this.engine)return or;let t=new this.engine.Transaction(e,{clock:Iy,onFinish:r=>this.emitTransaction(r)});return this.activeTxn=t,t}getActiveTraceContext(){var e;return(e=this.activeTxn)==null?void 0:e.context()}emitTransaction(e){this.activeTxn===e&&(this.activeTxn=void 0),this.emitTransactionData(e.data())}emitTransactionData(e){var r,s,i,o;if(e.durationMs>=this.slowTxnMs&&((s=(r=this.ctx)==null?void 0:r.signal)==null||s.call(r,"slow_screen")),!Ld({traceId:e.traceId,durationMs:e.durationMs,slowMs:this.slowTxnMs,sampleRate:this.tracesSampleRate,hasError:((i=e.errorCount)!=null?i:0)>0})){this.droppedTxns++;return}this.txnCount++;let t=ne();(o=this.ctx)==null||o.emit(Qt("transaction",e.durationMs,{unit:"ms",duration:e.durationMs,metadata:{kind:"transaction",name:e.name,trace:{traceId:e.traceId,spanId:e.spanId,sampled:e.sampled},spans:e.spans,...e.droppedSpans?{droppedSpans:e.droppedSpans}:{},...e.errorCount?{errorCount:e.errorCount}:{},...t?{replay:t}:{}}}))}tryEmitPageload(){if(this.pageloadEmitted||!this.engine||!this.navEntry||!this.navEntry.loadEventEnd)return;this.pageloadEmitted=!0;let e=typeof location!="undefined"?location.pathname:"/";this.emitTransactionData(this.engine.buildPageload(this.navEntry,e))}onRouteChange(e){this.finishRouteTxn(),this.routeTxn=this.startTransaction(`navigation ${e}`),typeof setTimeout!="undefined"&&(this.routeTimer=setTimeout(()=>this.finishRouteTxn(),ky))}finishRouteTxn(){var e;this.routeTimer!==void 0&&(clearTimeout(this.routeTimer),this.routeTimer=void 0),(e=this.routeTxn)==null||e.finish(),this.routeTxn=void 0}startTrace(e){this.traces.start(e)}stopTrace(e){var r;let t=this.traces.stop(e);t&&((r=this.ctx)==null||r.emit(Qt(t.name,t.durationMs,{unit:"ms",duration:t.durationMs,metadata:{kind:"trace"}})))}teardown(){this.finishRouteTxn();for(let e of this.disconnects)e();this.disconnects=[],this.traces.clear(),this.active=!1}};$();var pr=class{constructor(e){this.onScreen=e;this.last="";this.cleanup=[]}start(){if(typeof window!="undefined"){if(typeof document!="undefined"&&document.prerendering){let e=()=>this.begin();document.addEventListener("prerenderingchange",e,{once:!0}),this.cleanup.push(()=>document.removeEventListener("prerenderingchange",e));return}this.begin()}}begin(){this.last=ur(),this.onScreen("",this.last);let e=window.navigation;if(e&&typeof e.addEventListener=="function"){let a=c=>{var u;let l=(u=c.destination)==null?void 0:u.url;this.check(l?Ay(l):ur())};e.addEventListener("navigate",a),this.cleanup.push(()=>e.removeEventListener("navigate",a))}let t=history,r=t.pushState,s=t.replaceState,i=()=>this.check();t.pushState=function(...a){let c=r.apply(this,a);return i(),c},t.replaceState=function(...a){let c=s.apply(this,a);return i(),c},this.cleanup.push(()=>{t.pushState=r,t.replaceState=s});let o=()=>this.check();window.addEventListener("popstate",o),window.addEventListener("pageshow",o),this.cleanup.push(()=>{window.removeEventListener("popstate",o),window.removeEventListener("pageshow",o)})}check(e=ur()){if(e&&e!==this.last){let t=this.last;this.last=e,this.onScreen(t,e)}}stop(){for(let e of this.cleanup)e();this.cleanup=[]}};function ur(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Ay(n){try{return new URL(n).pathname}catch{return ur()}}var fr=class{constructor(e=800,t=30,r=3){this.windowMs=e;this.radius=t;this.min=r;this.history=[]}push(e,t,r){this.history=this.history.filter(i=>r-i.t<this.windowMs);let s=this.history.filter(i=>Math.hypot(i.x-e,i.y-t)<=this.radius);return this.history.push({x:e,y:t,t:r}),s.length+1>=this.min}},mr=class{constructor(e=700){this.deadMs=e;this.lastChangeT=0;this.observer=null;this.timers=new Set;this.startHref=""}observe(e){typeof MutationObserver!="undefined"&&(this.startHref=$d(),this.observer=new MutationObserver(()=>{this.lastChangeT=Date.now()}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}onClick(e,t){let r=setTimeout(()=>{this.timers.delete(r),this.lastChangeT<e&&$d()===this.startHref&&t()},this.deadMs);this.timers.add(r)}disconnect(){var e;(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.timers)clearTimeout(t);this.timers.clear()}};function $d(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function zd(n){let e=0;for(let t=n;t;t=t.parentElement){let r=getComputedStyle(t).position;if(r==="fixed")return 1;r==="sticky"&&(e=2)}return e}var hr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new fr((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new mr((a=t.deadMs)!=null?a:700),this.maskText=(c=t.maskText)!=null?c:!1}start(){typeof document!="undefined"&&(this.dead.observe(document),this.onClickFn=e=>{var d,p;let t=e,r=Date.now(),s=e.target;if(!s||!s.tagName)return;if(!s.hasAttribute("data-scalebun")){let f=(d=e.composedPath)==null?void 0:d.call(e)[0];f&&f.tagName&&(s=f)}let i=_y(s,this.maskText),o=Oy(s),a=Ry(t),c=My(s),l=this.rage.push(t.clientX,t.clientY,r),u={action:"click",...a,selector:o,...c};l&&(u.rage=!0),this.emit("USER_ACTION",u,i),l&&((p=this.signal)==null||p.call(this,"rage")),this.dead.onClick(r,()=>{var f;this.emit("USER_ACTION",{...u,dead:!0},i),(f=this.signal)==null||f.call(this,"dead")})},document.addEventListener("click",this.onClickFn,!0))}stop(){this.dead.disconnect(),this.onClickFn&&typeof document!="undefined"&&document.removeEventListener("click",this.onClickFn,!0)}};function Ry(n){var t,r,s;let e=typeof window!="undefined"?window:void 0;return{x:n.clientX,y:n.clientY,vw:(t=e==null?void 0:e.innerWidth)!=null?t:0,vh:(r=e==null?void 0:e.innerHeight)!=null?r:0,sx:e?Math.round(e.scrollX):0,sy:e?Math.round(e.scrollY):0,dh:document.documentElement.scrollHeight,dpr:(s=e==null?void 0:e.devicePixelRatio)!=null?s:1}}function Ty(n){let e=(n.getAttribute("href")||"").replace(/[?#].*$/,"");if(e)return"h"+e;let t=(n.getAttribute("aria-label")||"").trim();if(t&&t.length<33&&!/@|\d{4,}/.test(t))return"a"+t;let r=n.getAttribute("type");return r?"y"+r:void 0}function My(n){var a;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=zd(n);r&&(t.fx=r),t.path=Py(n);let s=Ty(n);s&&(t.cx=s);let i=Xa();i&&(t.ui=i);let o=(a=n.closest("[data-scalebun-component]"))==null?void 0:a.getAttribute("data-scalebun-component");return o&&(t.component=o),t}function Py(n){let e=[],t=n;for(let r=0;t&&r<6;r++){let s=t.tagName.toLowerCase();if(s==="html"||s==="body")break;if(t.id){e.unshift(`${s}#${t.id}`);break}let i=t.parentElement;if(i){let o=0,a=0,c=i.children,l=t;for(let u=0;u<c.length;u++){let d=c[u];!d||d.tagName!==l.tagName||(a++,d===l&&(o=a))}e.unshift(a>1?`${s}:nth-of-type(${o})`:s)}else e.unshift(s);t=i}return e.join(">")}var Ly=n=>n.replace(/\S/g,"*");function _y(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Ly(r):r}`:t}function Oy(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}var gr=class{constructor(){this.name="journey";this.ctx=null;this.active=!1}get isActive(){return this.active}setup(e){this.ctx=e,!(typeof window=="undefined"||typeof document=="undefined")&&(this.nav=new pr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new hr((t,r,s)=>this.emit(t,r,s,Ud()),{maskText:e.maskEventText===!0},t=>{var r;return(r=this.ctx)==null?void 0:r.signal(t)}),this.nav.start(),this.interactions.start(),this.active=!0)}emit(e,t,r,s){var a;let i=ne(),o={kind:"event",name:e,props:i?{...t,replayCoord:i}:t,label:r,screenName:s!=null?s:Ud(),eventId:`evt_${H()}`,timestamp:P()};(a=this.ctx)==null||a.emit(o)}teardown(){var e,t;(e=this.nav)==null||e.stop(),(t=this.interactions)==null||t.stop(),this.active=!1}};function Ud(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Bs();$();var Ny={maxDepth:4,maxBreadth:50,maxLength:8192};function Ti(n,e,t,r){if(n===null)return"null";if(n===void 0)return"undefined";let s=typeof n;if(s==="string")return n;if(s==="number"||s==="boolean"||s==="bigint")return String(n);if(s==="symbol")return n.toString();if(s==="function"){let o=n.name;return`[Function${o?`: ${o}`:""}]`}let i=n;if(t.has(i))return"[Circular]";if(n instanceof Error)return`${n.name}: ${n.message}`;if(e>=r.maxDepth)return Array.isArray(n)?"[Array]":"[Object]";t.add(i);try{if(Array.isArray(n)){let d=n.slice(0,r.maxBreadth).map(f=>Ti(f,e+1,t,r)),p=n.length>r.maxBreadth?`, \u2026(+${n.length-r.maxBreadth} more)`:"";return`[${d.join(", ")}${p}]`}if(n instanceof Map)return`Map(${n.size})`;if(n instanceof Set)return`Set(${n.size})`;let o=n.nodeName;if(typeof o=="string"){let d=n.id;return`<${o.toLowerCase()}${d?` #${String(d)}`:""}>`}let a=Object.keys(n),l=a.slice(0,r.maxBreadth).map(d=>{let p=Ti(n[d],e+1,t,r);return`${d}: ${p}`}),u=a.length>r.maxBreadth?`, \u2026(+${a.length-r.maxBreadth} more)`:"";return`{${l.join(", ")}${u}}`}finally{t.delete(i)}}function Vd(n,e){let t={...Ny,...e},r;try{r=n.map(s=>Ti(s,0,new WeakSet,t)).join(" ")}catch{r="[unserializable console arguments]"}return r.length>t.maxLength&&(r=r.slice(0,t.maxLength)+"\u2026(truncated)"),r}function Wd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Mi(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var By=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function jd(n,e,t=0){let r=Mi(n),s=j(Vd(e)),i={method:n},o=By();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Wd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${H()}`,metadata:i,timestamp:P()}}var br=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:100,this.capWindowMs=(r=e==null?void 0:e.capWindowMs)!=null?r:1e4}accept(e){if(e==="warn"||e==="error")return!0;let t=Date.now();return this.recent=this.recent.filter(r=>t-r<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(t),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var Fy=["debug","info","log","warn","error"],Dy=50,yr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new br;this.originals=new Map;this.capturing=!1;this.ring=[]}get isActive(){return this.active}setup(e){if(!this.active&&(this.ctx=e,typeof console!="undefined")){for(let t of Fy){let r=console[t];if(typeof r!="function")continue;this.originals.set(t,r);let s=(...i)=>{try{r.apply(console,i)}catch{}this.capture(t,i)};console[t]=s}this.active=!0}}capture(e,t){var r;if(!this.capturing&&!(t.length>0&&t[0]===Ns)){this.capturing=!0;try{if(!this.throttle.accept(Mi(e)))return;let s=jd(e,t,this.throttle.takeDropped());this.pushRing(s),(r=this.ctx)==null||r.emit(s)}catch{}finally{this.capturing=!1}}}pushRing(e){this.ring.push(e),this.ring.length>Dy&&this.ring.shift()}getRecent(){return this.ring.slice()}teardown(){if(typeof console!="undefined")for(let[e,t]of this.originals)console[e]=t;this.originals.clear(),this.ring.length=0,this.active=!1}};var vr=class{constructor(){this.name="bugReport";this.ctx=null;this.active=!1;this.submitFn=null;this.widget=null;this.mounting=!1}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}signalReport(){var e;(e=this.ctx)==null||e.signal("report")}setSubmit(e){this.submitFn=e}async mountLauncher(e){if(!(this.widget||this.mounting||typeof document=="undefined")){this.mounting=!0;try{let{createBugReportWidget:t}=await Promise.resolve().then(()=>(Xd(),Gd));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve({e:"init"})})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};$();var Yd="scalebun:tab",Jd="scalebun:live:";function Li(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Uy(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Pi(){try{let n=globalThis.crypto;if(n&&typeof n.randomUUID=="function")return n.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}function Qd(){let n=Uy();if(!n)return`mem-${Pi()}`;try{let e=n.getItem(Yd);if(e)return e;let t=Pi();return n.setItem(Yd,t),t}catch{return`mem-${Pi()}`}}var _i=n=>`${Jd}${n}`;function wr(n){let e=Li();if(!e)return null;try{let t=e.getItem(_i(n));if(!t)return null;let r=JSON.parse(t);return r&&r.v===1&&typeof r.sessionId=="string"?r:null}catch{return null}}function xr(n,e){let t=Li();if(t)try{t.setItem(_i(n),JSON.stringify(e))}catch{}}function Sr(n,e){let t=wr(n);t&&(t.ended=e,t.lastActive=Date.now(),xr(n,t))}function Zd(n){let e=wr(n);e&&(e.lastActive=Date.now(),xr(n,e))}function eu(n,e){let t=Li();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Jd)||i===_i(n)))try{let o=JSON.parse(t.getItem(i)||"{}");o&&(o.ended||e-(o.lastActive||0)>864e5)&&r.push(i)}catch{r.push(i)}}for(let s of r)t.removeItem(s)}catch{}}var Vy=15e3,kr=class{constructor(){this.name="crash";this.ctx=null;this.active=!1;this.tabId=""}get isActive(){return this.active}setup(e){var t;this.ctx=e,typeof window!="undefined"&&(this.installReportingObserver(),this.installLiveness((t=e.sessionId)!=null?t:`sess_${H()}`),this.active=!0)}installReportingObserver(){let e=globalThis.ReportingObserver;if(e)try{this.observer=new e(t=>{for(let r of t)this.handleReport(r)},{buffered:!0}),this.observer.observe()}catch{}}handleReport(e){var o,a,c,l,u,d,p,f;if(e.type==="deprecation")return;let t=(o=e.body)!=null?o:{},r=e.type==="crash",s=r?`Browser crash report: ${(a=t.reason)!=null?a:"unknown"}`:(c=t.message)!=null?c:`${e.type} report`,i=t.sourceFile?`${t.sourceFile}:${(l=t.lineNumber)!=null?l:0}:${(u=t.columnNumber)!=null?u:0}`:void 0;this.emitError({type:r?"crash":"handled",message:s,stack:i,fingerprint:`report:${e.type}:${(p=(d=t.reason)!=null?d:t.id)!=null?p:s}`.slice(0,180),metadata:{reportType:e.type,reason:t.reason,anticipated:t.anticipated,url:e.url}}),r&&((f=this.ctx)==null||f.signal("error"))}installLiveness(e){var s;this.tabId=Qd();let t=wr(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();xr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=tu())!=null?s:"",ended:!1}),eu(this.tabId,r),this.onHide=()=>Sr(this.tabId,!0),this.onShow=()=>Sr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Zd(this.tabId),Vy)}emitRecoveredCrash(e){var s,i,o;let t=Math.max(0,e.lastActive-e.startedAt),r=this.buildError({type:"crash",message:"Session ended abnormally (tab crash, OOM, or forced close \u2014 no graceful shutdown)",fingerprint:"session-abnormal-termination",screenName:e.screen||void 0,metadata:{reason:"unfinalized-session",priorSessionId:e.sessionId,durationMs:t,lastScreen:e.screen},timestamp:e.lastActive});if((s=this.ctx)!=null&&s.emitFor){this.ctx.emitFor(e.sessionId,r);return}(i=this.ctx)==null||i.emit({...r,type:"handled"}),(o=this.ctx)==null||o.signal("error")}buildError(e){var t,r;return{kind:"error",type:e.type,message:j(e.message),stack:e.stack,source:"js",fingerprint:e.fingerprint,screenName:(t=e.screenName)!=null?t:tu(),clientId:`crash_${H()}`,timestamp:(r=e.timestamp)!=null?r:P(),...e.metadata?{metadata:e.metadata}:{}}}emitError(e){var t;(t=this.ctx)==null||t.emit(this.buildError(e))}teardown(){if(this.observer){try{this.observer.disconnect()}catch{}this.observer=void 0}this.heartbeat&&clearInterval(this.heartbeat),this.heartbeat=void 0,typeof window!="undefined"&&(this.onHide&&window.removeEventListener("pagehide",this.onHide),this.onShow&&window.removeEventListener("pageshow",this.onShow)),this.tabId&&Sr(this.tabId,!0),this.active=!1}};function tu(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Wt();var Wy=50,Er=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.buffer=new Be("engage-pending")}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;e.platform&&t.set("platform",e.platform),e.appVersion&&t.set("appVersion",e.appVersion),e.deviceId&&t.set("deviceId",e.deviceId),e.endUserId&&t.set("endUserId",e.endUserId);try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}postImpressions(e){return this.post("/sdk/engage/surveys/impressions",{schemaVersion:1,impressions:e})}postResponses(e){return this.postWithRetry("/sdk/engage/responses",{schemaVersion:1,responses:e})}postEvents(e){return this.post("/sdk/engage/events",{schemaVersion:1,events:e})}postRatingEvents(e){return this.postWithRetry("/ingestion/rating-events",{schemaVersion:1,events:e})}async presignAttachments(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/engage/attachments/presign`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,attachments:e})});return t.ok?await t.json():null}catch{return null}}async putBlob(e,t,r){if(typeof fetch=="undefined")return!1;try{return(await fetch(e,{method:"PUT",body:t,headers:{"content-type":r}})).ok}catch{return!1}}async post(e,t){if(!this.usable)return!1;try{return(await fetch(`${this.apiBaseUrl}${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),keepalive:!0})).ok}catch{return!1}}async postWithRetry(e,t,r=3,s=800){for(let i=0;i<r;i++){if(await this.post(e,t))return!0;i<r-1&&await new Promise(o=>setTimeout(o,s*2**i))}return await this.park(e,t),!1}async park(e,t){try{let s=[...await this.buffer.load(),{path:e,body:t}].slice(-Wy);await this.buffer.save(s)}catch{}}async flushParked(){if(!this.usable)return;let e;try{e=await this.buffer.load()}catch{return}if(!e.length)return;let t=[];for(let r of e)!r||typeof r.path!="string"||await this.post(r.path,r.body)||t.push(r);await this.buffer.save(t)}};var jx=32,Kx=3e4,Qf="scalebun_engage_sessions";function Zf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Gx(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var ls=class{constructor(){this.name="engage";this.ctx=null;this.active=!1;this.screen="";this.buffer=[];this.bufferOpen=!0}get isActive(){return this.active}async setup(e){var i;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(i=e.clientKey)!=null?i:"";if(!t||!e.apiBaseUrl)return;this.transport=new Er(e.apiBaseUrl,t),this.screen=Zf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(o=>this.onSignal(o)),this.onPop=()=>this.onScreenView(Zf()),window.addEventListener("popstate",this.onPop);let{count:r,isNewSession:s}=this.bumpSessionCount();s&&(this.onLifecycle("session_start"),this.onLifecycle("app_open"),this.onLifecycle("n_sessions",r)),await this.refresh()}async refresh(){var i,o,a,c,l,u;if(!this.transport)return;let e=await this.transport.fetchConfig({platform:"web",appVersion:(i=this.ctx)==null?void 0:i.appVersion,deviceId:(o=this.ctx)==null?void 0:o.deviceId,endUserId:(c=(a=this.ctx)==null?void 0:a.getUserId)==null?void 0:c.call(a)});if(!Gx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Fi(),ou)),r=t(e),s=await this.ensureRuntime();s&&(s.setCampaigns(r.campaigns),s.setMessages(r.inAppMessages),this.drain(s))}async ensureRuntime(){var t,r,s,i,o;if(this.runtime)return this.runtime;if(!this.transport)return;let{EngageRuntime:e}=await Promise.resolve().then(()=>(Jf(),Yf));return this.runtime=new e({transport:this.transport,deviceId:(r=(t=this.ctx)==null?void 0:t.deviceId)!=null?r:"",sessionId:(i=(s=this.ctx)==null?void 0:s.sessionId)!=null?i:"",uuid:H,now:P,currentScreen:()=>this.screen,replayCoord:ne,signal:a=>{var c;return(c=this.ctx)==null?void 0:c.signal(a)},...(o=this.ctx)!=null&&o.onInAppGameRequest?{gameHandler:this.ctx.onInAppGameRequest}:{}}),this.runtime}async submit(e,t){let r=await this.ensureRuntime();return r?r.submitFor(e,t):"error"}emitRatingEvent(e,t){this.ensureRuntime().then(r=>r==null?void 0:r.emitRatingEvent(e,t))}async resetInAppState(){let{clearEngageState:e}=await Promise.resolve().then(()=>(Ui(),mu));e()}onScreenView(e){this.screen=e,this.feed("screen",e)}onIdentify(){this.active&&this.refresh()}onCustomEvent(e){this.feed("custom",e)}onSignal(e){this.feed("signal",e)}onLifecycle(e,t){this.feed("lifecycle",e,t)}feed(e,t,r){if(this.runtime){this.dispatch(this.runtime,e,t,r,0);return}this.bufferOpen&&(this.buffer.push({ch:e,value:t,arg:r,at:P()}),this.buffer.length>jx&&this.buffer.shift())}dispatch(e,t,r,s,i){switch(t){case"screen":e.onScreenView(r,i);break;case"custom":e.onCustomEvent(r,i);break;case"signal":e.onSignal(r,i);break;case"lifecycle":e.onLifecycle(r,s,i);break}}drain(e){let t=P()-Kx;for(let r of this.buffer)r.at<t||this.dispatch(e,r.ch,r.value,r.arg,P()-r.at);this.closeBuffer()}closeBuffer(){this.bufferOpen=!1,this.buffer=[]}bumpSessionCount(){var e,t;try{let r=(t=(e=this.ctx)==null?void 0:e.sessionId)!=null?t:"",s=localStorage.getItem(Qf),i=s?JSON.parse(s):{};if(r&&i.sessionId===r&&typeof i.count=="number")return{count:i.count,isNewSession:!1};let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(Qf,JSON.stringify({sessionId:r,count:o})),{count:o,isNewSession:!0}}catch{return{count:1,isNewSession:!0}}}teardown(){var e,t;(e=this.unsub)==null||e.call(this),this.unsub=void 0,this.onPop&&typeof window!="undefined"&&window.removeEventListener("popstate",this.onPop),this.onPop=void 0,(t=this.runtime)==null||t.stop(),this.runtime=void 0,this.closeBuffer(),this.active=!1}};$();$o();function Qx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var ds=class{constructor(){this.name="webPerf";this.ctx=null;this.active=!1}get isActive(){return this.active}async setup(e){if(this.ctx=e,typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startCollectors:t}=await Promise.resolve().then(()=>(nm(),tm));this.active&&(this.stop=t((r,s,i,o)=>this.emit(r,s,i,o),()=>this.active))}emit(e,t,r,s){var i;(i=this.ctx)==null||i.emit({kind:"performance",metric:e,value:t,screenName:Qx(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${H()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};var ps=class{constructor(){this.name="exitIntent";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined")return;this.active=!0;let{startExitIntent:t}=await Promise.resolve().then(()=>(dm(),lm));this.active&&(this.handle=t(e,e.exitIntent))}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var Kh=[new Vn,new $n,new jn,new er,new tr,new ds,new dr,new gr,new yr,new vr,new kr,new ls,new ps],Gh={replay:async()=>new(await Promise.resolve().then(()=>(Xm(),Gm))).ReplayFeature,inbox:async()=>new(await Promise.resolve().then(()=>(oh(),ih))).InboxFeature,profiler:async()=>new(await Promise.resolve().then(()=>(ch(),ah))).ProfilerFeature,watchdog:async()=>new(await Promise.resolve().then(()=>(Eh(),kh))).WatchdogFeature,inapp2:async()=>new(await Promise.resolve().then(()=>(jh(),Wh))).InApp2Feature},Ck={config:["network"],analytics:["network"],errors:["dom"],network:["dom"],webVitals:["performanceObserver"],webPerf:["performanceObserver"],performance:["performance"],journey:["dom"],console:["dom"],bugReport:["dom"],crash:["dom"],engage:["dom"],inbox:["dom"],profiler:["dom"],watchdog:["performanceObserver"],exitIntent:["dom"],inapp2:["dom"],replay:["dom"]};function Ba(n){var e;return(e=Ck[n])!=null?e:["dom"]}$();function Ak(n){return n==="frame"?"replay":n==="network"?"networkMonitoring":n==="error"?"crashReporting":n==="performance"||n==="resource"||n==="trace"||n==="transaction"?"performanceMonitoring":""}var fn=class{static async bootstrap(e,t){var b,E,w,I;let r=Ja(e),s=tc(r.debug),i=new In(r),o=new Cn(r),a=new Ln(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new _n;yc(),xc(),typeof((b=r.errors)==null?void 0:b.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),mc((E=r.errors)==null?void 0:E.beforeBreadcrumb);let l=S=>{var M,R;let C=Ak(S.kind);C&&((R=(M=c.get("config"))==null?void 0:M.entitlement)==null?void 0:R.call(M,C))===!1||(bc(S),wc(S),a.emit(S))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var S,C;return(C=(S=c.get("analytics"))==null?void 0:S.identity)==null?void 0:C.userId},emit:l,emitFor:(S,C)=>a.emitFor(S,C),egressPending:()=>a.pendingCount,trackEvent:(S,C)=>l({kind:"event",name:S,props:C,timestamp:Date.now()}),getAppState:()=>gt("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(S,C)=>{for(let M of u)try{M(S,C)}catch{}},onSignal:S=>(u.add(S),()=>u.delete(S)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(w=r.flags)==null?void 0:w.bootstrap,flagsRealtime:(I=r.flags)==null?void 0:I.realtime,replayCanvas:r.replayCanvas,replayFrameOrigins:r.replayFrameOrigins,autocapture:r.autocapture,traceOrigins:r.tracePropagation?[...typeof location!="undefined"?[location.origin]:[],...r.tracePropagationOrigins]:[],maskReplayText:r.privacy.maskReplayText,maskEventText:r.privacy.maskEventText,maskSelectors:r.privacy.maskSelectors,maskInputs:r.privacy.maskInputs,respectDnt:r.privacy.respectDnt,exitIntent:r.exitIntent},p=r.features,f=()=>{for(let S of Kh)p[S.name]!==!1&&Ba(S.name).every(C=>gt(C))&&c.add(S)};f();let m=async()=>{await Promise.all(Object.entries(Gh).map(async([S,C])=>{if(p[S]===!0&&Ba(S).every(M=>gt(M))&&!c.get(S))try{c.add(await C())}catch(M){s(`[scalebun] optional feature "${S}" failed to load:`,M)}}))},h=new vn(r.consent.initial),g=!1,x=async()=>{var C;if(g)return;g=!0,f(),await m(),await c.setupAll(d),t!=null&&t.edge||await a.start();let S=(C=c.get("analytics"))==null?void 0:C.identity;if(S!=null&&S.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:S.userId,anonymousId:S.anonymousId,timestamp:Date.now()}),S){Oe(S.superProps);let M=S.groups;if(M)for(let R of Object.keys(M))Oe({[`group_${R}`]:M[R]});S.userId&&Oe({userId:S.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},y={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:S=>{h.set(S?"granted":"denied"),S?(a.setConsentGranted(!0),x()):(a.setConsentGranted(!1),g&&c.teardownAll(),g=!1,a.discard())},get consentStatus(){return h.value}};return!r.consent.required||h.granted?await x():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:h.value}),y}};$();ar();var Ua=class{constructor(){this.rt=null;this.ready=!1;this.pendingConsent=null;this.pushFeature=null;this.coachFeature=null;this.coachController=null;this.pendingPushOpenCbs=[];this.settle=null;this.settled=new Promise(e=>{this.settle=e});this.replay={stats:()=>{var e,t;return(t=(e=this.replayFeature())==null?void 0:e.stats())!=null?t:null},checkpoint:e=>{var t;return(t=this.replayFeature())==null?void 0:t.checkpoint(e)},flush:()=>{var e;return(e=this.replayFeature())==null?void 0:e.flush()},stop:()=>{var e;return(e=this.replayFeature())==null?void 0:e.teardown()},start:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},pause:()=>{var e;return(e=this.replayFeature())==null?void 0:e.pause()},resume:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},setPrivacy:e=>{var t;return(t=this.replayFeature())==null?void 0:t.setPrivacy(e)}};this.performance={startTransaction:e=>{var r,s,i;let t=(r=this.rt)==null?void 0:r.registry.get("performance");return(i=(s=t==null?void 0:t.startTransaction)==null?void 0:s.call(t,e))!=null?i:or},startTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.startTrace)==null||s.call(t,e)},stopTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.stopTrace)==null||s.call(t,e)},markScreenLoadStart:e=>{},sendMetric:(e,t)=>{var r;(r=this.rt)==null||r.pipeline.emit({kind:"performance",metric:e,value:t,timestamp:P()})}};this.session={start:()=>{},end:()=>{this.close()},emitEvent:(e,t)=>{this.track(e,t)}};this.engage={track:(e,t)=>this.track(e,t),refresh:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.refresh())!=null?t:Promise.resolve()},submit:(e,t)=>{var r,s;return(s=(r=this.engageFeature())==null?void 0:r.submit(e,t))!=null?s:Promise.resolve("error")},emitRatingEvent:(e,t)=>{var r;return(r=this.engageFeature())==null?void 0:r.emitRatingEvent(e,t)},resetInAppState:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.resetInAppState())!=null?t:Promise.resolve()}};this.push={enable:e=>this.enablePush(e),disable:e=>this.ensurePush().then(t=>{var r;return(r=t==null?void 0:t.disable(e))!=null?r:!1}),status:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.status())!=null?t:Promise.resolve({supported:!1,permission:"default",subscribed:!1,endpoint:null,state:"unsupported"})}),getSubscription:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.getSubscription())!=null?t:null}),check:async e=>{let t=await this.ensurePush();return t?t.check(e):(await Promise.resolve().then(()=>(Ha(),qa))).notInitializedReport()}};this.attribution={getInstallationId:()=>{var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.getInstallationId())!=null?t:""},setClickId:e=>{var t;return(t=this.analyticsFeature())==null?void 0:t.setClickId(e)}};this.flagExposed=new Set;this.flags={isEnabled:e=>{var s;let t=this.cfg(),r=(s=t==null?void 0:t.isEnabled(e))!=null?s:!1;return t!=null&&t.knows(e)&&this.recordExposure(e,r),r},variation:(e,t)=>this.flags.variationDetail(e,t).value,variationDetail:(e,t)=>{var i,o,a;let r=(o=(i=this.cfg())==null?void 0:i.variationDetail(e,t))!=null?o:{value:t,variant:null,reason:"FLAG_NOT_FOUND"},s=(a=r.variant)!=null?a:typeof r.value=="object"?null:r.value;return this.recordExposure(e,typeof s=="number"?String(s):s,r.reason),r},ready:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.ready())!=null?t:Promise.resolve()},onChange:e=>{var t,r;return(r=(t=this.cfg())==null?void 0:t.onChange(e))!=null?r:()=>{}},override:(e,t)=>{var r;return(r=this.cfg())==null?void 0:r.override(e,t)},clearOverride:e=>{var t;return(t=this.cfg())==null?void 0:t.clearOverride(e)},clearOverrides:()=>{var e;return(e=this.cfg())==null?void 0:e.clearOverrides()}};this.config={get:(e,t)=>{var r,s;return(s=(r=this.cfg())==null?void 0:r.get(e,t))!=null?s:t},refresh:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.refresh())!=null?t:Promise.resolve()}};this.rollouts={isOn:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.isOn(e))!=null?s:!1;return this.recordExposure(e,t),t}};this.experiments={variant:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.variant(e))!=null?s:null;return this.recordExposure(e,t),t}};this.profiler={available:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.available())!=null?t:!1},start:e=>{var t,r;return(r=(t=this.prof())==null?void 0:t.start(e))!=null?r:!1},stop:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.stop())!=null?t:Promise.resolve(!1)}};this.watchdog={stats:()=>{var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("watchdog");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}}}whenReady(){return this.settled}async init(e){var t,r,s,i,o;if(!this.ready){if(Sn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),Ic()){let a=Ws();if(a==="edge"||a==="worker"){try{this.rt=await fn.bootstrap(e,{edge:!0}),this.ready=!0}catch(c){typeof console!="undefined"&&console.warn("[scalebun] edge init failed:",c)}return}e!=null&&e.debug&&typeof console!="undefined"&&console.warn("[scalebun] init() on SSR \u2014 deferring capture to the client.");return}try{if(this.rt=await fn.bootstrap(e),this.ready=!0,this.pendingConsent!==null&&(this.rt.setConsent(this.pendingConsent),this.pendingConsent=null),this.rt.config.features.bugReport!==!1){let c=this.rt.registry.get("bugReport");(r=c==null?void 0:c.setSubmit)==null||r.call(c,l=>this.reportBugDetailed(l)),this.rt.config.bugReport.launcher&&((s=c==null?void 0:c.mountLauncher)==null||s.call(c,{position:this.rt.config.bugReport.position,label:this.rt.config.bugReport.label}))}let a=(i=e==null?void 0:e.push)==null?void 0:i.softAsk;a&&Promise.resolve().then(()=>(Qh(),Jh)).then(({armSoftAsk:c})=>c(a,{enable:()=>this.enablePush(),permission:()=>Notification.permission})).catch(()=>{})}catch(a){typeof console!="undefined"&&console.warn("[scalebun] init failed:",a)}finally{(o=this.settle)==null||o.call(this)}}}setConsent(e){this.rt?this.rt.setConsent(e):this.pendingConsent=e}track(e,t){var r,s,i,o;(r=this.analyticsFeature())!=null&&r.evaluate(e,t).drop||((s=this.rt)==null||s.pipeline.emit(this.enrichEvent({kind:"event",name:e,props:t,timestamp:P()})),(i=this.analyticsFeature())==null||i.track(e,t),(o=this.engageFeature())==null||o.onCustomEvent(e))}enrichEvent(e){var c;let t=(c=this.analyticsFeature())==null?void 0:c.identity,r=ne(),s=t==null?void 0:t.superProps,i=e.props,o=s&&Object.keys(s).length?{...s,...i!=null?i:{}}:i,a=o&&mt(o);return{...e,...a!==void 0?{props:a}:{},...t!=null&&t.anonymousId?{anonymousId:t.anonymousId}:{},...t!=null&&t.userId?{userId:t.userId}:{},...t!=null&&t.groups&&Object.keys(t.groups).length?{groups:t.groups}:{},...r?{replay:r}:{}}}register(e){var t;(t=this.analyticsFeature())==null||t.register(e),Oe(e)}unregister(e){var t;(t=this.analyticsFeature())==null||t.unregister(e)}group(e,t,r){var s,i;!e||!t||((s=this.analyticsFeature())==null||s.group(e,t,r),Oe({[`group_${e}`]:t}),(i=this.rt)==null||i.pipeline.emit(this.enrichEvent({kind:"event",name:"$group",props:{group_type:e,group_key:t,...r!=null?r:{}},timestamp:P()})))}alias(e,t){var i,o,a,c;if(!e)return;let r=(i=this.analyticsFeature())==null?void 0:i.identity,s=(o=t!=null?t:r==null?void 0:r.userId)!=null?o:r==null?void 0:r.anonymousId;(a=this.analyticsFeature())==null||a.alias(e,t),(c=this.rt)==null||c.pipeline.emit({kind:"identify",userId:e,previousId:s,timestamp:P()})}reset(){var e,t,r,s,i;(e=this.engageFeature())==null||e.onLifecycle("before_logout"),(t=this.analyticsFeature())==null||t.reset(),kc(),(i=this.rt)==null||i.pipeline.emit({kind:"identify",reset:!0,anonymousId:(s=(r=this.analyticsFeature())==null?void 0:r.identity)==null?void 0:s.anonymousId,timestamp:P()})}trackPurchase(e){var r,s,i;let t=On(e);t&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"purchase",props:t.props,revenue:t.revenue,currency:t.currency,timestamp:P()})),(s=this.analyticsFeature())==null||s.trackPurchase(e),(i=this.engageFeature())==null||i.onCustomEvent("purchase"))}trackSubscription(e){var t;(t=this.analyticsFeature())==null||t.trackSubscription(e)}trackScreen(e,t){var r,s;e&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"SCREEN_VIEW",screenName:e,props:t,timestamp:P()})),(s=this.engageFeature())==null||s.onScreenView(e))}identify(e,t){var s,i,o,a,c,l,u,d;let r=(i=(s=this.analyticsFeature())==null?void 0:s.identity)==null?void 0:i.anonymousId;(o=this.rt)==null||o.pipeline.emit({kind:"identify",userId:e,anonymousId:r,traits:t,timestamp:P()}),(a=this.analyticsFeature())==null||a.identify(e,t),Oe({userId:e,...t!=null?t:{}}),(c=this.engageFeature())==null||c.onIdentify(),(d=(u=(l=this.rt)==null?void 0:l.registry.get("inapp2"))==null?void 0:u.onIdentify)==null||d.call(u)}setUser(e){e!=null&&e.id&&this.identify(e.id,e)}captureError(e,t){var a,c,l;let r=t!=null&&t.componentStack?{componentStack:t.componentStack}:void 0,s=t&&(t.level||t.tags||t.context||t.fingerprint)?{level:t.level,tags:t.tags,context:t.context,fingerprint:t.fingerprint}:void 0,i=(a=this.rt)==null?void 0:a.registry.get("errors");if(i!=null&&i.captureHandled){i.captureHandled(e,r,s);return}let o=e;(l=this.rt)==null||l.pipeline.emit({kind:"error",type:"handled",message:(c=o==null?void 0:o.message)!=null?c:String(e),stack:o==null?void 0:o.stack,source:"js",timestamp:P(),...r!=null?r:{}})}addBreadcrumb(e){var t;gc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){Sl(e,t)}setContext(e,t){kl(e,t)}setErrorLevel(e){El(e)}submitRating(e,t,r){var o,a;let s=Math.round(e);if(!Number.isFinite(s)||s<1||s>5){(o=this.rt)==null||o.log("[scalebun] submitRating: score must be an integer 1\u20135, got",e);return}let i={kind:"rating",score:s,comment:t,surveyId:r,clientRatingId:`rat_${H()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(io(),zu));return r(e,t)}async reportBug(e){let t=await this.reportBugDetailed(e);return typeof t=="string"?t:null}async reportBugDetailed(e){var t,r,s,i;if(!this.rt)return{e:"init"};if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),{e:"off"};if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),{e:"empty"};if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),{e:"consent"};try{let o=this.rt.registry.get("bugReport");(t=o==null?void 0:o.signalReport)==null||t.call(o);let a=this.rt.registry.get("console"),c=(s=(r=a==null?void 0:a.getRecent)==null?void 0:r.call(a))!=null?s:[],{buildBugReportPayload:l}=await Promise.resolve().then(()=>(eg(),Zh)),u=ne(),d=l({message:e.message,title:e.title,email:e.email},c,{replayCoord:u}),p=await this.rt.transport.submitBugReport(this.rt.session.sessionId,d);return await this.rt.pipeline.flush(),(i=p==null?void 0:p.id)!=null?i:{e:"send"}}catch{return{e:"send"}}}async flush(){var e,t;await Promise.all([(e=this.rt)==null?void 0:e.pipeline.flush(),(t=this.analyticsFeature())==null?void 0:t.flush()])}errorStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("errors");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}perfStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("performance");return(s=(r=e==null?void 0:e.perfStats)==null?void 0:r.call(e))!=null?s:null}networkStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("network");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}async close(){var e,t;(e=this.rt)==null||e.registry.teardownAll(),await((t=this.rt)==null?void 0:t.pipeline.stop()),this.rt=null,this.ready=!1}get sessionId(){var e;return(e=this.rt)==null?void 0:e.session.sessionId}egressStats(){var r,s,i,o,a,c,l,u,d,p,f,m,h;let e=this.analyticsFeature(),t=(r=this.rt)==null?void 0:r.pipeline.ledger;return{pending:((i=(s=this.rt)==null?void 0:s.pipeline.pendingCount)!=null?i:0)+((o=e==null?void 0:e.pending)!=null?o:0),dropped:((c=(a=this.rt)==null?void 0:a.pipeline.dropped)!=null?c:0)+((l=e==null?void 0:e.dropped)!=null?l:0),queued:(u=t==null?void 0:t.queued)!=null?u:0,attempted:(d=t==null?void 0:t.attempted)!=null?d:0,retried:(p=t==null?void 0:t.retried)!=null?p:0,recovered:(f=t==null?void 0:t.recovered)!=null?f:0,expired:(m=t==null?void 0:t.expired)!=null?m:0,acked:(h=t==null?void 0:t.acked)!=null?h:0}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}setUiState(e,t){Ka(e,t)}clearUiState(e){Ga(e)}analyticsFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("analytics")}replayFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("replay")}engageFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("engage")}inboxFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("inbox")}inbox(){var e,t;return(t=(e=this.inboxFeature())==null?void 0:e.controller())!=null?t:Vk}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(sg(),rg)).then(({CoachmarkFeature:e})=>{var s,i;if(this.coachFeature)return this.coachFeature;let t={trackEvent:(o,a)=>this.track(o,a),replayCoord:ne,apiBaseUrl:(s=this.rt)==null?void 0:s.config.apiBaseUrl,clientKey:(i=this.rt)==null?void 0:i.config.clientKey},r=new e(t);return this.coachFeature=r,r}):Promise.resolve(null)}coachmarks(){if(this.coachController)return this.coachController;let e=t=>{this.ensureCoach().then(r=>{r&&t(r)})};return this.coachController={start:(t,r)=>e(s=>s.start(t,r)),startInline:t=>e(r=>r.start(t)),startById:(t,r)=>e(s=>void s.startById(t,r)),reportAnchors:()=>e(t=>t.reportAnchors()),next:()=>e(t=>t.next()),back:()=>e(t=>t.back()),skip:()=>e(t=>t.skip()),end:()=>e(t=>t.end()),notify:t=>e(r=>r.notify(t)),current:()=>{var t,r;return(r=(t=this.coachFeature)==null?void 0:t.current())!=null?r:{tourId:null,index:0,status:"idle"}},on:(t,r)=>{if(this.coachFeature)return this.coachFeature.on(t,r);let s=null,i=!1;return this.ensureCoach().then(o=>{o&&!i&&(s=o.on(t,r))}),()=>{i=!0,s==null||s()}}},this.coachController}async ensurePush(){if(this.pushFeature)return this.pushFeature;if(!this.rt)return null;let{PushFeature:e}=await Promise.resolve().then(()=>(lg(),cg));this.pushFeature=new e({apiBaseUrl:this.rt.config.apiBaseUrl,clientKey:this.rt.config.clientKey,deviceId:this.rt.session.deviceId,log:this.rt.log}),this.pushFeature.onNotificationOpened(({data:t,action:r})=>{this.track("$push_opened",{...r?{action:r}:{},...t&&typeof t=="object"?t:{}})});for(let t of this.pendingPushOpenCbs)this.pushFeature.onNotificationOpened(t);return this.pendingPushOpenCbs=[],this.pushFeature}async enablePush(e){let t=await this.ensurePush();return t?t.enable(e):"error"}onNotificationOpened(e){return this.pushFeature?this.pushFeature.onNotificationOpened(e):(this.pendingPushOpenCbs.push(e),this.ensurePush(),()=>{var r;(r=this.pushFeature)==null||r.onNotificationOpened(e);let t=this.pendingPushOpenCbs.indexOf(e);t>=0&&this.pendingPushOpenCbs.splice(t,1)})}cfg(){var e;return(e=this.rt)==null?void 0:e.registry.get("config")}recordExposure(e,t,r){var i;if(!this.rt||t==null)return;let s=`${e}=${String(t)}`;this.flagExposed.has(s)||(this.flagExposed.add(s),(i=this.analyticsFeature())==null||i.register({[`$feature/${e}`]:t}),this.track("$feature_flag_called",{flag_key:e,flag_value:t,...r?{reason:r}:{}}))}prof(){var e;return(e=this.rt)==null?void 0:e.registry.get("profiler")}},rt=()=>{},Ye=()=>Promise.resolve(),dg={unreadCount:0,total:0,syncStatus:"idle"},Vk={subscribe:n=>(n(dg),rt),onUnreadChange:n=>(n(0),rt),getState:()=>dg,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Ye,markUnread:Ye,markAllRead:Ye,archive:Ye,unarchive:Ye,pin:Ye,remove:Ye,refresh:Ye,ingest:Ye,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new Ua;$();function Wk(n,e){let t=n.ScaleBun;n.ScaleBun=hn;let r=!1;if(t&&Array.isArray(t.q))for(let i of t.q){let[o,a]=i;o==="init"&&(r=!0);let c=hn[o];if(typeof c=="function"){let l=a?Array.prototype.slice.call(a):[];try{c.apply(hn,l)}catch{}}}let s=e==null?void 0:e.dataset;if(!r&&(s!=null&&s.clientKey)){let i={clientKey:s.clientKey};s.apiBaseUrl&&(i.apiBaseUrl=s.apiBaseUrl),s.environment&&(i.environment=s.environment),s.autocapture!=null&&(i.autocapture=s.autocapture!=="false"),hn.init(i)}}if(typeof window!="undefined"){let n=typeof document!="undefined"?document.currentScript:null;Sn(n==null?void 0:n.nonce),Wk(window,n)}})();
715
+ @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ls=class{constructor(){this.host=null;this.root=null;this.card=null;this.spot=null;this.ctx=null;this.onReflow=()=>this.position()}ensure(){return this.root?this.root:(this.host=document.createElement("div"),this.host.setAttribute("data-scalebun-coach",""),this.host.setAttribute("data-scalebun",""),this.root=this.host.attachShadow({mode:"open"}),Ne(this.root,Dk),document.body.appendChild(this.host),window.addEventListener("scroll",this.onReflow,!0),window.addEventListener("resize",this.onReflow),this.root)}render(e){var d,p;let t=this.ensure();this.ctx=e,[...t.querySelectorAll(".spot,.backdrop,.card")].forEach(f=>f.remove()),this.card=null,this.spot=null;let r=!!e.el&&!e.degraded;if(r)this.spot=document.createElement("div"),this.spot.className="spot",t.appendChild(this.spot);else{let f=document.createElement("div");f.className="backdrop",f.addEventListener("click",()=>e.controls.close()),t.appendChild(f)}let s=document.createElement("div");s.className=r?"card":"card modal",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),e.step.title&&s.setAttribute("aria-label",e.step.title);let i=document.createElement("button");if(i.className="x",i.type="button",i.textContent="\xD7",i.setAttribute("aria-label","Close"),i.addEventListener("click",()=>e.controls.close()),s.appendChild(i),e.step.title){let f=document.createElement("div");f.className="t",f.textContent=e.step.title,s.appendChild(f)}if(e.step.body){let f=document.createElement("div");f.className="b",f.textContent=e.step.body,s.appendChild(f)}let o=document.createElement("div");o.className="ft";let a=document.createElement("span");a.className="count",a.textContent=`${e.index+1} of ${e.total}`;let c=document.createElement("div");c.className="btns";let l=document.createElement("button");if(l.className="skip",l.type="button",l.textContent="Skip",l.addEventListener("click",()=>e.controls.skip()),c.appendChild(l),e.index>0){let f=document.createElement("button");f.className="back",f.type="button",f.textContent="Back",f.addEventListener("click",()=>e.controls.back()),c.appendChild(f)}let u=document.createElement("button");if(u.className="next",u.type="button",u.textContent=e.index+1>=e.total?"Done":"Next",u.addEventListener("click",()=>e.controls.next()),c.appendChild(u),o.append(a,c),s.appendChild(o),r){let f=document.createElement("div");f.className="arrow",s.appendChild(f)}t.appendChild(s),this.card=s,(p=(d=(e.step.title,u)).focus)==null||p.call(d),this.position()}position(){var o;let e=this.ctx;if(!e||!this.card||!e.el||e.degraded)return;let t=Bk(e.el);this.spot&&(this.spot.style.left=`${t.x-6}px`,this.spot.style.top=`${t.y-6}px`,this.spot.style.width=`${t.width+6*2}px`,this.spot.style.height=`${t.height+6*2}px`);let r={width:this.card.offsetWidth||320,height:this.card.offsetHeight||120},s=rs({anchor:t,tooltip:r,boundary:Fk(),preferred:(o=e.step.placement)!=null?o:{side:"bottom",align:"center"}});this.card.style.left=`${s.x}px`,this.card.style.top=`${s.y}px`;let i=this.card.querySelector(".arrow");i&&(i.style.left=s.arrow.y===0||s.arrow.y===r.height?`${s.arrow.x-6}px`:s.placement.side==="left"?`${r.width-6}px`:"-6px",i.style.top=s.arrow.x===0||s.arrow.x===r.width?`${s.arrow.y-6}px`:s.placement.side==="top"?`${r.height-6}px`:"-6px")}hide(){var e;window.removeEventListener("scroll",this.onReflow,!0),window.removeEventListener("resize",this.onReflow),(e=this.host)==null||e.remove(),this.host=null,this.root=null,this.card=null,this.spot=null,this.ctx=null}}});var ig={};L(ig,{CoachmarkFeature:()=>Fa});var sg,Fa,og=k(()=>{"use strict";ss();rg();Eo();ts();os();sg="scalebun_coach_progress",Fa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ls;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new qt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>is(t,r,s),render:t=>this.renderer.render(t),hide:()=>this.renderer.hide(),emit:(t,r)=>this.emit(t,r),now:()=>Date.now(),persist:(t,r)=>this.persist(t,r),loadIndex:t=>this.loadIndex(t)})}start(e,t){this.reportAnchors(),this.engine.start(e,t)}reportAnchors(){for(let e of of())this.reportedAnchors.has(e)||(this.reportedAnchors.add(e),this.emit("$coachmark_anchor_seen",{anchorKey:e}))}async fetchTours(e){var s;if(!e&&this.toursCache)return this.toursCache;let{apiBaseUrl:t,clientKey:r}=this.deps;if(!t||!r||typeof fetch=="undefined")return e?[]:this.toursCache=[];try{let i=`${t}/sdk/coach/config${e?`?preview=${encodeURIComponent(e)}`:""}`,o=await fetch(i,{headers:{"x-scalebun-client-key":r},cache:"no-store"});if(!o.ok)return e?[]:this.toursCache=[];let c=(s=(await o.json()).tours)!=null?s:[];return e?c:this.toursCache=c}catch{return e?[]:this.toursCache=[]}}async startById(e,t){let r=(await this.fetchTours(t==null?void 0:t.preview)).find(s=>s.id===e);return r?(this.engine.start(r,t),!0):!1}next(){this.engine.next()}back(){this.engine.back()}skip(){this.engine.skip()}end(){this.engine.end("abandoned","api")}notify(e){this.engine.notify(e)}current(){return this.engine.state}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{var s;(s=this.listeners.get(e))==null||s.delete(t)}}emit(e,t){var o,a;let r=this.deps.replayCoord(),s={...t,...r?{replayCoord:r}:{}};this.deps.trackEvent(e,s);let i={event:e,...s};for(let c of(o=this.listeners.get(e))!=null?o:[])try{c(i)}catch{}for(let c of(a=this.listeners.get("*"))!=null?a:[])try{c(i)}catch{}}progress(){try{return JSON.parse(localStorage.getItem(sg)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(sg,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function _s(n){return n.supported?n.permission==="denied"?n.everSubscribed?"revoked":"blocked":n.permission==="default"?"never-granted":n.hasSubscription?"subscribed":n.everSubscribed?"expired":"never-granted":"unsupported"}var ag,Da=k(()=>{"use strict";ag={subscribed:{title:"Notifications are on",detail:"This browser is registered and can receive push.",actionable:!1},"never-granted":{title:"Not asked yet",detail:"This browser has never been prompted. Ask from a click \u2014 browsers ignore the prompt otherwise.",actionable:!0},blocked:{title:"Blocked in this browser",detail:"Notifications were declined, and the browser will not show the prompt again. Only the person can re-enable it, from the site settings beside the address bar.",actionable:!1},revoked:{title:"Turned off after being enabled",detail:"This browser had notifications and they were switched off. Like blocking, only the person can restore it from the site settings \u2014 but unlike a first refusal, they opted in once, so a reminder in-product is fair.",actionable:!1},expired:{title:"Registration expired",detail:"Permission is still granted but the subscription is gone \u2014 browsers drop them after long inactivity or a data clear. Re-registering fixes it and does NOT prompt.",actionable:!0},unsupported:{title:"Not supported in this browser",detail:"Web push needs a service worker, the Push API and Notifications. This browser is missing at least one.",actionable:!1}}});var qa={};L(qa,{notInitializedReport:()=>Vk,runPushDiagnostics:()=>Uk});function qk(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Hk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}function $k(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function zk(n){return new Promise(e=>{let t=n.active;if(!t||typeof MessageChannel=="undefined"){e(null);return}let r=!1,s=i=>{r||(r=!0,e(i))};try{let i=new MessageChannel;i.port1.onmessage=o=>{let a=o.data;s(a&&a.type==="scalebun-sw-pong"?{version:a.version}:null)},t.postMessage({type:"scalebun-sw-ping"},[i.port2]),setTimeout(()=>s(null),1500)}catch{s(null)}})}async function Uk(n){var m,h,g,x,v,y,b,E,w;let e=[],t=I=>(e.push(I),I),r=(I,S,C)=>{t({id:I,status:"unknown",label:S,detail:`Not evaluated \u2014 ${C}`})},s=typeof window!="undefined"&&window.isSecureContext===!0;t({id:"secure_context",status:s?"pass":"fail",label:"Secure context (HTTPS)",detail:s?void 0:"Page is not a secure context",fix:s?void 0:"Serve the site over HTTPS. Web Push is unavailable on plain HTTP (localhost is exempt)."});let i=[];(typeof navigator=="undefined"||!("serviceWorker"in navigator))&&i.push("ServiceWorker"),(typeof window=="undefined"||!("PushManager"in window))&&i.push("PushManager"),(typeof window=="undefined"||!("Notification"in window))&&i.push("Notification");let o=i.length===0&&qk(),a=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"");if(t({id:"api_support",status:o?"pass":"fail",label:"Browser supports Web Push",detail:o?void 0:`Missing: ${i.join(", ")||"push APIs"}`,fix:o?void 0:a?"On iOS, Web Push only works when the site is installed to the Home Screen as a PWA (iOS 16.4+). In a normal Safari tab these APIs are absent.":"This browser cannot receive Web Push. Hide your opt-in UI when ScaleBun.push.check() reports this."}),!o)return r("sw_reachable","Service worker file is reachable","push APIs are unavailable"),r("sw_registered","Service worker is registered","push APIs are unavailable"),r("sw_version","Service worker is up to date","push APIs are unavailable"),r("vapid_configured","Web Push configured for this app","push APIs are unavailable"),r("permission","Notification permission","push APIs are unavailable"),r("subscription_valid","Push subscription is valid","push APIs are unavailable"),r("device_registered","Device registered with ScaleBun","push APIs are unavailable"),r("identified","User is identified","push APIs are unavailable"),cg(e);let c=null;try{let I=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=I.ok,t({id:"sw_reachable",status:I.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${I.status}`,fix:I.ok?void 0:`Copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root so it is served at ${n.serviceWorkerUrl}.`})}catch{t({id:"sw_reachable",status:"unknown",label:"Service worker file is reachable",detail:`Could not fetch ${n.serviceWorkerUrl}`,fix:"Check that the file is served from the same origin and not blocked by CSP."})}let l=null;try{l=(m=await navigator.serviceWorker.getRegistration(n.serviceWorkerUrl))!=null?m:null}catch{l=null}let u=(b=(y=(x=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?x:(g=l==null?void 0:l.installing)==null?void 0:g.scriptURL)!=null?y:(v=l==null?void 0:l.waiting)==null?void 0:v.scriptURL)!=null?b:null,d=!!u&&u.indexOf("scalebun-push-sw")>=0;if(t({id:"sw_registered",status:l&&d?"pass":"fail",label:"Service worker is registered",detail:l?d?`Active: ${u}`:`A different worker owns this scope: ${u}`:"No registration found for this scope",fix:l?d?void 0:"Another service worker controls this scope. Serve the ScaleBun worker at a path it can own, and pass serviceWorkerScope to enablePush().":c===!1?"The worker file is missing (see the check above) \u2014 fix that first, then call ScaleBun.enablePush().":"Call ScaleBun.enablePush() from a user gesture to register the worker."}),l&&d){let I=await zk(l);!I||typeof I.version!="number"?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:"The worker did not answer a version ping",fix:`Your copy of scalebun-push-sw.js is older than v${n.expectedSwVersion} (versions before v3 cannot report themselves). Re-copy it from @scalebun/web/dist/.`}):I.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${I.version}, this SDK expects v${n.expectedSwVersion}`,fix:"Re-copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root \u2014 the deployed copy is stale."}):t({id:"sw_version",status:"pass",label:"Service worker is up to date",detail:`v${I.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),S=I.ok?await I.json():null;p=(S==null?void 0:S.enabled)===!1?null:(E=S==null?void 0:S.vapidPublicKey)!=null?E:null,t({id:"vapid_configured",status:p?"pass":"fail",label:"Web Push configured for this app",detail:p?void 0:"No VAPID key served for this client key",fix:p?void 0:"In the ScaleBun dashboard: Settings \u2192 Integrations \u2192 Web Push (VAPID) \u2192 Generate VAPID keys."})}catch{t({id:"vapid_configured",status:"unknown",label:"Web Push configured for this app",detail:"Could not reach the ScaleBun API",fix:"Check apiBaseUrl, network access, and CORS."})}let f=typeof Notification=="undefined"?"default":Notification.permission;t({id:"permission",status:f==="granted"?"pass":f==="denied"?"fail":"warn",label:"Notification permission",detail:f,fix:f==="granted"?void 0:f==="denied"?"The user blocked notifications. This cannot be re-prompted from code \u2014 they must re-allow it in browser site settings.":"Not asked yet. Call ScaleBun.enablePush() from a click handler."});try{let I=l?await l.pushManager.getSubscription():null;if(!I)t({id:"subscription_valid",status:"fail",label:"Push subscription is valid",detail:"No subscription on this browser",fix:f==="granted"?"Permission is granted but no subscription exists \u2014 call ScaleBun.enablePush() to create one.":"Call ScaleBun.enablePush() from a user gesture."});else{let S=I.toJSON(),C=typeof S.expirationTime=="number"&&S.expirationTime<=Date.now(),M=null;if(p){let A=(w=I.options)==null?void 0:w.applicationServerKey;M=A?$k(new Uint8Array(A),Hk(p)):null}t({id:"subscription_valid",status:C||M===!1?"fail":M===null&&p?"warn":"pass",label:"Push subscription is valid",detail:C?"Subscription has expired":M===!1?"Subscription was created with a DIFFERENT VAPID key than this app now uses":M===null&&p?"Could not read the subscription key to compare against the tenant VAPID key":I.endpoint,fix:C?"Call ScaleBun.enablePush() again to mint a fresh subscription.":M===!1?"The VAPID keypair was rotated after this browser subscribed, so pushes to it will fail. Call ScaleBun.push.disable() then ScaleBun.enablePush() to re-subscribe.":void 0})}}catch{t({id:"subscription_valid",status:"unknown",label:"Push subscription is valid",detail:"Could not read the push subscription"})}try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/device-token/status?deviceId=${encodeURIComponent(n.deviceId)}`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),S=I.ok?await I.json():null;if(!S)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${I.status}`}),r("identified","User is identified","the server did not answer");else{let C=S.tokenStatus==="dead";t({id:"device_registered",status:S.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:S.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:S.registered?C?"The browser push service rejected this token (410 Gone). Call ScaleBun.enablePush() to re-subscribe.":void 0:"Call ScaleBun.enablePush() \u2014 the subscription never reached the backend."}),t({id:"identified",status:S.identified?"pass":"warn",label:"User is identified",detail:S.identified?"Bound to a person":"Anonymous device",fix:S.identified?void 0:"Call ScaleBun.identify() \u2014 journeys and lifecycle programs only target identified people, so this browser can receive broadcasts but never an automated lifecycle push."})}}catch{t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:"Could not reach the ScaleBun API"}),r("identified","User is identified","the server was unreachable")}return cg(e)}function Vk(){return{ok:!1,blocking:"api_support",checks:[{id:"api_support",status:"fail",label:"ScaleBun is initialized",detail:"push.check() was called before ScaleBun.init()",fix:"Call ScaleBun.init({ clientKey, apiBaseUrl }) first \u2014 diagnostics need the resolved config."}]}}function cg(n){var t;let e=n.find(r=>r.status==="fail");return{ok:!e,blocking:(t=e==null?void 0:e.id)!=null?t:null,checks:n}}var Ha=k(()=>{"use strict"});var dg={};L(dg,{DEFAULT_SW_URL:()=>$a,EXPECTED_SW_VERSION:()=>lg,PUSH_STATE_COPY:()=>ag,PushFeature:()=>za,resolvePushState:()=>_s});function Os(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Wk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}var lg,$a,mn,za,ug=k(()=>{"use strict";Da();Da();lg=5,$a="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=$a;this.openedCbs=new Set;this.swMessageBound=!1;this.deps=e}log(...e){var t,r;(r=(t=this.deps).log)==null||r.call(t,"[scalebun:push]",...e)}permission(){return typeof Notification=="undefined"?"default":Notification.permission}async enable(e={}){try{if(!Os())return this.log("unsupported browser \u2014 skipping"),"unsupported";if(!this.deps.clientKey||!this.deps.apiBaseUrl)return"error";if(this.permission()==="denied")return"denied";let t=await this.fetchPushConfig();if(!t||t.enabled===!1||!t.vapidPublicKey)return this.log("web push not configured for this app"),"not-configured";let r=await Notification.requestPermission();if(r!=="granted")return r==="denied"?"denied":"error";let s=e.serviceWorkerUrl||$a;this.swUrl=s,this.reg=await navigator.serviceWorker.register(s,e.serviceWorkerScope?{scope:e.serviceWorkerScope}:void 0),await navigator.serviceWorker.ready,this.bindSwMessages();let o=await this.reg.pushManager.getSubscription()||await this.reg.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Wk(t.vapidPublicKey)}),a=await this.registerDeviceToken(o);return this.lastEndpoint=o.endpoint,a?"subscribed":"error"}catch(t){return this.log("enable failed",t),"error"}}async disable(e={}){var t,r;try{let s=this.reg||(Os()?await navigator.serviceWorker.getRegistration():null),i=s?await s.pushManager.getSubscription():null,o=(r=(t=i==null?void 0:i.endpoint)!=null?t:this.lastEndpoint)!=null?r:null,a=i?await i.unsubscribe():!0;return this.lastEndpoint=null,e.revokeServerSide!==!1&&await this.revokeDeviceToken(o),a}catch{return!1}}async revokeDeviceToken(e){if(!this.deps.clientKey||!this.deps.apiBaseUrl)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token/revoke`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({deviceId:this.deps.deviceId,...e?{endpoint:e}:{}})})).ok}catch{return!1}}onNotificationOpened(e){return this.openedCbs.add(e),this.bindSwMessages(),()=>this.openedCbs.delete(e)}async getSubscription(){try{let e=this.reg||(Os()?await navigator.serviceWorker.getRegistration():null),t=e?await e.pushManager.getSubscription():null;return t?t.toJSON():null}catch{return null}}async check(e={}){let{runPushDiagnostics:t}=await Promise.resolve().then(()=>(Ha(),qa));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:lg})}everSubscribed(){try{return localStorage.getItem(mn.EVER_KEY)==="1"}catch{return!1}}markEverSubscribed(){try{localStorage.setItem(mn.EVER_KEY,"1")}catch{}}async status(){var r,s;let e=Os(),t=e?await this.getSubscription():null;return t&&this.markEverSubscribed(),{supported:e,permission:this.permission(),subscribed:!!t,endpoint:(s=(r=t==null?void 0:t.endpoint)!=null?r:this.lastEndpoint)!=null?s:null,state:_s({supported:e,permission:this.permission(),hasSubscription:!!t,everSubscribed:this.everSubscribed()})}}bindSwMessages(){this.swMessageBound||typeof navigator=="undefined"||!("serviceWorker"in navigator)||(this.swMessageBound=!0,navigator.serviceWorker.addEventListener("message",e=>{var r,s;let t=e.data;if(!(!t||typeof t.type!="string"))if(t.type==="scalebun-push-click"){let i=(r=t.data)!=null?r:{};for(let o of this.openedCbs)try{o({data:i,action:(s=t.action)!=null?s:null})}catch{}}else t.type==="scalebun-push-resubscribe"&&t.subscription&&this.registerDeviceTokenJson(t.subscription).then(i=>{var o;i&&((o=t.subscription)!=null&&o.endpoint)&&(this.lastEndpoint=t.subscription.endpoint)})}))}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.deps.clientKey}}async fetchPushConfig(){try{let e=await fetch(`${this.deps.apiBaseUrl}/sdk/engage/push-config`,{headers:this.headers(),cache:"no-store"});return e.ok?await e.json():null}catch{return null}}registerDeviceToken(e){return this.registerDeviceTokenJson(e.toJSON())}async registerDeviceTokenJson(e){if(!e||!e.endpoint)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({schemaVersion:1,deviceId:this.deps.deviceId,platform:"web",pushProvider:"webpush",pushToken:JSON.stringify(e),tokenStatus:"active",...this.deps.sdkVersion?{sdkVersion:this.deps.sdkVersion}:{}})})).ok}catch{return!1}}};mn.EVER_KEY="scalebun.push.everSubscribed";za=mn});var bn=new Map,yn=n=>typeof n=="string"?n.replace(/[;:|]/g,"").trim().slice(0,32):"";function Ka(n,e){let t=yn(n),r=yn(e);t&&r&&bn.set(t,r)}function Ga(n){n===void 0?bn.clear():bn.delete(yn(n))}function Xa(){let n=new Map;document.querySelectorAll("[aria-expanded],dialog").forEach(r=>{let s=r.getAttribute("aria-expanded"),i=s==="true"||s===null&&r.hasAttribute("open")?"open":"closed",o=yn(r.getAttribute("data-scalebun-state")||r.getAttribute("aria-controls")||r.id);o&&n.set(o,i)});for(let[r,s]of bn)n.set(r,s);if(!n.size)return;let e=[...n.keys()].sort().map(r=>`${r}:${n.get(r)}`),t="";for(let r of e){let s=t?`${t};${r}`:r;if(s.length>96)break;t=s}return t||void 0}var Ya="https://api.scalebun.com/api/v1";var hg=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ja(n){var r,s,i,o,a,c,l,u,d,p,f,m,h,g,x,v,y,b,E,w,I,S,C,M,R,A,O,z,D,ne,J,Q,fe,ce,xe,Se,le,H,V,K,de,me,se,Ue,Ve,G,ie,Y,X,te,T,_,N,F,W,re,ge,he,Ce,Ae,Re,Je,st,ke,gn,Va,Wa,ja;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=(r=n.apiBaseUrl)==null?void 0:r.replace(/\/$/,""),t=e&&/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?([/?#]|$)/.test(e)?e:Ya;return{clientKey:n.clientKey,apiBaseUrl:t,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(s=n.flushIntervalMs)!=null?s:5e3,sessionTimeoutMs:n.sessionTimeoutMs,sessionMaxDurationMs:n.sessionMaxDurationMs,replay:n.replay,errors:n.errors,network:n.network,performance:n.performance,analytics:n.analytics,flags:n.flags,replayCanvas:(i=n.replayCanvas)!=null?i:!1,signSessionLane:(o=n.signSessionLane)!=null?o:!1,replayFrameOrigins:(a=n.replayFrameOrigins)!=null?a:[],autocapture:(c=n.autocapture)!=null?c:!0,tracePropagation:(l=n.tracePropagation)!=null?l:!0,tracePropagationOrigins:(u=n.tracePropagationOrigins)!=null?u:[],maxBatchSize:(d=n.maxBatchSize)!=null?d:50,maxQueueSize:(p=n.maxQueueSize)!=null?p:1e3,debug:(f=n.debug)!=null?f:!1,features:{errors:(h=(m=n.features)==null?void 0:m.errors)!=null?h:!0,network:(x=(g=n.features)==null?void 0:g.network)!=null?x:!0,console:(y=(v=n.features)==null?void 0:v.console)!=null?y:!0,webVitals:(E=(b=n.features)==null?void 0:b.webVitals)!=null?E:!0,performance:(I=(w=n.features)==null?void 0:w.performance)!=null?I:!0,journey:(C=(S=n.features)==null?void 0:S.journey)!=null?C:!0,replay:(R=(M=n.features)==null?void 0:M.replay)!=null?R:!1,bugReport:(O=(A=n.features)==null?void 0:A.bugReport)!=null?O:!0,crash:(D=(z=n.features)==null?void 0:z.crash)!=null?D:!0,config:(J=(ne=n.features)==null?void 0:ne.config)!=null?J:!0,engage:(fe=(Q=n.features)==null?void 0:Q.engage)!=null?fe:!0,analytics:(xe=(ce=n.features)==null?void 0:ce.analytics)!=null?xe:!0,webPerf:(le=(Se=n.features)==null?void 0:Se.webPerf)!=null?le:!0,profiler:(V=(H=n.features)==null?void 0:H.profiler)!=null?V:!1,watchdog:(de=(K=n.features)==null?void 0:K.watchdog)!=null?de:!1,inbox:(se=(me=n.features)==null?void 0:me.inbox)!=null?se:!1,inapp2:(Ve=(Ue=n.features)==null?void 0:Ue.inapp2)!=null?Ve:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(ie=(G=n.privacy)==null?void 0:G.captureNetworkBodies)!=null?ie:!1,denylist:[...hg,...(X=(Y=n.privacy)==null?void 0:Y.denylist)!=null?X:[]].map(fg=>fg.toLowerCase()),maskSelectors:(T=(te=n.privacy)==null?void 0:te.maskSelectors)!=null?T:[],maskReplayText:(N=(_=n.privacy)==null?void 0:_.maskReplayText)!=null?N:!1,maskInputs:(W=(F=n.privacy)==null?void 0:F.maskInputs)!=null?W:!0,respectDnt:(ge=(re=n.privacy)==null?void 0:re.respectDnt)!=null?ge:!1,maskEventText:(Ce=(he=n.privacy)==null?void 0:he.maskEventText)!=null?Ce:!1},consent:{required:(Ae=n.requireConsent)!=null?Ae:!1,initial:(Re=n.initialConsent)!=null?Re:"unknown"},bugReport:{launcher:(st=(Je=n.bugReportOptions)==null?void 0:Je.launcher)!=null?st:!1,position:(gn=(ke=n.bugReportOptions)==null?void 0:ke.position)!=null?gn:"bottom-right",label:(Wa=(Va=n.bugReportOptions)==null?void 0:Va.label)!=null?Wa:"Report a bug"},...(ja=n.engageOptions)!=null&&ja.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}$();$();En();var In=class{constructor(e){this.config=e;var r,s;let t=Rc((r=e.sessionTimeoutMs)!=null?r:Vt,(s=e.sessionMaxDurationMs)!=null?s:Xs);this.sessionId=t.id,this.deviceId=Za()}client(){return sc()}device(){return ic(this.deviceId)}app(){return oc(this.config)}context(){return Tc(),ac()}};En();var An=class An{constructor(e){this.config=e;this.suspendedUntil=0}isSuspended(){return Date.now()<this.suspendedUntil}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.config.clientKey}}async signedHeaders(e){let t=this.headers();if(!this.config.signSessionLane)return t;let{signatureHeaders:r}=await Promise.resolve().then(()=>(Zs(),Qs));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c,l;await this.post(`${this.config.apiBaseUrl}/ingestion/sessions`,{sessionId:e.sessionId,deviceId:e.device.id,platform:e.client.platform,appVersion:(s=(t=e.app)==null?void 0:t.version)!=null?s:(r=e.app)==null?void 0:r.release,osVersion:e.device.osVersion,deviceModel:(i=e.device.model)!=null?i:e.device.browser,locale:(o=e.context)==null?void 0:o.locale,timezone:(a=e.context)==null?void 0:a.timezone,idleThresholdMs:(c=this.config.sessionTimeoutMs)!=null?c:Vt,sdkVersion:(l=e.client.sdk)==null?void 0:l.version,startedAt:Date.now()})}async sendBatch(e,t){var i,o;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`,s=await this.post(r,e,t==null?void 0:t.keepalive);if(!s)return null;try{return(o=(i=await s.json())==null?void 0:i.results)!=null?o:{}}catch{return{}}}async finalize(e){let t=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/finalize`;await this.post(t,{endedAt:Date.now()},!0)}async submitBugReport(e,t){if(this.isSuspended())return null;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/bug-reports`;try{let s=JSON.stringify(t),i=await fetch(r,{method:"POST",headers:await this.signedHeaders(s),body:s});return i.ok?await i.json().catch(()=>({})):null}catch{return null}}async post(e,t,r=!1){if(this.isSuspended())return null;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>An.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(Oc(),_c)),l=await c(s);l&&(o=new Blob([l]),i["content-encoding"]="gzip")}let a=await fetch(e,{method:"POST",headers:i,body:o,keepalive:r});return a.status===403&&this.maybeEnterSuspended(a),a.ok?a:null}catch{return null}}maybeEnterSuspended(e){let t=Number(e.headers.get("retry-after"))||0;e.clone().json().then(r=>{if(!((r==null?void 0:r.code)==="workspace_suspended"||(r==null?void 0:r.enabled)===!1)&&!t)return;let i=Number(r==null?void 0:r.retryAfterSeconds)||t||3600;this.suspendedUntil=Date.now()+i*1e3}).catch(()=>{t&&(this.suspendedUntil=Date.now()+t*1e3)})}};An.GZIP_MIN_BYTES=1024;var Cn=An;Wt();$();Rn();Mn();var Ug=1,Bc=n=>n.kind==="frame",Pn=n=>n.frameType==="keyframe",Vg=n=>Bc(n)&&!Pn(n),Wg=3,Ln=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.queuedCount=0;this.attemptedCount=0;this.retriedCount=0;this.recoveredCount=0;this.expiredCount=0;this.ackedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new St;this.flushing=!1;this.sessionStarted=Promise.resolve();this.sessionOk=!1;this.sessionRetries=0;this.keyframePending=!1;this.inFlight=[];var s,i;this.consentGranted=!((s=e.consent)!=null&&s.required)||((i=e.consent)==null?void 0:i.initial)==="granted"}setConsentGranted(e){this.consentGranted=e}canEgress(){return this.consentGranted&&!this.dead}async start(){var e;if(!this.started){this.started=!0,this.dead=!1,this.armSession();try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=Tn(s,o=>o.timestamp,P());this.expiredCount+=s.length-i.length,i.length&&(this.recoveredCount+=i.length,r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush(),this.queue.some(Pn)&&this.flush()}}armSession(){this.sessionOk=!1,this.sessionStarted=this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}).then(()=>{this.sessionOk=!0}).catch(()=>{})}emit(e){if(!this.consentGranted){this.droppedCount++;return}if(this.queue.length>=this.config.maxQueueSize){let t=this.queue.findIndex(Vg);this.queue.splice(t>=0?t:0,1),this.droppedCount++}this.queuedCount++,this.queue.push(e),this.started&&Pn(e)&&(this.flushing?this.keyframePending=!0:this.flush())}reportDrop(e,t){var r;e&&((r=this.reported)!=null||(this.reported=new Set),!this.reported.has(e)&&(this.reported.add(e),this.emit({kind:"event",name:"sdk_replay_capture_failed",timestamp:P(),props:{stage:"ingest-rejected",lane:e,reason:t!=null?t:"unknown"}})))}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,kt(e,Bc,Pn)])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){var r;if(this.dead||this.flushing||this.queue.length===0)return;this.flushing=!0;let t=this.queue.splice(0,this.config.maxBatchSize);this.inFlight=t;try{await this.sessionStarted,this.started&&!this.sessionOk&&this.sessionRetries<Wg&&(this.sessionRetries++,this.armSession(),await this.sessionStarted),this.attemptedCount++;let s=await this.transport.sendBatch(this.buildEnvelope(t),e);if(s){this.inFlight=[],this.ackedCount+=t.length;let i=[],o=0;for(let a of t){let c=(r=a.kind)!=null?r:"",l=s[c];!l||l.ok||(this.ackedCount--,l.retry?(i.push(a),this.retriedCount++):(o++,this.droppedCount++,this.reportDrop(c,l.reason)))}i.length?(t.length-i.length-o===0?(this.backoff.fail(P()),this.queue.push(...i)):(this.backoff.reset(),this.queue.unshift(...i)),this.persistQueue()):this.backoff.reset()}else this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}catch{this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}this.keyframePending&&(this.keyframePending=!1,this.flush(e))}emitFor(e,t){if(!this.consentGranted||!e||e===this.session.sessionId){this.consentGranted&&e===this.session.sessionId&&this.emit(t);return}this.drainOrphans(e,[t])}async drainOrphans(e,t){let r=null;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}let s=r?t.filter(i=>{var a;let o=r[(a=i.kind)!=null?a:""];return o&&!o.ok&&o.retry}):t;s.length&&this.buffer.save([e,s])}buildEnvelope(e){return{schemaVersion:Ug,sessionId:this.session.sessionId,sentAt:P(),client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context(),items:e}}installLifecycleFlush(){if(typeof document=="undefined")return;let e=()=>{this.dead||(this.persistQueue(),this.flush({keepalive:!0}))},t=()=>{document.visibilityState==="hidden"&&e()};this.addLifecycle(document,"visibilitychange",t),typeof window!="undefined"&&(this.addLifecycle(window,"pagehide",e),this.addLifecycle(window,"online",()=>{this.backoff.reset(),this.autoFlush()}))}addLifecycle(e,t,r){e.addEventListener(t,r),this.lifecycle.push({target:e,type:t,fn:r})}removeLifecycle(){for(let e of this.lifecycle)try{e.target.removeEventListener(e.type,e.fn)}catch{}this.lifecycle=[]}async stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),await this.flush({keepalive:!0}),await this.transport.finalize(this.session.sessionId),await this.buffer.clear(),this.started=!1}async discard(){this.dead=!0,this.consentGranted=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),this.queue=[],this.started=!1;try{await this.buffer.clear()}catch{}}get pendingCount(){return this.queue.length}get dropped(){return this.droppedCount}get ledger(){return{queued:this.queuedCount,attempted:this.attemptedCount,retried:this.retriedCount,recovered:this.recoveredCount,dropped:this.droppedCount,expired:this.expiredCount,acked:this.ackedCount}}};ti();$();var Fc={drop:!1,warnings:[]};function Dc(n,e,t){var o,a;if(!n||e.startsWith("$"))return Fc;let r=n.strict===!0,s=(o=n.events)==null?void 0:o[e];if(!s)return n.allowUnknownEvents===!1?{drop:r,warnings:[`event "${e}" is not in the tracking plan`]}:Fc;let i=[];for(let c of(a=s.required)!=null?a:[])(t==null||!(c in t))&&i.push(`event "${e}" missing required prop "${c}"`);if(s.props){for(let c of Object.keys(s.props))if(t&&c in t){let l=typeof t[c];l!==s.props[c]&&i.push(`event "${e}" prop "${c}" expected ${s.props[c]}, got ${l}`)}}return{drop:r&&i.length>0,warnings:i}}var jg=/^[A-Za-z]{3}$/;function Kg(n){return jg.test(n)?n.toUpperCase():n}function On(n){let{revenue:e,currency:t,transactionId:r,type:s,productId:i,quantity:o,recurrence:a,...c}=n;if(typeof e!="number"||!Number.isFinite(e)||!t||!r)return null;let l=s!=null?s:"one_time",u=l==="refund"?-Math.abs(e):e,d={...c,transaction_id:r,revenue_type:l};return i&&(d.product_id=i),o!=null&&(d.quantity=o),a&&(d.recurrence=a),{revenue:u,currency:Kg(t),props:d}}var Gg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],Xg=new Set(["trial_started","trial_converted","started","plan_changed"]);function Nn(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function Yg(n){return{...n.id?{id:String(n.id)}:{},...n.name?{name:String(n.name)}:{},amount:n.amount,currency:String(n.currency).toUpperCase().slice(0,3),interval:n.interval,...typeof n.intervalCount=="number"&&n.intervalCount>0?{intervalCount:Math.floor(n.intervalCount)}:{}}}function qc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!Gg.includes(t))return null;let r=n.plan;return Xg.has(t)&&(!r||typeof r.amount!="number"||!Number.isFinite(r.amount)||r.amount<0||!r.currency||!r.interval)?null:{subscriptionId:e,status:t,...r?{plan:Yg(r)}:{},...Nn(n.trialEndAt)?{trialEndAt:Nn(n.trialEndAt)}:{},...Nn(n.effectiveAt)?{effectiveAt:Nn(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var Jg="wzb-analytics-v1",Qg=new Set(["$identify","$group","$alias","purchase"]);function Hc(n,e,t){return t>=1||Qg.has(n)?!0:t<=0?!1:Ee(`${e}:${Jg}`)%1e4<t*1e4}Wt();Rn();Mn();var xb=50,Sb=5e3,kb=2e3,Qe="scalebun_anonymous_id",oi="scalebun_user_id",Hn="scalebun_super_props",si="scalebun_groups",al="scalebun_installation_id",cl="scalebun_first_open_done",ai="scalebun_attribution_click_id",ll="scalebun_attribution",ul=/^[0-9a-f]{16,64}$/i,Eb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function Ib(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(ll);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return{props:t,isNew:!1}}}}catch{}let n={};try{if(typeof location!="undefined"){let e=new URL(location.href);for(let t of Eb){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,200))}for(let t of["fbclid","gclid"]){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,512))}}if(typeof document!="undefined"&&document.referrer)try{let e=new URL(document.referrer);n.referrer=(e.origin+e.pathname).slice(0,512),n.referrer_domain=e.hostname}catch{n.referrer=document.referrer.split("?")[0].slice(0,512)}}catch{}if(!n.referrer&&!n.utm_source&&!n.fbclid&&!n.gclid)return{props:{},isNew:!1};try{typeof location!="undefined"&&(n.landing_url=location.pathname.slice(0,512)),typeof localStorage!="undefined"&&localStorage.setItem(ll,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var Cb="pending-analytics";function Ab(){try{if(typeof localStorage!="undefined")return localStorage.getItem(oi)||void 0}catch{}}function ii(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(oi,n):localStorage.removeItem(oi)}catch{}}function ci(){return`anon_${q()}`}function dl(n){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(n);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return t}}}catch{}return{}}function Kt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function Rb(n){try{if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)")),t=e==null?void 0:e[1];return t!=null?decodeURIComponent(t):null}catch{return null}}function li(n,e,t){try{if(typeof document=="undefined")return;let r=[`${n}=${encodeURIComponent(e)}`,"path=/","max-age=31536000","SameSite=Lax"];t&&r.push(`domain=${t}`),document.cookie=r.join("; ")}catch{}}function Tb(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(al))!=null?r:"",e||(e=n||`web_${q()}`,localStorage.setItem(al,e)),t=(s=localStorage.getItem(ai))!=null?s:void 0)}catch{}e||(e=n||`web_${q()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&ul.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(ai,o)}catch{}i.searchParams.delete("scalebun_click_id");try{history.replaceState(history.state,"",i.pathname+i.search+i.hash)}catch{}}}}catch{}return t?{installationId:e,clickId:t}:{installationId:e}}function Mb(n){if(n){let t=Rb(Qe);if(t){try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,t)}catch{}return t}}try{if(typeof localStorage!="undefined"){let t=localStorage.getItem(Qe),r=t!=null?t:ci();return t||localStorage.setItem(Qe,r),n&&li(Qe,r,n),r}}catch{}let e=ci();return n&&li(Qe,e,n),e}var $n=class{constructor(){this.name="analytics";this.ctx=null;this.active=!1;this.clientKey="";this.apiBaseUrl="";this.deviceId="";this.installationId="";this.attributionProps={};this.anonymousId="";this.userId=Ab();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(Cb);this.persisted=!1;this.backoff=new St;this.sampleRate=1;this.droppedCount=0;this.sampledOutCount=0;this.flushCount=0}get pending(){return this.queue.length}get dropped(){return this.droppedCount}get stats(){return{pending:this.queue.length,dropped:this.droppedCount,sampledOut:this.sampledOutCount,flushes:this.flushCount,sampleRate:this.sampleRate}}get isActive(){return this.active}setup(e){var i,o,a,c,l,u,d;this.ctx=e,this.clientKey=(i=e.clientKey)!=null?i:"",this.apiBaseUrl=(o=e.apiBaseUrl)!=null?o:"",this.deviceId=(a=e.deviceId)!=null?a:"";let t=Tb(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=Ib();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Mb(this.cookieDomain),this.superProps=dl(Hn),this.groups=dl(si),this.plan=(l=e.analyticsOptions)==null?void 0:l.plan;let s=(u=e.analyticsOptions)==null?void 0:u.sampleRate;typeof s=="number"&&s>=0&&s<=1&&(this.sampleRate=s),!(!this.clientKey||!this.apiBaseUrl)&&(r.isNew&&this.recordTouchpoint(),this.timer=setInterval(()=>this.autoFlush(),Sb),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Nc(()=>{this.backoff.reset(),this.autoFlush()}),this.active=!0,this.maybeFirstOpen(),this.offSignal=(d=e.onSignal)==null?void 0:d.call(e,(p,f)=>{this.active&&(p==="rage"?this.track("$rageclick"):p==="dead"?this.track("$deadclick"):p==="shake"?this.track("$shake"):p==="error"?this.track("$exception",f):p==="web_vital"?this.track("$web_vital",f):p==="exit_intent"&&this.track("$exit_intent",f))}),this.buffer.load().then(p=>{let f=Array.isArray(p)?p:[],m=Tn(f,h=>h.event_time,P());this.droppedCount+=f.length-m.length,this.active&&m.length?(this.queue.unshift(...m),this.trim(),this.persisted=!0,this.autoFlush()):m.length<f.length&&this.buffer.clear()}),e.autocapture!==!1&&Promise.resolve().then(()=>(ol(),il)).then(({installAutocapture:p})=>{this.active&&(this.stopAutocapture=p({onEvent:f=>this.track(f.name,{...f.props,capture_source:"automatic"}),maskText:e.maskEventText===!0}))}).catch(()=>{}))}get usable(){return this.active&&!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}get sessionId(){var e;return(e=this.ctx)==null?void 0:e.sessionId}async recordTouchpoint(){if(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")return;let e=this.attributionProps;try{await fetch(`${this.apiBaseUrl}/ingestion/attribution`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},keepalive:!0,body:JSON.stringify({sessionId:this.sessionId,anonymousId:this.anonymousId||void 0,source:e.utm_source,medium:e.utm_medium,campaign:e.utm_campaign,content:e.utm_content,term:e.utm_term,landingUrl:e.landing_url,referrer:e.referrer,referrerDomain:e.referrer_domain,clickToken:this.clickId})})}catch{}}maybeFirstOpen(){let e=!1;try{e=typeof localStorage!="undefined"&&localStorage.getItem(cl)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(cl,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!ul.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(ai,e)}catch{}}}build(e,t){let r=Z(),s=Object.keys(this.attributionProps).length?{...this.attributionProps,...this.superProps}:this.superProps,i=Object.keys(s).length?{...s,...t}:t,o=i&&Object.keys(i).length?mt(i):void 0,a=Object.keys(this.groups).length>0;return{event_id:q(),event_name:e.trim(),event_time:P(),platform:"web",installation_id:this.installationId,...this.deviceId?{device_id:this.deviceId}:{},anonymous_id:this.anonymousId,...this.sessionId?{session_id:this.sessionId}:{},...this.userId?{user_id:this.userId}:{},...this.clickId?{identifiers:{click_id:this.clickId}}:{},...o?{properties:o}:{},...a?{groups:{...this.groups}}:{},...r?{replay:r}:{},context:{sdk_version:Fs}}}get identity(){return{anonymousId:this.anonymousId,userId:this.userId,groups:this.groups,superProps:this.superProps}}evaluate(e,t){if(!this.plan)return{drop:!1};let r=Dc(this.plan,e,t);if(r.warnings.length)try{for(let s of r.warnings)console.warn(`[scalebun] tracking-plan: ${s}`)}catch{}return{drop:r.drop}}register(e){!e||typeof e!="object"||(this.superProps={...this.superProps,...e},Kt(Hn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,Kt(Hn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},Kt(si,this.groups),this.usable&&this.enqueue(this.build("$group",{group_type:e,group_key:t,...r!=null?r:{}})))}alias(e,t){var s;if(!e)return;let r=(s=t!=null?t:this.userId)!=null?s:this.anonymousId;this.userId=e,ii(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ii(void 0),this.anonymousId=ci();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&li(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},Kt(Hn,this.superProps),Kt(si,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Hc(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=On(e);if(!t)return;let r=this.build("purchase",t.props);r.revenue=t.revenue,r.currency=t.currency,this.enqueue(r)}trackSubscription(e){if(!this.usable)return;let t=qc(e);if(!t)return;let r=Z();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ii(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=xb&&this.autoFlush()}trim(){let e=this.queue.length-kb;e>0&&(this.queue.splice(0,e),this.droppedCount+=e)}autoFlush(){!ot()||!this.backoff.ready(P())||this.flush()}async flush(e=!1){if(!this.usable||!this.queue.length)return;let t=this.queue.splice(0,this.queue.length),r=JSON.stringify({events:t});try{let{signatureHeaders:s}=await Promise.resolve().then(()=>(Zs(),Qs)),i=await s(this.clientKey,r);(await fetch(`${this.apiBaseUrl}/batch`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey,...i},body:r,keepalive:e})).ok?(this.backoff.reset(),this.flushCount++):(this.backoff.fail(P()),this.requeue(t))}catch{this.backoff.fail(P()),this.requeue(t)}this.persist()}requeue(e){this.queue.unshift(...e),this.trim()}async persist(){this.queue.length?(this.persisted=!0,await this.buffer.save(kt(this.queue))):this.persisted&&(this.persisted=!1,await this.buffer.clear())}teardown(){var e,t,r;(e=this.stopAutocapture)==null||e.call(this),this.stopAutocapture=void 0,this.timer&&clearInterval(this.timer),this.timer=void 0,this.onHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onHide),this.onHide=void 0,(t=this.offOnline)==null||t.call(this),(r=this.offSignal)==null||r.call(this),this.offSignal=void 0,this.offOnline=void 0,this.queue=[],this.persisted=!1,this.buffer.clear(),this.active=!1}};$();Fe();function Pb(n,e){if(e in n)return n[e];if(e.indexOf(".")===-1)return;let t=n;for(let r of e.split(".")){if(t==null||typeof t!="object")return;t=t[r]}return t}function pl(n,e){let t=Pb(n,e.attr),r=e.value;switch(e.op){case"exists":return t!=null;case"eq":return t===r;case"neq":return t!==r;case"in":return Array.isArray(r)&&r.includes(t);case"nin":return Array.isArray(r)&&!r.includes(t);case"contains":return typeof t=="string"&&typeof r=="string"&&t.includes(r);case"gt":return typeof t=="number"&&typeof r=="number"&&t>r;case"lt":return typeof t=="number"&&typeof r=="number"&&t<r;default:return!1}}function Lb(n,e){var o,a;let t=(o=e.all)!=null?o:[],r=(a=e.any)!=null?a:[];if(t.length===0&&r.length===0)return!0;let s=t.every(c=>pl(n,c)),i=r.length===0||r.some(c=>pl(n,c));return s&&i}function Gt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Lb(e,t))return t;return null}var fl="scalebun_config",di="scalebun_flag_overrides";function zn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ml(){let n=zn();if(!n)return null;try{let e=n.getItem(fl);if(!e)return null;let t=JSON.parse(e);return t&&typeof t.version=="string"&&Array.isArray(t.flags)?t:null}catch{return null}}function hl(n){let e=zn();if(e)try{e.setItem(fl,JSON.stringify(n))}catch{}}function gl(){let n=zn();if(!n)return{};try{let e=n.getItem(di),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Un(n){let e=zn();if(e)try{Object.keys(n).length?e.setItem(di,JSON.stringify(n)):e.removeItem(di)}catch{}}var ui={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var _b=5*60*1e3,bl=n=>{var e;return(e=n.salt)!=null?e:n.key},Vn=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=ui;this.exposed=new Set;this.deviceId="";this.clientKey="";this.apiBaseUrl="";this.lastFetch=0;this.overrides={};this.changeListeners=new Set;this.settled=!1;this.readyPromise=new Promise(e=>this.resolveReady=e)}get isActive(){return this.active}setup(e){var t,r,s,i,o;this.ctx=e,this.deviceId=(t=e.deviceId)!=null?t:"",this.clientKey=(r=e.clientKey)!=null?r:"",this.apiBaseUrl=(s=e.apiBaseUrl)!=null?s:"",Oe({deviceId:this.deviceId}),this.overrides=gl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:ml())!=null?o:ui,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>_b&&this.refresh()},document.addEventListener("visibilitychange",this.onVisible)),e.flagsRealtime!==!1&&this.openStream(),this.active=!0}openStream(){if(!(typeof EventSource=="undefined"||!this.clientKey||!this.apiBaseUrl))try{this.es=new EventSource(`${this.apiBaseUrl}/config/stream?key=${encodeURIComponent(this.clientKey)}`),this.es.onmessage=e=>{try{if(e.data&&JSON.parse(e.data).type==="ping")return}catch{}this.refresh()}}catch{}}seedFromBootstrap(e){return!e||typeof e!="object"||!["flags","remoteConfig","experiments","rollouts"].some(r=>Array.isArray(e[r]))?null:{version:typeof e.version=="string"?e.version:"bootstrap",flags:Array.isArray(e.flags)?e.flags:[],remoteConfig:Array.isArray(e.remoteConfig)?e.remoteConfig:[],experiments:Array.isArray(e.experiments)?e.experiments:[],rollouts:Array.isArray(e.rollouts)?e.rollouts:[],entitlements:e.entitlements,holdout:e.holdout}}markReady(){var e;this.settled||(this.settled=!0,(e=this.resolveReady)==null||e.call(this))}emitChange(){for(let e of this.changeListeners)try{e()}catch{}}async refresh(){var e,t,r,s;if(!(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")){this.lastFetch=P();try{let i={"x-scalebun-client-key":this.clientKey};this.payload.version&&(i["if-none-match"]=`"${this.payload.version}"`);let o=await fetch(`${this.apiBaseUrl}/config`,{headers:i});if(o.status===304||!o.ok)return;let a=await o.json();if(a&&typeof a.version=="string"){let c=a.version!==this.payload.version;this.payload={version:a.version,flags:(e=a.flags)!=null?e:[],remoteConfig:(t=a.remoteConfig)!=null?t:[],experiments:(r=a.experiments)!=null?r:[],rollouts:(s=a.rollouts)!=null?s:[],entitlements:a.entitlements,holdout:a.holdout,sdkFlags:a.sdkFlags},hl(this.payload),c&&(this.exposed.clear(),this.emitChange())}}catch{}}}ready(){return this.readyPromise}onChange(e){return this.changeListeners.add(e),()=>{this.changeListeners.delete(e)}}override(e,t){this.overrides[e]=t,Un(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],Un(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},Un(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=yt();if(e){let i=t[e];if(i!=null&&i!=="")return String(i)}if((s=this.payload.sdkFlags)!=null&&s.stableBucketingId)return this.deviceId;let r=t.userId;return r!=null&&r!==""?String(r):this.deviceId}knows(e){return!this.hasOverride(e)&&this.payload.flags.some(t=>t.key===e)}isEnabled(e){var r;if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.flags.find(s=>s.key===e);if(!t)return!1;if(t.variations&&t.variations.length)return!!this.variationDetail(e,!1).value;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),bl(t))<s.rollout:(r=s.serve)!=null?r:!0}return t.enabled}variationDetail(e,t){var c,l,u;let r=this.payload.flags.find(d=>d.key===e);if(this.hasOverride(e)){let d=this.overrides[e];if(typeof d=="string"&&(r!=null&&r.variations)){let p=r.variations.find(f=>f.key===d);if(p)return{value:p.value,variant:p.key,reason:"DEFAULT"}}return{value:d!=null?d:t,variant:typeof d=="string"?d:null,reason:"DEFAULT"}}if(!r)return{value:t,variant:null,reason:"FLAG_NOT_FOUND"};let s=r.variations,i=()=>this.bucketingId(r.bucketBy),o=(d,p)=>{var m,h;let f=(m=d!=null?d:r.defaultVariant)!=null?m:null;if(f&&s){let g=s.find(x=>x.key===f);if(g)return{value:g.value,variant:f,reason:p}}return{value:(h=r.defaultValue)!=null?h:t,variant:f,reason:p}},a=()=>{if(s&&s.some(d=>typeof d.allocationPct=="number")){let d=ni(i(),e,s.map(p=>{var f;return{key:p.key,allocationPct:(f=p.allocationPct)!=null?f:0}}));return o(d,"ROLLOUT")}return s?o(null,"DEFAULT"):{value:r.enabled,variant:null,reason:"DEFAULT"}};if(r.targeting&&r.targeting.length){let d=Gt(r.targeting,yt());if(d)return typeof d.rollout=="number"?Le(i(),bl(r))>=d.rollout?a():s?o((c=d.variation)!=null?c:null,"ROLLOUT"):{value:!0,variant:null,reason:"ROLLOUT"}:d.variation||s?o((l=d.variation)!=null?l:null,"TARGETING_MATCH"):{value:(u=d.serve)!=null?u:!0,variant:null,reason:"TARGETING_MATCH"}}return a()}variation(e,t){return this.variationDetail(e,t).value}get(e,t){let r=this.payload.remoteConfig.find(s=>s.key===e);if(!r)return t;try{switch(r.type){case"number":{let s=Number(r.value);return Number.isFinite(s)?s:t}case"boolean":return r.value==="true";case"json":return JSON.parse(r.value);default:return r.value}}catch{return t}}isOn(e){if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.rollouts.find(s=>s.key===e);if(!t)return!1;let r=t.percentage;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());s&&typeof s.percentage=="number"&&(r=s.percentage)}return Le(this.bucketingId(t.bucketBy),t.salt)<r}inHoldout(){let e=this.payload.holdout;return!!e&&e.percentage>0&&Le(this.bucketingId(),e.salt)<e.percentage}inLayerSlot(e){if(!e.layer||!e.layerRange)return!0;let[t,r]=e.layerRange,s=Le(this.bucketingId(),`layer:${e.layer}`);return s>=t&&s<r}variant(e){var o;if(this.hasOverride(e)){let a=this.overrides[e];return a==null?null:String(a)}let t=this.payload.experiments.find(a=>a.key===e);if(!t||this.inHoldout()||!this.inLayerSlot(t))return null;let r=t.variants;if(t.targeting&&t.targeting.length){let a=Gt(t.targeting,yt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=ni(this.bucketingId(t.bucketBy),t.salt,r),i=`${e}=${s}`;if(s&&!this.exposed.has(i)){this.exposed.add(i);let a=Z();(o=this.ctx)==null||o.emit({kind:"event",name:"experiment_exposure",props:{experiment:e,variant:s,reason:"ENROLLED",...a?{$replay:a}:{}},timestamp:P()})}return s}entitlement(e){let t=this.payload.entitlements;return(t==null?void 0:t[e])!==!1}teardown(){var e;this.onVisible&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisible),this.onVisible=void 0,(e=this.es)==null||e.close(),this.es=void 0,this.active=!1}};$();$();function yl(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function vl(n){if(!n)return n;let e=!1,t={};for(let r in n){let s=n[r];if(typeof s=="string"){let i=j(s);t[r]=i,i!==s&&(e=!0)}else t[r]=s}return e?t:n}var wl=16*1024;function xl(n,e={}){var u,d,p,f;let{droppedSince:t=0,extra:r,frames:s,fingerprint:i,causes:o,scope:a}=e,c=n.stack;return!c&&n.source&&(c=`${n.message} at ${n.source}:${(u=n.lineno)!=null?u:0}:${(d=n.colno)!=null?d:0}`),c&&c.length>wl&&(c=c.slice(0,wl)),c=yl(c),{kind:"error",type:n.type,message:j((p=n.message)!=null?p:""),stack:c,source:"js",...n.mechanism?{mechanism:n.mechanism}:{},...s&&s.length?{frames:s}:{},...i?{fingerprint:i}:{},...o&&o.length?{causes:o}:{},...a!=null&&a.level?{level:a.level}:{},...a!=null&&a.tags?{tags:a.tags}:{},...a!=null&&a.context?{context:a.context}:{},...Ob(),...Nb(),screenName:Bb(),clientId:`err_${q()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=vl(r))!=null?f:{}}}function Ob(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function Nb(){let n=Z();return n?{replay:n}:{}}function Bb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Wn=class{constructor(e){this.lastSeen=new Map;this.recent=[];this.dropped=0;var t,r,s;this.dedupWindowMs=(t=e==null?void 0:e.dedupWindowMs)!=null?t:5e3,this.capCount=(r=e==null?void 0:e.capCount)!=null?r:20,this.capWindowMs=(s=e==null?void 0:e.capWindowMs)!=null?s:1e4}accept(e){let t=Date.now();if(this.lastSeen.size>512)for(let[s,i]of this.lastSeen)t-i>=this.dedupWindowMs&&this.lastSeen.delete(s);let r=this.lastSeen.get(e);return r!=null&&t-r<this.dedupWindowMs?(this.dropped++,!1):(this.recent=this.recent.filter(s=>t-s<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.lastSeen.set(e,t),this.recent.push(t),!0))}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var It={tags:{},context:{}};function Sl(n,e){It.tags[n]=e}function kl(n,e){It.context[n]=e}function El(n){It.level=n}function Il(n){var i;let e={...It.tags,...n==null?void 0:n.tags},t={...It.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:It.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var Fb="wzb-errors-v1";function Cl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,Fb)<n*100:!0}$();var Vb=()=>[];function Wb(n){if(!n)return"";let e=n.split(`
716
+ `).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var Fl=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Dl(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var jn=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new Wn;this.ignore=Fl;this.denyUrls=[];this.captureResourceErrors=!1;this.sampled=!0;this.counters={captured:0,droppedThrottle:0,droppedIgnore:0,droppedBeforeSend:0,byType:{},lastFingerprint:void 0}}stats(){return{captured:this.counters.captured,droppedThrottle:this.counters.droppedThrottle,droppedIgnore:this.counters.droppedIgnore,droppedBeforeSend:this.counters.droppedBeforeSend,byType:{...this.counters.byType},lastFingerprint:this.counters.lastFingerprint,breadcrumbs:We.snapshot().length,sampled:this.sampled}}get isActive(){return this.active}setup(e){var r,s,i;this.ctx=e;let t=e.errorsOptions;t&&(this.ignore=[...Fl,...(r=t.ignoreErrors)!=null?r:[]],this.denyUrls=(s=t.denyUrls)!=null?s:[],this.captureResourceErrors=(i=t.captureResourceErrors)!=null?i:!1,this.beforeSend=t.beforeSend),this.sampled=Cl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(Bl(),Nl)).then(o=>{this.parseStack=o.parseStack,this.computeFingerprint=o.computeFingerprint,this.extractCauses=o.extractCauses}).catch(()=>{}),typeof window!="undefined"&&(this.onError=o=>{var l,u;let a=o.target;if(!!a&&a!==window&&typeof a.tagName=="string"&&!o.error&&!o.message){if(!this.captureResourceErrors)return;let d=a.src||a.href||"";this.handleAuto({type:"fatal",message:`Failed to load ${a.tagName.toLowerCase()}${d?` ${d}`:""}`,source:d,mechanism:"resource"});return}this.handleAuto({type:"fatal",message:o.message||((l=o.error)==null?void 0:l.message)||"Uncaught error",stack:(u=o.error)==null?void 0:u.stack,source:o.filename,lineno:o.lineno,colno:o.colno,mechanism:"onerror"},o.error)},this.onRejection=o=>{var c;let a=o.reason;this.handleAuto({type:"unhandledrejection",message:(c=a==null?void 0:a.message)!=null?c:String(o.reason),stack:a==null?void 0:a.stack,mechanism:"onunhandledrejection"},o.reason)},this.sampled&&(window.addEventListener("error",this.onError,!0),window.addEventListener("unhandledrejection",this.onRejection)),this.active=!0)}shouldIgnore(e){for(let t of this.ignore)if(Dl(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Dl(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${Wb(e.stack)}`;if(!this.throttle.accept(r)){this.counters.droppedThrottle++;return}this.buildAndEmit(e,{droppedSince:this.throttle.takeDropped(),original:t})}captureHandled(e,t,r){var i;let s=e;this.buildAndEmit({type:"handled",message:(i=s==null?void 0:s.message)!=null?i:String(e),stack:s==null?void 0:s.stack,mechanism:"captureError"},{extra:t,scopeOver:r,original:e})}buildAndEmit(e,t){var a,c,l,u,d,p,f,m,h;let r=(a=this.parseStack)==null?void 0:a.call(this,e.stack),s=(u=(c=t.scopeOver)==null?void 0:c.fingerprint)!=null?u:(l=this.computeFingerprint)==null?void 0:l.call(this,e.type,r,e.message),i=t.original!=null&&this.extractCauses?this.extractCauses(t.original,(d=this.parseStack)!=null?d:Vb):void 0,o=xl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:Il(t.scopeOver)});if(this.beforeSend)try{let g=this.beforeSend(o);if(!g){this.counters.droppedBeforeSend++;return}o=g}catch{}(p=this.ctx)==null||p.emit(o),this.counters.captured++,this.counters.byType[e.type]=((f=this.counters.byType[e.type])!=null?f:0)+1,s&&(this.counters.lastFingerprint=s),(h=this.ctx)==null||h.signal("error",{fingerprint:s,type:e.type,message:((m=e.message)!=null?m:"").slice(0,200),handled:e.type==="handled"})}teardown(){typeof window!="undefined"&&(this.onError&&window.removeEventListener("error",this.onError,!0),this.onRejection&&window.removeEventListener("unhandledrejection",this.onRejection),this.active=!1)}};var fi;function jb(){return fi||(fi=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Kn(n){try{let e=jb();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function Gn(n){try{return n==null?void 0:typeof n=="string"?Kn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Kn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Xt(n){if(!n)return;let e=parseInt(n,10);return Number.isFinite(e)&&e>=0?e:void 0}function lt(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function ql(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var x,v,y,b,E,w,I,S,C,M,R;let c=Gb(o),l=Xb(o,a);if(t(c))return s.call(this,o,a);let u,d=a,p=r==null?void 0:r(c);if(p){u=p.traceId;let A=new Headers((x=a==null?void 0:a.headers)!=null?x:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=Yb(d==null?void 0:d.body),g=Jb(o,d);try{let A=await s.call(this,o,d),O=null;try{O=typeof A.clone=="function"?A.clone():null}catch{O=null}return e({method:l,url:c,status:A.status,startedAt:f,duration:Math.round(lt()-m),requestSize:(y=Gn(d==null?void 0:d.body))!=null?y:Xt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Xt((E=(b=A.headers)==null?void 0:b.get)==null?void 0:E.call(b,"content-length")),reqBody:h,reqContentType:(I=(w=g==null?void 0:g.get)==null?void 0:w.call(g,"content-type"))!=null?I:void 0,resContentType:(M=(C=(S=A.headers)==null?void 0:S.get)==null?void 0:C.call(S,"content-type"))!=null?M:void 0,readResponseText:O?()=>Kb(O):void 0,traceId:u}),A}catch(A){let O=A,z=(O==null?void 0:O.name)==="AbortError",D=(O==null?void 0:O.name)==="TimeoutError";throw e({method:l,url:c,status:0,startedAt:f,duration:Math.round(lt()-m),error:(R=O==null?void 0:O.message)!=null?R:"network error",aborted:z,timedOut:D}),A}},()=>{n.fetch=s})}var Xn=64*1024;async function Kb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>Xn?i.slice(0,Xn):i}let t=e.getReader(),r=typeof TextDecoder!="undefined"?new TextDecoder:void 0,s="";for(;;){let{done:i,value:o}=await t.read();if(i)break;if(o&&r&&(s+=r.decode(o,{stream:!0})),s.length>=Xn){try{await t.cancel()}catch{}return s.slice(0,Xn)}}return r&&(s+=r.decode()),s}catch{return null}}function Gb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function Xb(n,e){var r;let t=(r=e==null?void 0:e.method)!=null?r:typeof n!="string"&&!(n instanceof URL)?n.method:void 0;return(t!=null?t:"GET").toUpperCase()}function Yb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function Jb(n,e){try{if(e!=null&&e.headers)return new Headers(e.headers);if(typeof Request!="undefined"&&n instanceof Request)return n.headers}catch{}}function Hl(n,e,t,r){let s=n.XMLHttpRequest;if(typeof s!="function")return()=>{};let i=s.prototype.open,o=s.prototype.send,a=s.prototype.setRequestHeader;return s.prototype.open=function(c,l,...u){return this.__scalebun={method:String(c).toUpperCase(),url:String(l)},i.call(this,c,l,...u)},s.prototype.setRequestHeader=function(c,l){return this.__scalebun&&typeof c=="string"&&c.toLowerCase()==="content-type"&&(this.__scalebun.reqContentType=String(l)),a.call(this,c,l)},s.prototype.send=function(c){let l=this.__scalebun;if(l&&!t(l.url)){let u=r==null?void 0:r(l.url);if(u){l.traceId=u.traceId;try{this.setRequestHeader("traceparent",u.header)}catch{}}let d=Date.now(),p=lt(),f=typeof c=="string"?c:void 0,m=Gn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let x=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:Zb(this),error:x?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:Qb(this,"content-type"),readResponseText:async()=>{try{return typeof this.responseText=="string"?this.responseText:null}catch{return null}},traceId:l.traceId})})}return o.call(this,c)},()=>{s.prototype.open=i,s.prototype.send=o,s.prototype.setRequestHeader=a}}function Qb(n,e){var t,r;try{return(r=(t=n.getResponseHeader)==null?void 0:t.call(n,e))!=null?r:void 0}catch{return}}function Zb(n){var t;let e=Xt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Kn(n.responseText):void 0}catch{return}}$();function $l(n){let{status:e,error:t,aborted:r,timedOut:s}=n;if(r)return"abort";if(s)return"timeout";if((e===0||e===void 0)&&t)return ey(t)?"abort":ty(t)?"timeout":ny(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function zl(n,e=2e3){return typeof n=="number"&&n>=e}function ey(n){return/\babort(ed)?\b/i.test(n)}function ty(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function ny(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var ry=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,}|[0-9A-HJKMNP-TV-Z]{26})$/i;function sy(n){return n?!!(ry.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Ul(n){let e=n;try{let s=typeof location!="undefined"?location.href:"http://x";e=new URL(n,s).pathname}catch{let s=e.indexOf("?");s>=0&&(e=e.slice(0,s));let i=e.indexOf("#");i>=0&&(e=e.slice(0,i))}if(e==="/"||e==="")return e||"/";let t=e.split("/"),r=!1;for(let s=0;s<t.length;s++){let i=t[s];i!==void 0&&sy(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Vl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?$l({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=zl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Ul(n.url);return{kind:"network",method:n.method,url:n.url,status:n.status,startedAt:n.startedAt,duration:n.duration,error:n.error,requestSize:n.requestSize,responseSize:n.responseSize,route:i,screenName:iy(),...t!=="http"?{protocol:t}:{},...r?{failure:r}:{},...s?{slow:!0}:{},...n.transferSize!==void 0?{transferSize:n.transferSize}:{},...n.graphql?{graphql:n.graphql}:{},...n.timing?{timing:n.timing}:{},...n.ws?{ws:n.ws}:{},...n.request?{request:n.request}:{},...n.response?{response:n.response}:{},...n.traceId?{traceId:n.traceId}:{},clientId:`net_${q()}`,timestamp:P()}}function iy(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Wl(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);let r="";for(let s of e)r+=s.toString(16).padStart(2,"0");return r}function oy(){let n=Wl(16),e=Wl(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function ay(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function jl(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=ay(t);return r&&e.has(r)?oy():null}}var cy=new Set(["fetch","xmlhttprequest"]);function ly(n){let e={},t=n.domainLookupEnd-n.domainLookupStart,r=n.connectEnd-n.connectStart,s=n.secureConnectionStart>0?n.connectEnd-n.secureConnectionStart:0,i=n.responseStart-n.requestStart,o=n.responseEnd-n.responseStart;t>0&&(e.dns=Yt(t)),r>0&&(e.tcp=Yt(r)),s>0&&(e.tls=Yt(s)),i>0&&(e.ttfb=Yt(i)),o>0&&(e.download=Yt(o));let a={};return Object.keys(e).length&&(a.timing=e),typeof n.transferSize=="number"&&n.transferSize>0&&(a.transferSize=n.transferSize),a}function Yt(n){return Math.round(n*100)/100}var Ct=class Ct{constructor(){this.byUrl=new Map;this.timeOriginMs=0}install(){var e;if(typeof PerformanceObserver=="undefined"||typeof performance=="undefined")return!1;this.timeOriginMs=(e=performance.timeOrigin)!=null?e:0;try{return this.observer=new PerformanceObserver(t=>{for(let r of t.getEntries()){let s=r;cy.has(s.initiatorType)&&this.add(s)}}),this.observer.observe({type:"resource",buffered:!0}),!0}catch{return!1}}add(e){let t=e.name,r=this.byUrl.get(t);r||(r=[],this.byUrl.set(t,r)),r.push(e),r.length>Ct.MAX_PER_URL&&r.shift(),this.prune()}match(e,t){let r=this.byUrl.get(e);if(!r||!r.length)return{};let s=t-this.timeOriginMs,i=0,o=1/0;for(let c=0;c<r.length;c++){let l=r[c];if(!l)continue;let u=Math.abs(l.startTime-s);u<o&&(o=u,i=c)}let[a]=r.splice(i,1);return r.length||this.byUrl.delete(e),a?ly(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-Ct.TTL_MS;for(let[t,r]of this.byUrl){let s=r.filter(i=>i.startTime>=e);s.length?this.byUrl.set(t,s):this.byUrl.delete(t)}}teardown(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0,this.byUrl.clear()}};Ct.TTL_MS=6e4,Ct.MAX_PER_URL=8;var Jn=Ct;Fe();function Kl(n,e){if(n.failed||n.slow)return!0;let t=e>=1?1:e<=0?0:e;return t>=1?!0:t<=0?!1:Ee(n.key)%1e4<Math.round(t*1e4)}var Qn=class{constructor(e,t,r){this.windowMs=e;this.emit=t;this.onSuppress=r;this.map=new Map}push(e){var s,i,o,a;let t=`${e.method}|${(s=e.route)!=null?s:e.url}|${(o=(i=e.status)!=null?i:e.error)!=null?o:""}`,r=this.map.get(t);return r?(r.count++,r.item=e,clearTimeout(r.timer),r.timer=setTimeout(()=>this.flush(t),this.windowMs),(a=this.onSuppress)==null||a.call(this),!1):(this.map.size>=500&&this.evictOldest(),this.map.set(t,{count:0,item:e,timer:setTimeout(()=>this.flush(t),this.windowMs)}),this.emit(e),!0)}flush(e){let t=this.map.get(e);this.map.delete(e),t&&t.count>0&&this.emit({...t.item,repeat:t.count})}evictOldest(){let e=this.map.keys().next().value;if(e!==void 0){let t=this.map.get(e);t&&clearTimeout(t.timer),this.flush(e)}}get pending(){return this.map.size}dispose(){for(let e of this.map.values())clearTimeout(e.timer);this.map.clear()}};function hy(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var er=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Jn;this.timingOn=!1;this.counters={captured:0,byProtocol:{http:0,ws:0,sse:0,beacon:0},byFailure:{http_4xx:0,http_5xx:0,network_error:0,timeout:0,cors:0,abort:0},dropped:0,sampledIn:0,bodiesCaptured:0}}stats(){return{captured:this.counters.captured,byProtocol:{...this.counters.byProtocol},byFailure:{...this.counters.byFailure},dropped:this.counters.dropped,sampledIn:this.counters.sampledIn,bodiesCaptured:this.counters.bodiesCaptured}}get isActive(){return this.active}setup(e){var u,d,p,f,m,h;if(typeof window=="undefined")return;let t=(u=e.networkOptions)!=null?u:{};this.slowMs=(d=t.slowRequestMs)!=null?d:2e3,this.sampleRate=typeof t.sampleRate=="number"?t.sampleRate:1;let r=t.dedupWindowMs;this.dedupMs=typeof r=="number"&&r>0?r:0,this.dedupMs>0&&(this.deduper=new Qn(this.dedupMs,g=>{this.record(g),e.emit(g)},()=>{this.counters.dropped++})),this.denyUrls=(p=t.denyUrls)!=null?p:[],this.beforeSend=t.beforeSend,t.captureBodies&&(this.bodyOpts={bodyMaxBytes:Math.min(Math.max(0,(f=t.bodyMaxBytes)!=null?f:8192),64*1024),contentTypeAllowlist:t.contentTypeAllowlist&&t.contentTypeAllowlist.length?t.contentTypeAllowlist:["application/json","text/plain"]}),this.timingOn=this.timingIndex.install();let s=e.apiBaseUrl,i=g=>!!s&&g.startsWith(s),o=g=>this.handle(e,g),a=(h=jl((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(ql(window,o,i,a)),this.uninstalls.push(Hl(window,o,i,a));let c={ws:t.trackWebSocket!==!1,sse:t.trackSse!==!1,beacon:!0},l=typeof navigator!="undefined"?navigator:void 0;Promise.resolve().then(()=>(Zl(),Ql)).then(g=>{this.active&&this.uninstalls.push(...g.installStreams(window,l,o,i,c))}).catch(()=>{}),this.active=!0}handle(e,t){var s;if(this.denyUrls.some(i=>hy(i,t.url))){this.counters.dropped++;return}let r=(s=t.protocol)!=null?s:"http";if(this.timingOn&&r==="http"&&t.timing===void 0){setTimeout(()=>{if(!this.active)return;let i=this.timingIndex.match(t.url,t.startedAt);i.timing&&(t.timing=i.timing),i.transferSize!==void 0&&t.transferSize===void 0&&(t.transferSize=i.transferSize),this.finalize(e,t)},0);return}this.finalize(e,t)}finalize(e,t){var o;let r=(o=t.protocol)!=null?o:"http",s=r==="http"&&t.graphql===void 0&&this.maybeGraphql(t),i=!!this.bodyOpts&&r==="http";if(s||i){Promise.resolve().then(()=>(cd(),ad)).then(a=>a.enrichHttpCapture(t,{graphql:s,body:i?this.bodyOpts:void 0})).catch(()=>{}).finally(()=>{this.active&&this.emit(e,t)});return}this.emit(e,t)}maybeGraphql(e){return e.method!=="POST"?!1:/graphql/i.test(e.url)||!!e.reqBody&&e.reqBody.includes("query")}emit(e,t){let r=Vl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!Kl({failed:!!r.failure,slow:!!r.slow,key:`${t.url}|${t.startedAt}`},this.sampleRate)){this.counters.dropped++;return}this.counters.sampledIn++}if(this.beforeSend)try{let s=this.beforeSend(r);if(s==null){this.counters.dropped++;return}r=s}catch{}r.failure&&r.failure!=="abort"&&e.signal("network_error"),this.emitItem(e,r)}emitItem(e,t){if(this.deduper){this.deduper.push(t);return}this.record(t),e.emit(t)}record(e){var s;this.counters.captured++;let t=(s=e.protocol)!=null?s:"http";this.counters.byProtocol[t]++;let r=e.failure;r&&this.counters.byFailure[r]++,(e.request||e.response)&&this.counters.bodiesCaptured++}teardown(){var e;for(let t of this.uninstalls)t();this.uninstalls=[],(e=this.deduper)==null||e.dispose(),this.deduper=void 0,this.timingIndex.teardown(),this.timingOn=!1,this.active=!1}};$s();function ld(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function xi(){return{max:0,cur:0,first:0,last:0}}function dd(n,e){for(let t of e){if(t.hadRecentInput||typeof t.value!="number")continue;let r=typeof t.startTime=="number"?t.startTime:n.last;n.cur>0&&r-n.last<1e3&&r-n.first<5e3?(n.cur+=t.value,n.last=r):(n.cur=t.value,n.first=r,n.last=r),n.cur>n.max&&(n.max=n.cur)}return n}function ud(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function Si(n){if(n)return n.replace(/[?#].*$/,"")}function pd(){if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let n=performance.getEntriesByType("navigation")[0];if(!n||!(n.responseStart>0))return;let e=(t,r)=>t>0&&r>=t?Math.round(r-t):0;return{redirect:e(n.redirectStart,n.redirectEnd),worker:e(n.workerStart,n.fetchStart),dns:e(n.domainLookupStart,n.domainLookupEnd),tcp:e(n.connectStart,n.connectEnd),tls:e(n.secureConnectionStart,n.connectEnd),request:e(n.requestStart,n.responseStart)}}function fd(n){var a,c,l,u;if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let e=performance.getEntriesByType("navigation")[0],t=Math.max(0,(a=e==null?void 0:e.responseStart)!=null?a:0),r=(l=(c=n.renderTime)!=null?c:n.loadTime)!=null?l:0;if(r<=0)return;let s=t,i=(u=n.loadTime)!=null?u:r;if(n.url){let d=performance.getEntriesByName(n.url)[0];d&&(s=Math.max(t,d.requestStart||d.startTime||t),i=n.loadTime||d.responseEnd||i)}let o=d=>Math.round(Math.max(0,d));return{ttfb:o(t),resourceLoadDelay:o(s-t),resourceLoadTime:n.url?o(i-s):0,elementRenderDelay:o(r-(n.url?i:t))}}function md(n,e){let t;for(let r of n)if(!(r.end<e.start||r.start>e.end))for(let s of r.scripts)s.url&&(!t||s.dur>t.duration)&&(t={url:s.url,duration:Math.round(s.dur),fn:s.fn,invokerType:s.invokerType});return t}var gy={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function hd(n,e){let t=gy[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function ki(n){if(!n||typeof n.tagName!="string")return;let e=[],t=n,r=0;for(;t&&t.nodeType===1&&r<5;){if(t.id){e.unshift(`#${gd(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${gd(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=by(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function by(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function gd(n){return n.replace(/([^\w-])/g,"\\$1")}function bd(n){if(n)return{x:De(n.x),y:De(n.y),width:De(n.width),height:De(n.height)}}function De(n){return typeof n=="number"&&isFinite(n)?n:0}function yd(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=ki(e),s=e&&typeof e.tagName=="string"?e.tagName.toLowerCase():void 0,i=typeof n.loadTime=="number"?n.loadTime:void 0,o=typeof n.renderTime=="number"?n.renderTime:void 0;if(!r&&!t&&!s&&i===void 0&&o===void 0)return;let a={};return r&&(a.element=r),s&&(a.elementTag=s),t&&(a.url=t),i!==void 0&&(a.loadTime=Jt(i)),o!==void 0&&(a.renderTime=Jt(o)),a}function Ei(){return{largestValue:0,sources:[]}}function vd(n,e,t=5){var r;for(let s of e){if(s.hadRecentInput)continue;let i=De(s.value);if(i<=0||i<=n.largestValue)continue;let o=s.sources||[],a=[];for(let c of o.slice(0,t)){let l=(r=c.node)!=null?r:void 0;a.push({selector:ki(l),previousRect:bd(c.previousRect),currentRect:bd(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function wd(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function Ii(){return{duration:0}}function xd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=yy(t))}return n}function yy(n){var c;let e=(c=n.target)!=null?c:void 0,t=De(n.startTime),r=De(n.processingStart),s=De(n.processingEnd),i=De(n.duration),o={},a=ki(e);return a&&(o.element=a),e&&typeof e.tagName=="string"&&(o.elementTag=e.tagName.toLowerCase()),typeof n.name=="string"&&(o.eventType=n.name),r>0&&(o.inputDelay=Jt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Jt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Jt(Math.max(0,t+i-s))),o}function Sd(n){return n.duration>0?n.attribution:void 0}function Jt(n){return Math.round(n)}$();var nr=class nr{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=xi();this.inp=0;this.clsAcc=Ei();this.inpAcc=Ii();this.route="/";this.loaf=[]}get isActive(){return this.active}setup(e){this.ctx=e,typeof PerformanceObserver!="undefined"&&(this.disconnects.push(Pe("largest-contentful-paint",t=>{var s,i;let r=ld(t);r&&(this.lcp=r,this.lcpAttr=(s=yd(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=Si(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{dd(this.clsState,t),vd(this.clsAcc,t)})),this.disconnects.push(Pe("event",t=>{let r=this.inp;for(let s of t)typeof s.duration=="number"&&s.duration>r&&typeof s.startTime=="number"&&(r=s.duration,this.inpWindow={start:s.startTime,end:s.startTime+s.duration});this.inp=ud(this.inp,t),xd(this.inpAcc,t)},{durationThreshold:40})),this.disconnects.push(Pe("long-animation-frame",t=>{var r,s,i;for(let o of t){if(this.loaf.length>=nr.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=Si(l.sourceURL||l.name||""))!=null?u:"",dur:typeof l.duration=="number"?l.duration:0,fn:l.sourceFunctionName,invokerType:l.invokerType}});this.loaf.push({start:a,end:a+((i=o.duration)!=null?i:0),scripts:c})}})),this.disconnects.push(Pe("paint",t=>{let r=t.find(s=>s.name==="first-contentful-paint");r&&this.emit("fcp",r.startTime,"ms")})),this.route=Ed(kd()),this.installRouteDetection(),this.emitTtfb(),typeof document!="undefined"&&(this.hideHandler=()=>{document.visibilityState==="hidden"&&this.finalizeRoute()},document.addEventListener("visibilitychange",this.hideHandler)),this.active=!0)}emitTtfb(){try{let e=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0;e&&e.responseStart>0&&this.emit("ttfb",e.responseStart,"ms",{ttfbPhases:pd()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=fd(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=Sd(this.inpAcc);if(t&&this.inpWindow){let r=md(this.loaf,this.inpWindow);r&&(t.loafScript=r)}this.emit("inp",this.inp,"ms",t)}e>0&&this.emit("cls",Math.round(e*1e3)/1e3,"score",wd(this.clsAcc)),this.lcp=this.inp=0,this.clsState=xi(),this.lcpAttr=void 0,this.clsAcc=Ei(),this.inpAcc=Ii(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=Ed(kd());e!==this.route&&(this.finalizeRoute(),this.route=e)}installRouteDetection(){let e=typeof window!="undefined"?window:void 0;if(!e)return;let t=()=>this.onRouteChange(),r=e.navigation;if(r&&typeof r.addEventListener=="function"){r.addEventListener("currententrychange",t),this.routeStop=()=>r.removeEventListener("currententrychange",t);return}e.addEventListener("popstate",t);let s=e.history,i=s.pushState,o=s.replaceState,a=c=>function(...l){let u=c.apply(this,l);return t(),u};try{s.pushState=a(i),s.replaceState=a(o)}catch{}this.routeStop=()=>{e.removeEventListener("popstate",t);try{s.pushState=i,s.replaceState=o}catch{}}}emit(e,t,r,s){var o,a,c;let i={kind:"performance",metric:e,value:r==="score"?t:Math.round(t),unit:r,screenName:this.route,clientId:`vit_${q()}`,timestamp:P()};s&&(i.attribution=s),(o=this.ctx)==null||o.emit(i),(c=(a=this.ctx)==null?void 0:a.signal)==null||c.call(a,"web_vital",{metric:e,value:i.value,unit:r,rating:hd(e,i.value),path:this.route})}teardown(){var e;for(let t of this.disconnects)t();this.disconnects=[],this.hideHandler&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.hideHandler),(e=this.routeStop)==null||e.call(this),this.routeStop=void 0,this.active=!1}};nr.LOAF_CAP=30;var tr=nr;function kd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function Ed(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}$();Ci();$();var vy=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Qt(n,e,t={}){var r;return{kind:"performance",metric:j(n),value:Math.round(e*1e3)/1e3,unit:(r=t.unit)!=null?r:"ms",screenName:vy(),clientId:`perf_${q()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Zt=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:60,this.windowMs=(r=e==null?void 0:e.windowMs)!=null?r:1e4}accept(){let e=Date.now();return this.recent=this.recent.filter(t=>e-t<this.windowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(e),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var sr=class{constructor(e){this.open=new Map;this.dropped=0;var t,r,s;this.maxOpen=(t=e==null?void 0:e.maxOpen)!=null?t:100,this.ttlMs=(r=e==null?void 0:e.ttlMs)!=null?r:6e4,this.clock=(s=e==null?void 0:e.clock)!=null?s:Date.now}start(e){if(e){if(this.expire(),!this.open.has(e)&&this.open.size>=this.maxOpen){this.dropped++;return}this.open.set(e,this.clock())}}stop(e){this.expire();let t=this.open.get(e);return t==null?null:(this.open.delete(e),{name:e,durationMs:this.clock()-t})}expire(){let e=this.clock();for(let[t,r]of this.open)e-r>this.ttlMs&&(this.open.delete(t),this.dropped++)}takeDropped(){let e=this.dropped;return this.dropped=0,e}clear(){this.open.clear(),this.dropped=0}};$();function Ad(n){var t,r;let e=n;return{value:(t=e.duration)!=null?t:0,metadata:{startTime:Math.round((r=e.startTime)!=null?r:0)}}}function Rd(n){var i,o,a,c,l,u,d,p,f,m;let e=n,t=Array.isArray(e.scripts)?e.scripts:[],r;for(let h of t)(!r||((i=h.duration)!=null?i:0)>((o=r.duration)!=null?o:0))&&(r=h);let s={frameDuration:Math.round((a=e.duration)!=null?a:0),startTime:Math.round((c=e.startTime)!=null?c:0)};if(r){let h={url:j(String((u=(l=r.sourceURL)!=null?l:r.name)!=null?u:"")),invoker:j(String((d=r.invoker)!=null?d:"")),duration:Math.round((p=r.duration)!=null?p:0)};r.sourceFunctionName&&(h.fn=String(r.sourceFunctionName)),r.sourceCharPosition!=null&&r.sourceCharPosition>=0&&(h.pos=r.sourceCharPosition),r.forcedStyleAndLayoutDuration&&(h.forcedLayout=Math.round(r.forcedStyleAndLayoutDuration)),r.invokerType&&(h.invokerType=String(r.invokerType)),s.script=h}return{value:(m=(f=e.blockingDuration)!=null?f:e.duration)!=null?m:0,metadata:s}}var wy=new Set(["fetch","xmlhttprequest","beacon"]);function xy(n){return n.replace(/[?#].*$/,"")}function en(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ai="";function Td(n){Ai=(n!=null?n:"").replace(/\/$/,"")}function Sy(n){return!!Ai&&n.startsWith(Ai)}function Md(n){if(wy.has(n.initiatorType)||Sy(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:xy(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",en(n.domainLookupStart,n.domainLookupEnd)),r("tcp",en(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?en(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",en(n.requestStart,n.responseStart)),r("download",en(n.responseStart,n.responseEnd)),r("transferSize",n.transferSize||void 0),r("encodedSize",n.encodedBodySize||void 0),r("decodedSize",n.decodedBodySize||void 0);let s=n.renderBlockingStatus;return s&&(t.renderBlocking=s),{value:e,metadata:t}}function Pd(n){if(typeof window=="undefined"||typeof history=="undefined"||typeof location=="undefined")return()=>{};let e=()=>location.pathname+location.search,t=e(),r=()=>{let o=e();if(o!==t){t=o;try{n(o)}catch{}}},s=history.pushState,i=history.replaceState;return history.pushState=function(...a){let c=s.apply(this,a);return r(),c},history.replaceState=function(...a){let c=i.apply(this,a);return r(),c},window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{history.pushState=s,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}}Fe();var ky="wzb-traces-v1";function Ld(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${ky}`)%100<n.sampleRate*100}ar();var Iy=1e3,Cy=3e3,Ay=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function Ry(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var dr=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Zt;this.resCap=new Zt({capCount:100,windowMs:1e4});this.traces=new sr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=Cy;this.droppedTxns=0;this.txnCount=0;this.resourceCount=0;this.jankCount=0}get isActive(){return this.active}setup(e){if(this.active)return;this.ctx=e,Td(e.apiBaseUrl);let t=e.performanceOptions;t&&(typeof t.tracesSampleRate=="number"&&(this.tracesSampleRate=t.tracesSampleRate),typeof t.slowTransactionMs=="number"&&(this.slowTxnMs=t.slowTransactionMs)),Promise.resolve().then(()=>(Hd(),qd)).then(s=>{this.engine=s,this.tryEmitPageload()}).catch(()=>{});let r=()=>{var i,o;let s=(o=(i=performance.getEntriesByType)==null?void 0:i.call(performance,"navigation"))==null?void 0:o[0];s&&(this.navEntry=s,this.tryEmitPageload())};if(typeof document!="undefined"&&document.readyState==="complete"?r():typeof window!="undefined"&&window.addEventListener("load",()=>setTimeout(r,0),{once:!0}),this.disconnects.push(Pd(s=>this.onRouteChange(s))),typeof window!="undefined"){let s=()=>this.finishRouteTxn();window.addEventListener("pagehide",s),this.disconnects.push(()=>window.removeEventListener("pagehide",s))}if(e.onSignal&&this.disconnects.push(e.onSignal(s=>{var i;s==="error"&&((i=this.activeTxn)==null||i.noteError())})),typeof PerformanceObserver=="undefined"){this.active=!0;return}Ry()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,Rd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,Ad(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=Md(i);o&&this.emitResource(o)}})),this.active=!0}emitResource(e){var s;if(!this.resCap.accept())return;let t=this.resCap.takeDropped(),r=t>0?{...e.metadata,droppedSince:t}:e.metadata;this.resourceCount++,(s=this.ctx)==null||s.emit(Qt("resource",e.value,{unit:"ms",duration:e.value,metadata:r}))}perfStats(){return{transactions:this.txnCount,droppedTransactions:this.droppedTxns,resources:this.resourceCount,jank:this.jankCount,activeTransaction:!!this.activeTxn,sampleRate:this.tracesSampleRate}}emitCapped(e,t,r){var a,c,l;if(!this.cap.accept())return;let s=this.cap.takeDropped(),i=s>0?{...r.metadata,droppedSince:s}:r.metadata;this.jankCount++,(a=this.ctx)==null||a.emit(Qt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;Id({metric:e,blockingMs:r.value,frameDurationMs:e==="loaf"?Number((c=i.frameDuration)!=null?c:t.duration):t.duration,script:o?{url:o.url,invoker:o.invoker}:void 0}),(l=this.activeTxn)==null||l.addSpan(e,t.startTime,t.startTime+t.duration,r.metadata)}startTransaction(e){if(!this.engine)return or;let t=new this.engine.Transaction(e,{clock:Ay,onFinish:r=>this.emitTransaction(r)});return this.activeTxn=t,t}getActiveTraceContext(){var e;return(e=this.activeTxn)==null?void 0:e.context()}emitTransaction(e){this.activeTxn===e&&(this.activeTxn=void 0),this.emitTransactionData(e.data())}emitTransactionData(e){var r,s,i,o;if(e.durationMs>=this.slowTxnMs&&((s=(r=this.ctx)==null?void 0:r.signal)==null||s.call(r,"slow_screen")),!Ld({traceId:e.traceId,durationMs:e.durationMs,slowMs:this.slowTxnMs,sampleRate:this.tracesSampleRate,hasError:((i=e.errorCount)!=null?i:0)>0})){this.droppedTxns++;return}this.txnCount++;let t=Z();(o=this.ctx)==null||o.emit(Qt("transaction",e.durationMs,{unit:"ms",duration:e.durationMs,metadata:{kind:"transaction",name:e.name,trace:{traceId:e.traceId,spanId:e.spanId,sampled:e.sampled},spans:e.spans,...e.droppedSpans?{droppedSpans:e.droppedSpans}:{},...e.errorCount?{errorCount:e.errorCount}:{},...t?{replay:t}:{}}}))}tryEmitPageload(){if(this.pageloadEmitted||!this.engine||!this.navEntry||!this.navEntry.loadEventEnd)return;this.pageloadEmitted=!0;let e=typeof location!="undefined"?location.pathname:"/";this.emitTransactionData(this.engine.buildPageload(this.navEntry,e))}onRouteChange(e){this.finishRouteTxn(),this.routeTxn=this.startTransaction(`navigation ${e}`),typeof setTimeout!="undefined"&&(this.routeTimer=setTimeout(()=>this.finishRouteTxn(),Iy))}finishRouteTxn(){var e;this.routeTimer!==void 0&&(clearTimeout(this.routeTimer),this.routeTimer=void 0),(e=this.routeTxn)==null||e.finish(),this.routeTxn=void 0}startTrace(e){this.traces.start(e)}stopTrace(e){var r;let t=this.traces.stop(e);t&&((r=this.ctx)==null||r.emit(Qt(t.name,t.durationMs,{unit:"ms",duration:t.durationMs,metadata:{kind:"trace"}})))}teardown(){this.finishRouteTxn();for(let e of this.disconnects)e();this.disconnects=[],this.traces.clear(),this.active=!1}};$();var pr=class{constructor(e){this.onScreen=e;this.last="";this.cleanup=[]}start(){if(typeof window!="undefined"){if(typeof document!="undefined"&&document.prerendering){let e=()=>this.begin();document.addEventListener("prerenderingchange",e,{once:!0}),this.cleanup.push(()=>document.removeEventListener("prerenderingchange",e));return}this.begin()}}begin(){this.last=ur(),this.onScreen("",this.last);let e=window.navigation;if(e&&typeof e.addEventListener=="function"){let a=c=>{var u;let l=(u=c.destination)==null?void 0:u.url;this.check(l?Ty(l):ur())};e.addEventListener("navigate",a),this.cleanup.push(()=>e.removeEventListener("navigate",a))}let t=history,r=t.pushState,s=t.replaceState,i=()=>this.check();t.pushState=function(...a){let c=r.apply(this,a);return i(),c},t.replaceState=function(...a){let c=s.apply(this,a);return i(),c},this.cleanup.push(()=>{t.pushState=r,t.replaceState=s});let o=()=>this.check();window.addEventListener("popstate",o),window.addEventListener("pageshow",o),this.cleanup.push(()=>{window.removeEventListener("popstate",o),window.removeEventListener("pageshow",o)})}check(e=ur()){if(e&&e!==this.last){let t=this.last;this.last=e,this.onScreen(t,e)}}stop(){for(let e of this.cleanup)e();this.cleanup=[]}};function ur(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Ty(n){try{return new URL(n).pathname}catch{return ur()}}var fr=class{constructor(e=800,t=30,r=3){this.windowMs=e;this.radius=t;this.min=r;this.history=[]}push(e,t,r){this.history=this.history.filter(i=>r-i.t<this.windowMs);let s=this.history.filter(i=>Math.hypot(i.x-e,i.y-t)<=this.radius);return this.history.push({x:e,y:t,t:r}),s.length+1>=this.min}},mr=class{constructor(e=700){this.deadMs=e;this.changeVersion=0;this.observer=null;this.timers=new Set}observe(e){typeof MutationObserver!="undefined"&&(this.observer=new MutationObserver(()=>{this.changeVersion++}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}onClick(e){let t=this.changeVersion,r=$d(),s=setTimeout(()=>{this.timers.delete(s),e(this.changeVersion===t&&$d()===r)},this.deadMs);this.timers.add(s)}disconnect(){var e;(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.timers)clearTimeout(t);this.timers.clear()}};function $d(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function zd(n){let e=0;for(let t=n;t;t=t.parentElement){let r=getComputedStyle(t).position;if(r==="fixed")return 1;r==="sticky"&&(e=2)}return e}$();var hr=class{constructor(e,t={},r){this.emit=e;this.signal=r;this.pending=new Map;var s,i,o,a,c;this.rage=new fr((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new mr((a=t.deadMs)!=null?a:700),this.maskText=(c=t.maskText)!=null?c:!1}start(){typeof document!="undefined"&&(this.dead.observe(document),this.onPointerDownFn=e=>{let t=e;if(t.isPrimary===!1||typeof t.button=="number"&&t.button!==0)return;let r=Ud(e);r&&(this.pointerDown=Vd(r,t,Date.now(),this.maskText))},this.onClickFn=e=>{var a;let t=e,r=Ud(e);if(!r)return;let s=this.pointerDown;this.pointerDown=void 0;let i=t.detail!==0&&s&&s.target===r&&Date.now()-s.timestamp<5e3?s:Vd(r,t,Date.now(),this.maskText),o=this.rage.push(i.x,i.y,i.timestamp);o&&(i.data.rage=!0),o&&((a=this.signal)==null||a.call(this,"rage")),this.pending.set(i.interactionId,i),this.dead.onClick(c=>{var l;this.finish(i.interactionId,c),c&&((l=this.signal)==null||l.call(this,"dead"))})},this.onPageHideFn=()=>this.flushPending(),document.addEventListener("pointerdown",this.onPointerDownFn,!0),document.addEventListener("click",this.onClickFn,!0),typeof window!="undefined"&&window.addEventListener("pagehide",this.onPageHideFn,!0))}stop(){this.flushPending(),this.dead.disconnect(),typeof document!="undefined"&&(this.onPointerDownFn&&document.removeEventListener("pointerdown",this.onPointerDownFn,!0),this.onClickFn&&document.removeEventListener("click",this.onClickFn,!0)),this.onPageHideFn&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onPageHideFn,!0),this.pointerDown=void 0}finish(e,t){let r=this.pending.get(e);r&&(this.pending.delete(e),t===!0?r.data.dead=!0:t===void 0&&(r.data.deadUnknown=!0),this.emit("USER_ACTION",r.data,r.label,{interactionId:e,timestamp:r.timestamp}))}flushPending(){for(let e of[...this.pending.keys()])this.finish(e,void 0)}};function Ud(n){var t;let e=n.target;if(!e||!e.tagName)return null;if(!e.hasAttribute("data-scalebun")){let r=(t=n.composedPath)==null?void 0:t.call(n)[0];r&&r.tagName&&(e=r)}return e}function Vd(n,e,t,r){let s=Xa(),i={action:"click",...My(e),selector:By(n),...Ly(n),state_status:s?"captured_nonempty":"captured_empty"};s&&(i.ui=s);let o=Z();return o&&(i.replayCoord=o),{target:n,x:e.clientX,y:e.clientY,data:i,label:Ny(n,r),interactionId:`ixw-${q()}`,timestamp:t}}function My(n){var t,r,s;let e=typeof window!="undefined"?window:void 0;return{x:n.clientX,y:n.clientY,vw:(t=e==null?void 0:e.innerWidth)!=null?t:0,vh:(r=e==null?void 0:e.innerHeight)!=null?r:0,sx:e?Math.round(e.scrollX):0,sy:e?Math.round(e.scrollY):0,dh:document.documentElement.scrollHeight,dpr:(s=e==null?void 0:e.devicePixelRatio)!=null?s:1}}function Py(n){let e=(n.getAttribute("href")||"").replace(/[?#].*$/,"");if(e)return"h"+e;let t=(n.getAttribute("aria-label")||"").trim();if(t&&t.length<33&&!/@|\d{4,}/.test(t))return"a"+t;let r=n.getAttribute("type");return r?"y"+r:void 0}function Ly(n){var o;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=zd(n);r&&(t.fx=r),t.path=_y(n);let s=Py(n);s&&(t.cx=s);let i=(o=n.closest("[data-scalebun-component]"))==null?void 0:o.getAttribute("data-scalebun-component");return i&&(t.component=i),t}function _y(n){let e=[],t=n;for(let r=0;t&&r<6;r++){let s=t.tagName.toLowerCase();if(s==="html"||s==="body")break;if(t.id){e.unshift(`${s}#${t.id}`);break}let i=t.parentElement;if(i){let o=0,a=0,c=i.children,l=t;for(let u=0;u<c.length;u++){let d=c[u];!d||d.tagName!==l.tagName||(a++,d===l&&(o=a))}e.unshift(a>1?`${s}:nth-of-type(${o})`:s)}else e.unshift(s);t=i}return e.join(">")}var Oy=n=>n.replace(/\S/g,"*");function Ny(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Oy(r):r}`:t}function By(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}var gr=class{constructor(){this.name="journey";this.ctx=null;this.active=!1}get isActive(){return this.active}setup(e){this.ctx=e,!(typeof window=="undefined"||typeof document=="undefined")&&(this.nav=new pr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new hr((t,r,s,i)=>this.emit(t,r,s,Wd(),i),{maskText:e.maskEventText===!0},t=>{var r;return(r=this.ctx)==null?void 0:r.signal(t)}),this.nav.start(),this.interactions.start(),this.active=!0)}emit(e,t,r,s,i){var c,l;let o=t.replayCoord?void 0:Z(),a={kind:"event",name:e,props:o?{...t,replayCoord:o}:t,label:r,screenName:s!=null?s:Wd(),eventId:`evt_${q()}`,timestamp:(c=i==null?void 0:i.timestamp)!=null?c:P(),interactionId:i==null?void 0:i.interactionId,interactionProtocol:i?1:void 0};(l=this.ctx)==null||l.emit(a)}teardown(){var e,t;(e=this.nav)==null||e.stop(),(t=this.interactions)==null||t.stop(),this.active=!1}};function Wd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Bs();$();var Fy={maxDepth:4,maxBreadth:50,maxLength:8192};function Ti(n,e,t,r){if(n===null)return"null";if(n===void 0)return"undefined";let s=typeof n;if(s==="string")return n;if(s==="number"||s==="boolean"||s==="bigint")return String(n);if(s==="symbol")return n.toString();if(s==="function"){let o=n.name;return`[Function${o?`: ${o}`:""}]`}let i=n;if(t.has(i))return"[Circular]";if(n instanceof Error)return`${n.name}: ${n.message}`;if(e>=r.maxDepth)return Array.isArray(n)?"[Array]":"[Object]";t.add(i);try{if(Array.isArray(n)){let d=n.slice(0,r.maxBreadth).map(f=>Ti(f,e+1,t,r)),p=n.length>r.maxBreadth?`, \u2026(+${n.length-r.maxBreadth} more)`:"";return`[${d.join(", ")}${p}]`}if(n instanceof Map)return`Map(${n.size})`;if(n instanceof Set)return`Set(${n.size})`;let o=n.nodeName;if(typeof o=="string"){let d=n.id;return`<${o.toLowerCase()}${d?` #${String(d)}`:""}>`}let a=Object.keys(n),l=a.slice(0,r.maxBreadth).map(d=>{let p=Ti(n[d],e+1,t,r);return`${d}: ${p}`}),u=a.length>r.maxBreadth?`, \u2026(+${a.length-r.maxBreadth} more)`:"";return`{${l.join(", ")}${u}}`}finally{t.delete(i)}}function jd(n,e){let t={...Fy,...e},r;try{r=n.map(s=>Ti(s,0,new WeakSet,t)).join(" ")}catch{r="[unserializable console arguments]"}return r.length>t.maxLength&&(r=r.slice(0,t.maxLength)+"\u2026(truncated)"),r}function Kd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Mi(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var Dy=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Gd(n,e,t=0){let r=Mi(n),s=j(jd(e)),i={method:n},o=Dy();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Kd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${q()}`,metadata:i,timestamp:P()}}var br=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:100,this.capWindowMs=(r=e==null?void 0:e.capWindowMs)!=null?r:1e4}accept(e){if(e==="warn"||e==="error")return!0;let t=Date.now();return this.recent=this.recent.filter(r=>t-r<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(t),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var qy=["debug","info","log","warn","error"],Hy=50,yr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new br;this.originals=new Map;this.capturing=!1;this.ring=[]}get isActive(){return this.active}setup(e){if(!this.active&&(this.ctx=e,typeof console!="undefined")){for(let t of qy){let r=console[t];if(typeof r!="function")continue;this.originals.set(t,r);let s=(...i)=>{try{r.apply(console,i)}catch{}this.capture(t,i)};console[t]=s}this.active=!0}}capture(e,t){var r;if(!this.capturing&&!(t.length>0&&t[0]===Ns)){this.capturing=!0;try{if(!this.throttle.accept(Mi(e)))return;let s=Gd(e,t,this.throttle.takeDropped());this.pushRing(s),(r=this.ctx)==null||r.emit(s)}catch{}finally{this.capturing=!1}}}pushRing(e){this.ring.push(e),this.ring.length>Hy&&this.ring.shift()}getRecent(){return this.ring.slice()}teardown(){if(typeof console!="undefined")for(let[e,t]of this.originals)console[e]=t;this.originals.clear(),this.ring.length=0,this.active=!1}};var vr=class{constructor(){this.name="bugReport";this.ctx=null;this.active=!1;this.submitFn=null;this.widget=null;this.mounting=!1}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}signalReport(){var e;(e=this.ctx)==null||e.signal("report")}setSubmit(e){this.submitFn=e}async mountLauncher(e){if(!(this.widget||this.mounting||typeof document=="undefined")){this.mounting=!0;try{let{createBugReportWidget:t}=await Promise.resolve().then(()=>(Jd(),Yd));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve({e:"init"})})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};$();var Qd="scalebun:tab",Zd="scalebun:live:";function Li(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Wy(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Pi(){try{let n=globalThis.crypto;if(n&&typeof n.randomUUID=="function")return n.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}function eu(){let n=Wy();if(!n)return`mem-${Pi()}`;try{let e=n.getItem(Qd);if(e)return e;let t=Pi();return n.setItem(Qd,t),t}catch{return`mem-${Pi()}`}}var _i=n=>`${Zd}${n}`;function wr(n){let e=Li();if(!e)return null;try{let t=e.getItem(_i(n));if(!t)return null;let r=JSON.parse(t);return r&&r.v===1&&typeof r.sessionId=="string"?r:null}catch{return null}}function xr(n,e){let t=Li();if(t)try{t.setItem(_i(n),JSON.stringify(e))}catch{}}function Sr(n,e){let t=wr(n);t&&(t.ended=e,t.lastActive=Date.now(),xr(n,t))}function tu(n){let e=wr(n);e&&(e.lastActive=Date.now(),xr(n,e))}function nu(n,e){let t=Li();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Zd)||i===_i(n)))try{let o=JSON.parse(t.getItem(i)||"{}");o&&(o.ended||e-(o.lastActive||0)>864e5)&&r.push(i)}catch{r.push(i)}}for(let s of r)t.removeItem(s)}catch{}}var jy=15e3,kr=class{constructor(){this.name="crash";this.ctx=null;this.active=!1;this.tabId=""}get isActive(){return this.active}setup(e){var t;this.ctx=e,typeof window!="undefined"&&(this.installReportingObserver(),this.installLiveness((t=e.sessionId)!=null?t:`sess_${q()}`),this.active=!0)}installReportingObserver(){let e=globalThis.ReportingObserver;if(e)try{this.observer=new e(t=>{for(let r of t)this.handleReport(r)},{buffered:!0}),this.observer.observe()}catch{}}handleReport(e){var o,a,c,l,u,d,p,f;if(e.type==="deprecation")return;let t=(o=e.body)!=null?o:{},r=e.type==="crash",s=r?`Browser crash report: ${(a=t.reason)!=null?a:"unknown"}`:(c=t.message)!=null?c:`${e.type} report`,i=t.sourceFile?`${t.sourceFile}:${(l=t.lineNumber)!=null?l:0}:${(u=t.columnNumber)!=null?u:0}`:void 0;this.emitError({type:r?"crash":"handled",message:s,stack:i,fingerprint:`report:${e.type}:${(p=(d=t.reason)!=null?d:t.id)!=null?p:s}`.slice(0,180),metadata:{reportType:e.type,reason:t.reason,anticipated:t.anticipated,url:e.url}}),r&&((f=this.ctx)==null||f.signal("error"))}installLiveness(e){var s;this.tabId=eu();let t=wr(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();xr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=ru())!=null?s:"",ended:!1}),nu(this.tabId,r),this.onHide=()=>Sr(this.tabId,!0),this.onShow=()=>Sr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>tu(this.tabId),jy)}emitRecoveredCrash(e){var s,i,o;let t=Math.max(0,e.lastActive-e.startedAt),r=this.buildError({type:"crash",message:"Session ended abnormally (tab crash, OOM, or forced close \u2014 no graceful shutdown)",fingerprint:"session-abnormal-termination",screenName:e.screen||void 0,metadata:{reason:"unfinalized-session",priorSessionId:e.sessionId,durationMs:t,lastScreen:e.screen},timestamp:e.lastActive});if((s=this.ctx)!=null&&s.emitFor){this.ctx.emitFor(e.sessionId,r);return}(i=this.ctx)==null||i.emit({...r,type:"handled"}),(o=this.ctx)==null||o.signal("error")}buildError(e){var t,r;return{kind:"error",type:e.type,message:j(e.message),stack:e.stack,source:"js",fingerprint:e.fingerprint,screenName:(t=e.screenName)!=null?t:ru(),clientId:`crash_${q()}`,timestamp:(r=e.timestamp)!=null?r:P(),...e.metadata?{metadata:e.metadata}:{}}}emitError(e){var t;(t=this.ctx)==null||t.emit(this.buildError(e))}teardown(){if(this.observer){try{this.observer.disconnect()}catch{}this.observer=void 0}this.heartbeat&&clearInterval(this.heartbeat),this.heartbeat=void 0,typeof window!="undefined"&&(this.onHide&&window.removeEventListener("pagehide",this.onHide),this.onShow&&window.removeEventListener("pageshow",this.onShow)),this.tabId&&Sr(this.tabId,!0),this.active=!1}};function ru(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Wt();var Ky=50,Er=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.buffer=new Be("engage-pending")}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;e.platform&&t.set("platform",e.platform),e.appVersion&&t.set("appVersion",e.appVersion),e.deviceId&&t.set("deviceId",e.deviceId),e.endUserId&&t.set("endUserId",e.endUserId);try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}postImpressions(e){return this.post("/sdk/engage/surveys/impressions",{schemaVersion:1,impressions:e})}postResponses(e){return this.postWithRetry("/sdk/engage/responses",{schemaVersion:1,responses:e})}postEvents(e){return this.post("/sdk/engage/events",{schemaVersion:1,events:e})}postRatingEvents(e){return this.postWithRetry("/ingestion/rating-events",{schemaVersion:1,events:e})}async presignAttachments(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/engage/attachments/presign`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,attachments:e})});return t.ok?await t.json():null}catch{return null}}async putBlob(e,t,r){if(typeof fetch=="undefined")return!1;try{return(await fetch(e,{method:"PUT",body:t,headers:{"content-type":r}})).ok}catch{return!1}}async post(e,t){if(!this.usable)return!1;try{return(await fetch(`${this.apiBaseUrl}${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),keepalive:!0})).ok}catch{return!1}}async postWithRetry(e,t,r=3,s=800){for(let i=0;i<r;i++){if(await this.post(e,t))return!0;i<r-1&&await new Promise(o=>setTimeout(o,s*2**i))}return await this.park(e,t),!1}async park(e,t){try{let s=[...await this.buffer.load(),{path:e,body:t}].slice(-Ky);await this.buffer.save(s)}catch{}}async flushParked(){if(!this.usable)return;let e;try{e=await this.buffer.load()}catch{return}if(!e.length)return;let t=[];for(let r of e)!r||typeof r.path!="string"||await this.post(r.path,r.body)||t.push(r);await this.buffer.save(t)}};var Gx=32,Xx=3e4,em="scalebun_engage_sessions";function tm(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Yx(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var ls=class{constructor(){this.name="engage";this.ctx=null;this.active=!1;this.screen="";this.buffer=[];this.bufferOpen=!0}get isActive(){return this.active}async setup(e){var i;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(i=e.clientKey)!=null?i:"";if(!t||!e.apiBaseUrl)return;this.transport=new Er(e.apiBaseUrl,t),this.screen=tm(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(o=>this.onSignal(o)),this.onPop=()=>this.onScreenView(tm()),window.addEventListener("popstate",this.onPop);let{count:r,isNewSession:s}=this.bumpSessionCount();s&&(this.onLifecycle("session_start"),this.onLifecycle("app_open"),this.onLifecycle("n_sessions",r)),await this.refresh()}async refresh(){var i,o,a,c,l,u;if(!this.transport)return;let e=await this.transport.fetchConfig({platform:"web",appVersion:(i=this.ctx)==null?void 0:i.appVersion,deviceId:(o=this.ctx)==null?void 0:o.deviceId,endUserId:(c=(a=this.ctx)==null?void 0:a.getUserId)==null?void 0:c.call(a)});if(!Yx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Fi(),cu)),r=t(e),s=await this.ensureRuntime();s&&(s.setCampaigns(r.campaigns),s.setMessages(r.inAppMessages),this.drain(s))}async ensureRuntime(){var t,r,s,i,o;if(this.runtime)return this.runtime;if(!this.transport)return;let{EngageRuntime:e}=await Promise.resolve().then(()=>(Zf(),Qf));return this.runtime=new e({transport:this.transport,deviceId:(r=(t=this.ctx)==null?void 0:t.deviceId)!=null?r:"",sessionId:(i=(s=this.ctx)==null?void 0:s.sessionId)!=null?i:"",uuid:q,now:P,currentScreen:()=>this.screen,replayCoord:Z,signal:a=>{var c;return(c=this.ctx)==null?void 0:c.signal(a)},...(o=this.ctx)!=null&&o.onInAppGameRequest?{gameHandler:this.ctx.onInAppGameRequest}:{}}),this.runtime}async submit(e,t){let r=await this.ensureRuntime();return r?r.submitFor(e,t):"error"}emitRatingEvent(e,t){this.ensureRuntime().then(r=>r==null?void 0:r.emitRatingEvent(e,t))}async resetInAppState(){let{clearEngageState:e}=await Promise.resolve().then(()=>(Ui(),gu));e()}onScreenView(e){this.screen=e,this.feed("screen",e)}onIdentify(){this.active&&this.refresh()}onCustomEvent(e){this.feed("custom",e)}onSignal(e){this.feed("signal",e)}onLifecycle(e,t){this.feed("lifecycle",e,t)}feed(e,t,r){if(this.runtime){this.dispatch(this.runtime,e,t,r,0);return}this.bufferOpen&&(this.buffer.push({ch:e,value:t,arg:r,at:P()}),this.buffer.length>Gx&&this.buffer.shift())}dispatch(e,t,r,s,i){switch(t){case"screen":e.onScreenView(r,i);break;case"custom":e.onCustomEvent(r,i);break;case"signal":e.onSignal(r,i);break;case"lifecycle":e.onLifecycle(r,s,i);break}}drain(e){let t=P()-Xx;for(let r of this.buffer)r.at<t||this.dispatch(e,r.ch,r.value,r.arg,P()-r.at);this.closeBuffer()}closeBuffer(){this.bufferOpen=!1,this.buffer=[]}bumpSessionCount(){var e,t;try{let r=(t=(e=this.ctx)==null?void 0:e.sessionId)!=null?t:"",s=localStorage.getItem(em),i=s?JSON.parse(s):{};if(r&&i.sessionId===r&&typeof i.count=="number")return{count:i.count,isNewSession:!1};let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(em,JSON.stringify({sessionId:r,count:o})),{count:o,isNewSession:!0}}catch{return{count:1,isNewSession:!0}}}teardown(){var e,t;(e=this.unsub)==null||e.call(this),this.unsub=void 0,this.onPop&&typeof window!="undefined"&&window.removeEventListener("popstate",this.onPop),this.onPop=void 0,(t=this.runtime)==null||t.stop(),this.runtime=void 0,this.closeBuffer(),this.active=!1}};$();$o();function eS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var ds=class{constructor(){this.name="webPerf";this.ctx=null;this.active=!1}get isActive(){return this.active}async setup(e){if(this.ctx=e,typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startCollectors:t}=await Promise.resolve().then(()=>(sm(),rm));this.active&&(this.stop=t((r,s,i,o)=>this.emit(r,s,i,o),()=>this.active))}emit(e,t,r,s){var i;(i=this.ctx)==null||i.emit({kind:"performance",metric:e,value:t,screenName:eS(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${q()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};var ps=class{constructor(){this.name="exitIntent";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined")return;this.active=!0;let{startExitIntent:t}=await Promise.resolve().then(()=>(pm(),um));this.active&&(this.handle=t(e,e.exitIntent))}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var Xh=[new Vn,new $n,new jn,new er,new tr,new ds,new dr,new gr,new yr,new vr,new kr,new ls,new ps],Yh={replay:async()=>new(await Promise.resolve().then(()=>(Jm(),Ym))).ReplayFeature,inbox:async()=>new(await Promise.resolve().then(()=>(ch(),ah))).InboxFeature,profiler:async()=>new(await Promise.resolve().then(()=>(dh(),lh))).ProfilerFeature,watchdog:async()=>new(await Promise.resolve().then(()=>(Ch(),Ih))).WatchdogFeature,inapp2:async()=>new(await Promise.resolve().then(()=>(Gh(),Kh))).InApp2Feature},Rk={config:["network"],analytics:["network"],errors:["dom"],network:["dom"],webVitals:["performanceObserver"],webPerf:["performanceObserver"],performance:["performance"],journey:["dom"],console:["dom"],bugReport:["dom"],crash:["dom"],engage:["dom"],inbox:["dom"],profiler:["dom"],watchdog:["performanceObserver"],exitIntent:["dom"],inapp2:["dom"],replay:["dom"]};function Ba(n){var e;return(e=Rk[n])!=null?e:["dom"]}$();function Tk(n){return n==="frame"?"replay":n==="network"?"networkMonitoring":n==="error"?"crashReporting":n==="performance"||n==="resource"||n==="trace"||n==="transaction"?"performanceMonitoring":""}var fn=class{static async bootstrap(e,t){var b,E,w,I;let r=Ja(e),s=tc(r.debug),i=new In(r),o=new Cn(r),a=new Ln(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new _n;yc(),xc(),typeof((b=r.errors)==null?void 0:b.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),mc((E=r.errors)==null?void 0:E.beforeBreadcrumb);let l=S=>{var M,R;let C=Tk(S.kind);C&&((R=(M=c.get("config"))==null?void 0:M.entitlement)==null?void 0:R.call(M,C))===!1||(bc(S),wc(S),a.emit(S))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var S,C;return(C=(S=c.get("analytics"))==null?void 0:S.identity)==null?void 0:C.userId},emit:l,emitFor:(S,C)=>a.emitFor(S,C),egressPending:()=>a.pendingCount,trackEvent:(S,C)=>l({kind:"event",name:S,props:C,timestamp:Date.now()}),getAppState:()=>gt("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(S,C)=>{for(let M of u)try{M(S,C)}catch{}},onSignal:S=>(u.add(S),()=>u.delete(S)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(w=r.flags)==null?void 0:w.bootstrap,flagsRealtime:(I=r.flags)==null?void 0:I.realtime,replayCanvas:r.replayCanvas,replayFrameOrigins:r.replayFrameOrigins,autocapture:r.autocapture,traceOrigins:r.tracePropagation?[...typeof location!="undefined"?[location.origin]:[],...r.tracePropagationOrigins]:[],maskReplayText:r.privacy.maskReplayText,maskEventText:r.privacy.maskEventText,maskSelectors:r.privacy.maskSelectors,maskInputs:r.privacy.maskInputs,respectDnt:r.privacy.respectDnt,exitIntent:r.exitIntent},p=r.features,f=()=>{for(let S of Xh)p[S.name]!==!1&&Ba(S.name).every(C=>gt(C))&&c.add(S)};f();let m=async()=>{await Promise.all(Object.entries(Yh).map(async([S,C])=>{if(p[S]===!0&&Ba(S).every(M=>gt(M))&&!c.get(S))try{c.add(await C())}catch(M){s(`[scalebun] optional feature "${S}" failed to load:`,M)}}))},h=new vn(r.consent.initial),g=!1,x=async()=>{var C;if(g)return;g=!0,f(),await m(),await c.setupAll(d),t!=null&&t.edge||await a.start();let S=(C=c.get("analytics"))==null?void 0:C.identity;if(S!=null&&S.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:S.userId,anonymousId:S.anonymousId,timestamp:Date.now()}),S){Oe(S.superProps);let M=S.groups;if(M)for(let R of Object.keys(M))Oe({[`group_${R}`]:M[R]});S.userId&&Oe({userId:S.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},y={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:S=>{h.set(S?"granted":"denied"),S?(a.setConsentGranted(!0),x()):(a.setConsentGranted(!1),g&&c.teardownAll(),g=!1,a.discard())},get consentStatus(){return h.value}};return!r.consent.required||h.granted?await x():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:h.value}),y}};$();ar();var Ua=class{constructor(){this.rt=null;this.ready=!1;this.pendingConsent=null;this.pushFeature=null;this.coachFeature=null;this.coachController=null;this.pendingPushOpenCbs=[];this.settle=null;this.settled=new Promise(e=>{this.settle=e});this.replay={stats:()=>{var e,t;return(t=(e=this.replayFeature())==null?void 0:e.stats())!=null?t:null},checkpoint:e=>{var t;return(t=this.replayFeature())==null?void 0:t.checkpoint(e)},flush:()=>{var e;return(e=this.replayFeature())==null?void 0:e.flush()},stop:()=>{var e;return(e=this.replayFeature())==null?void 0:e.teardown()},start:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},pause:()=>{var e;return(e=this.replayFeature())==null?void 0:e.pause()},resume:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},setPrivacy:e=>{var t;return(t=this.replayFeature())==null?void 0:t.setPrivacy(e)}};this.performance={startTransaction:e=>{var r,s,i;let t=(r=this.rt)==null?void 0:r.registry.get("performance");return(i=(s=t==null?void 0:t.startTransaction)==null?void 0:s.call(t,e))!=null?i:or},startTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.startTrace)==null||s.call(t,e)},stopTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.stopTrace)==null||s.call(t,e)},markScreenLoadStart:e=>{},sendMetric:(e,t)=>{var r;(r=this.rt)==null||r.pipeline.emit({kind:"performance",metric:e,value:t,timestamp:P()})}};this.session={start:()=>{},end:()=>{this.close()},emitEvent:(e,t)=>{this.track(e,t)}};this.engage={track:(e,t)=>this.track(e,t),refresh:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.refresh())!=null?t:Promise.resolve()},submit:(e,t)=>{var r,s;return(s=(r=this.engageFeature())==null?void 0:r.submit(e,t))!=null?s:Promise.resolve("error")},emitRatingEvent:(e,t)=>{var r;return(r=this.engageFeature())==null?void 0:r.emitRatingEvent(e,t)},resetInAppState:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.resetInAppState())!=null?t:Promise.resolve()}};this.push={enable:e=>this.enablePush(e),disable:e=>this.ensurePush().then(t=>{var r;return(r=t==null?void 0:t.disable(e))!=null?r:!1}),status:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.status())!=null?t:Promise.resolve({supported:!1,permission:"default",subscribed:!1,endpoint:null,state:"unsupported"})}),getSubscription:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.getSubscription())!=null?t:null}),check:async e=>{let t=await this.ensurePush();return t?t.check(e):(await Promise.resolve().then(()=>(Ha(),qa))).notInitializedReport()}};this.attribution={getInstallationId:()=>{var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.getInstallationId())!=null?t:""},setClickId:e=>{var t;return(t=this.analyticsFeature())==null?void 0:t.setClickId(e)}};this.flagExposed=new Set;this.flags={isEnabled:e=>{var s;let t=this.cfg(),r=(s=t==null?void 0:t.isEnabled(e))!=null?s:!1;return t!=null&&t.knows(e)&&this.recordExposure(e,r),r},variation:(e,t)=>this.flags.variationDetail(e,t).value,variationDetail:(e,t)=>{var i,o,a;let r=(o=(i=this.cfg())==null?void 0:i.variationDetail(e,t))!=null?o:{value:t,variant:null,reason:"FLAG_NOT_FOUND"},s=(a=r.variant)!=null?a:typeof r.value=="object"?null:r.value;return this.recordExposure(e,typeof s=="number"?String(s):s,r.reason),r},ready:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.ready())!=null?t:Promise.resolve()},onChange:e=>{var t,r;return(r=(t=this.cfg())==null?void 0:t.onChange(e))!=null?r:()=>{}},override:(e,t)=>{var r;return(r=this.cfg())==null?void 0:r.override(e,t)},clearOverride:e=>{var t;return(t=this.cfg())==null?void 0:t.clearOverride(e)},clearOverrides:()=>{var e;return(e=this.cfg())==null?void 0:e.clearOverrides()}};this.config={get:(e,t)=>{var r,s;return(s=(r=this.cfg())==null?void 0:r.get(e,t))!=null?s:t},refresh:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.refresh())!=null?t:Promise.resolve()}};this.rollouts={isOn:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.isOn(e))!=null?s:!1;return this.recordExposure(e,t),t}};this.experiments={variant:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.variant(e))!=null?s:null;return this.recordExposure(e,t),t}};this.profiler={available:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.available())!=null?t:!1},start:e=>{var t,r;return(r=(t=this.prof())==null?void 0:t.start(e))!=null?r:!1},stop:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.stop())!=null?t:Promise.resolve(!1)}};this.watchdog={stats:()=>{var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("watchdog");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}}}whenReady(){return this.settled}async init(e){var t,r,s,i,o;if(!this.ready){if(Sn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),Ic()){let a=Ws();if(a==="edge"||a==="worker"){try{this.rt=await fn.bootstrap(e,{edge:!0}),this.ready=!0}catch(c){typeof console!="undefined"&&console.warn("[scalebun] edge init failed:",c)}return}e!=null&&e.debug&&typeof console!="undefined"&&console.warn("[scalebun] init() on SSR \u2014 deferring capture to the client.");return}try{if(this.rt=await fn.bootstrap(e),this.ready=!0,this.pendingConsent!==null&&(this.rt.setConsent(this.pendingConsent),this.pendingConsent=null),this.rt.config.features.bugReport!==!1){let c=this.rt.registry.get("bugReport");(r=c==null?void 0:c.setSubmit)==null||r.call(c,l=>this.reportBugDetailed(l)),this.rt.config.bugReport.launcher&&((s=c==null?void 0:c.mountLauncher)==null||s.call(c,{position:this.rt.config.bugReport.position,label:this.rt.config.bugReport.label}))}let a=(i=e==null?void 0:e.push)==null?void 0:i.softAsk;a&&Promise.resolve().then(()=>(eg(),Zh)).then(({armSoftAsk:c})=>c(a,{enable:()=>this.enablePush(),permission:()=>Notification.permission})).catch(()=>{})}catch(a){typeof console!="undefined"&&console.warn("[scalebun] init failed:",a)}finally{(o=this.settle)==null||o.call(this)}}}setConsent(e){this.rt?this.rt.setConsent(e):this.pendingConsent=e}track(e,t){var r,s,i,o;(r=this.analyticsFeature())!=null&&r.evaluate(e,t).drop||((s=this.rt)==null||s.pipeline.emit(this.enrichEvent({kind:"event",name:e,props:t,timestamp:P()})),(i=this.analyticsFeature())==null||i.track(e,t),(o=this.engageFeature())==null||o.onCustomEvent(e))}enrichEvent(e){var c;let t=(c=this.analyticsFeature())==null?void 0:c.identity,r=Z(),s=t==null?void 0:t.superProps,i=e.props,o=s&&Object.keys(s).length?{...s,...i!=null?i:{}}:i,a=o&&mt(o);return{...e,...a!==void 0?{props:a}:{},...t!=null&&t.anonymousId?{anonymousId:t.anonymousId}:{},...t!=null&&t.userId?{userId:t.userId}:{},...t!=null&&t.groups&&Object.keys(t.groups).length?{groups:t.groups}:{},...r?{replay:r}:{}}}register(e){var t;(t=this.analyticsFeature())==null||t.register(e),Oe(e)}unregister(e){var t;(t=this.analyticsFeature())==null||t.unregister(e)}group(e,t,r){var s,i;!e||!t||((s=this.analyticsFeature())==null||s.group(e,t,r),Oe({[`group_${e}`]:t}),(i=this.rt)==null||i.pipeline.emit(this.enrichEvent({kind:"event",name:"$group",props:{group_type:e,group_key:t,...r!=null?r:{}},timestamp:P()})))}alias(e,t){var i,o,a,c;if(!e)return;let r=(i=this.analyticsFeature())==null?void 0:i.identity,s=(o=t!=null?t:r==null?void 0:r.userId)!=null?o:r==null?void 0:r.anonymousId;(a=this.analyticsFeature())==null||a.alias(e,t),(c=this.rt)==null||c.pipeline.emit({kind:"identify",userId:e,previousId:s,timestamp:P()})}reset(){var e,t,r,s,i;(e=this.engageFeature())==null||e.onLifecycle("before_logout"),(t=this.analyticsFeature())==null||t.reset(),kc(),(i=this.rt)==null||i.pipeline.emit({kind:"identify",reset:!0,anonymousId:(s=(r=this.analyticsFeature())==null?void 0:r.identity)==null?void 0:s.anonymousId,timestamp:P()})}trackPurchase(e){var r,s,i;let t=On(e);t&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"purchase",props:t.props,revenue:t.revenue,currency:t.currency,timestamp:P()})),(s=this.analyticsFeature())==null||s.trackPurchase(e),(i=this.engageFeature())==null||i.onCustomEvent("purchase"))}trackSubscription(e){var t;(t=this.analyticsFeature())==null||t.trackSubscription(e)}trackScreen(e,t){var r,s;e&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"SCREEN_VIEW",screenName:e,props:t,timestamp:P()})),(s=this.engageFeature())==null||s.onScreenView(e))}identify(e,t){var s,i,o,a,c,l,u,d;let r=(i=(s=this.analyticsFeature())==null?void 0:s.identity)==null?void 0:i.anonymousId;(o=this.rt)==null||o.pipeline.emit({kind:"identify",userId:e,anonymousId:r,traits:t,timestamp:P()}),(a=this.analyticsFeature())==null||a.identify(e,t),Oe({userId:e,...t!=null?t:{}}),(c=this.engageFeature())==null||c.onIdentify(),(d=(u=(l=this.rt)==null?void 0:l.registry.get("inapp2"))==null?void 0:u.onIdentify)==null||d.call(u)}setUser(e){e!=null&&e.id&&this.identify(e.id,e)}captureError(e,t){var a,c,l;let r=t!=null&&t.componentStack?{componentStack:t.componentStack}:void 0,s=t&&(t.level||t.tags||t.context||t.fingerprint)?{level:t.level,tags:t.tags,context:t.context,fingerprint:t.fingerprint}:void 0,i=(a=this.rt)==null?void 0:a.registry.get("errors");if(i!=null&&i.captureHandled){i.captureHandled(e,r,s);return}let o=e;(l=this.rt)==null||l.pipeline.emit({kind:"error",type:"handled",message:(c=o==null?void 0:o.message)!=null?c:String(e),stack:o==null?void 0:o.stack,source:"js",timestamp:P(),...r!=null?r:{}})}addBreadcrumb(e){var t;gc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){Sl(e,t)}setContext(e,t){kl(e,t)}setErrorLevel(e){El(e)}submitRating(e,t,r){var o,a;let s=Math.round(e);if(!Number.isFinite(s)||s<1||s>5){(o=this.rt)==null||o.log("[scalebun] submitRating: score must be an integer 1\u20135, got",e);return}let i={kind:"rating",score:s,comment:t,surveyId:r,clientRatingId:`rat_${q()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(io(),Vu));return r(e,t)}async reportBug(e){let t=await this.reportBugDetailed(e);return typeof t=="string"?t:null}async reportBugDetailed(e){var t,r,s,i;if(!this.rt)return{e:"init"};if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),{e:"off"};if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),{e:"empty"};if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),{e:"consent"};try{let o=this.rt.registry.get("bugReport");(t=o==null?void 0:o.signalReport)==null||t.call(o);let a=this.rt.registry.get("console"),c=(s=(r=a==null?void 0:a.getRecent)==null?void 0:r.call(a))!=null?s:[],{buildBugReportPayload:l}=await Promise.resolve().then(()=>(ng(),tg)),u=Z(),d=l({message:e.message,title:e.title,email:e.email},c,{replayCoord:u}),p=await this.rt.transport.submitBugReport(this.rt.session.sessionId,d);return await this.rt.pipeline.flush(),(i=p==null?void 0:p.id)!=null?i:{e:"send"}}catch{return{e:"send"}}}async flush(){var e,t;await Promise.all([(e=this.rt)==null?void 0:e.pipeline.flush(),(t=this.analyticsFeature())==null?void 0:t.flush()])}errorStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("errors");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}perfStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("performance");return(s=(r=e==null?void 0:e.perfStats)==null?void 0:r.call(e))!=null?s:null}networkStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("network");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}async close(){var e,t;(e=this.rt)==null||e.registry.teardownAll(),await((t=this.rt)==null?void 0:t.pipeline.stop()),this.rt=null,this.ready=!1}get sessionId(){var e;return(e=this.rt)==null?void 0:e.session.sessionId}egressStats(){var r,s,i,o,a,c,l,u,d,p,f,m,h;let e=this.analyticsFeature(),t=(r=this.rt)==null?void 0:r.pipeline.ledger;return{pending:((i=(s=this.rt)==null?void 0:s.pipeline.pendingCount)!=null?i:0)+((o=e==null?void 0:e.pending)!=null?o:0),dropped:((c=(a=this.rt)==null?void 0:a.pipeline.dropped)!=null?c:0)+((l=e==null?void 0:e.dropped)!=null?l:0),queued:(u=t==null?void 0:t.queued)!=null?u:0,attempted:(d=t==null?void 0:t.attempted)!=null?d:0,retried:(p=t==null?void 0:t.retried)!=null?p:0,recovered:(f=t==null?void 0:t.recovered)!=null?f:0,expired:(m=t==null?void 0:t.expired)!=null?m:0,acked:(h=t==null?void 0:t.acked)!=null?h:0}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}setUiState(e,t){Ka(e,t)}clearUiState(e){Ga(e)}analyticsFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("analytics")}replayFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("replay")}engageFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("engage")}inboxFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("inbox")}inbox(){var e,t;return(t=(e=this.inboxFeature())==null?void 0:e.controller())!=null?t:jk}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(og(),ig)).then(({CoachmarkFeature:e})=>{var s,i;if(this.coachFeature)return this.coachFeature;let t={trackEvent:(o,a)=>this.track(o,a),replayCoord:Z,apiBaseUrl:(s=this.rt)==null?void 0:s.config.apiBaseUrl,clientKey:(i=this.rt)==null?void 0:i.config.clientKey},r=new e(t);return this.coachFeature=r,r}):Promise.resolve(null)}coachmarks(){if(this.coachController)return this.coachController;let e=t=>{this.ensureCoach().then(r=>{r&&t(r)})};return this.coachController={start:(t,r)=>e(s=>s.start(t,r)),startInline:t=>e(r=>r.start(t)),startById:(t,r)=>e(s=>void s.startById(t,r)),reportAnchors:()=>e(t=>t.reportAnchors()),next:()=>e(t=>t.next()),back:()=>e(t=>t.back()),skip:()=>e(t=>t.skip()),end:()=>e(t=>t.end()),notify:t=>e(r=>r.notify(t)),current:()=>{var t,r;return(r=(t=this.coachFeature)==null?void 0:t.current())!=null?r:{tourId:null,index:0,status:"idle"}},on:(t,r)=>{if(this.coachFeature)return this.coachFeature.on(t,r);let s=null,i=!1;return this.ensureCoach().then(o=>{o&&!i&&(s=o.on(t,r))}),()=>{i=!0,s==null||s()}}},this.coachController}async ensurePush(){if(this.pushFeature)return this.pushFeature;if(!this.rt)return null;let{PushFeature:e}=await Promise.resolve().then(()=>(ug(),dg));this.pushFeature=new e({apiBaseUrl:this.rt.config.apiBaseUrl,clientKey:this.rt.config.clientKey,deviceId:this.rt.session.deviceId,log:this.rt.log}),this.pushFeature.onNotificationOpened(({data:t,action:r})=>{this.track("$push_opened",{...r?{action:r}:{},...t&&typeof t=="object"?t:{}})});for(let t of this.pendingPushOpenCbs)this.pushFeature.onNotificationOpened(t);return this.pendingPushOpenCbs=[],this.pushFeature}async enablePush(e){let t=await this.ensurePush();return t?t.enable(e):"error"}onNotificationOpened(e){return this.pushFeature?this.pushFeature.onNotificationOpened(e):(this.pendingPushOpenCbs.push(e),this.ensurePush(),()=>{var r;(r=this.pushFeature)==null||r.onNotificationOpened(e);let t=this.pendingPushOpenCbs.indexOf(e);t>=0&&this.pendingPushOpenCbs.splice(t,1)})}cfg(){var e;return(e=this.rt)==null?void 0:e.registry.get("config")}recordExposure(e,t,r){var i;if(!this.rt||t==null)return;let s=`${e}=${String(t)}`;this.flagExposed.has(s)||(this.flagExposed.add(s),(i=this.analyticsFeature())==null||i.register({[`$feature/${e}`]:t}),this.track("$feature_flag_called",{flag_key:e,flag_value:t,...r?{reason:r}:{}}))}prof(){var e;return(e=this.rt)==null?void 0:e.registry.get("profiler")}},rt=()=>{},Ye=()=>Promise.resolve(),pg={unreadCount:0,total:0,syncStatus:"idle"},jk={subscribe:n=>(n(pg),rt),onUnreadChange:n=>(n(0),rt),getState:()=>pg,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Ye,markUnread:Ye,markAllRead:Ye,archive:Ye,unarchive:Ye,pin:Ye,remove:Ye,refresh:Ye,ingest:Ye,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new Ua;$();function Kk(n,e){let t=n.ScaleBun;n.ScaleBun=hn;let r=!1;if(t&&Array.isArray(t.q))for(let i of t.q){let[o,a]=i;o==="init"&&(r=!0);let c=hn[o];if(typeof c=="function"){let l=a?Array.prototype.slice.call(a):[];try{c.apply(hn,l)}catch{}}}let s=e==null?void 0:e.dataset;if(!r&&(s!=null&&s.clientKey)){let i={clientKey:s.clientKey};s.apiBaseUrl&&(i.apiBaseUrl=s.apiBaseUrl),s.environment&&(i.environment=s.environment),s.autocapture!=null&&(i.autocapture=s.autocapture!=="false"),hn.init(i)}}if(typeof window!="undefined"){let n=typeof document!="undefined"?document.currentScript:null;Sn(n==null?void 0:n.nonce),Kk(window,n)}})();
717
717
  //# sourceMappingURL=scalebun.min.js.map