@scalebun/web 1.0.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/SDKBootstrapper.d.ts +6 -6
- package/dist/bootstrap/SDKBootstrapper.js +8 -8
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +8 -6
- package/dist/browser.js.map +1 -1
- package/dist/config/endpoints.d.ts +12 -0
- package/dist/config/endpoints.d.ts.map +1 -0
- package/dist/config/endpoints.js +12 -0
- package/dist/config/endpoints.js.map +1 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +5 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/core/breadcrumbs.js +1 -1
- package/dist/core/index.d.ts +13 -13
- package/dist/core/index.js +13 -13
- package/dist/core/observe.js +1 -1
- package/dist/core/pageContext.d.ts +1 -1
- package/dist/features/analytics/AnalyticsFeature.d.ts +2 -2
- package/dist/features/analytics/AnalyticsFeature.js +10 -10
- package/dist/features/analytics/autocapture.js +4 -4
- package/dist/features/analytics/sampler.js +1 -1
- package/dist/features/bugreport/BugReportFeature.d.ts +1 -1
- package/dist/features/bugreport/BugReportFeature.js +1 -1
- package/dist/features/bugreport/collect.js +1 -1
- package/dist/features/bugreport/widget.js +9 -9
- package/dist/features/coach/CoachmarkFeature.d.ts +1 -1
- package/dist/features/coach/CoachmarkFeature.js +5 -5
- package/dist/features/coach/anchor.d.ts +1 -1
- package/dist/features/coach/overlay.d.ts +1 -1
- package/dist/features/coach/overlay.js +21 -21
- package/dist/features/coach/position.d.ts +1 -1
- package/dist/features/coach/predicate.d.ts +1 -1
- package/dist/features/coach/tour.d.ts +4 -4
- package/dist/features/coach/tour.js +1 -1
- package/dist/features/coach/types.d.ts +1 -1
- package/dist/features/coach/wait.d.ts +2 -2
- package/dist/features/config/ConfigFeature.d.ts +1 -1
- package/dist/features/config/ConfigFeature.js +5 -5
- package/dist/features/config/configStore.d.ts +1 -1
- package/dist/features/config/targeting.d.ts +1 -1
- package/dist/features/console/ConsoleFeature.js +3 -3
- package/dist/features/console/normalize.js +2 -2
- package/dist/features/console/throttle.d.ts +1 -1
- package/dist/features/crash/CrashFeature.js +2 -2
- package/dist/features/engage/EngageFeature.d.ts +3 -3
- package/dist/features/engage/EngageFeature.js +5 -5
- package/dist/features/engage/attachments.d.ts +1 -1
- package/dist/features/engage/attachments.js +3 -3
- package/dist/features/engage/gameLogic.d.ts +1 -1
- package/dist/features/engage/gameResolver.d.ts +2 -2
- package/dist/features/engage/gameResolver.js +1 -1
- package/dist/features/engage/inappSlots.d.ts +1 -1
- package/dist/features/engage/inappSlots.js +1 -1
- package/dist/features/engage/normalize.d.ts +1 -1
- package/dist/features/engage/richInApp.d.ts +3 -3
- package/dist/features/engage/richInApp.js +6 -6
- package/dist/features/engage/runtime.d.ts +3 -3
- package/dist/features/engage/runtime.js +7 -7
- package/dist/features/engage/shakeDetector.js +1 -1
- package/dist/features/engage/throttle.d.ts +1 -1
- package/dist/features/engage/transport.d.ts +1 -1
- package/dist/features/engage/transport.js +1 -1
- package/dist/features/engage/triggerEngine.d.ts +1 -1
- package/dist/features/engage/widget/InAppWidget.d.ts +1 -1
- package/dist/features/engage/widget/InAppWidget.js +18 -18
- package/dist/features/engage/widget/SurveyWidget.d.ts +1 -1
- package/dist/features/engage/widget/SurveyWidget.js +66 -66
- package/dist/features/errors/ErrorsFeature.d.ts +1 -1
- package/dist/features/errors/ErrorsFeature.js +6 -6
- package/dist/features/errors/group/fingerprint.js +1 -1
- package/dist/features/errors/lazy.d.ts +3 -3
- package/dist/features/errors/lazy.js +3 -3
- package/dist/features/errors/normalize.d.ts +2 -2
- package/dist/features/errors/normalize.js +2 -2
- package/dist/features/errors/redact.js +1 -1
- package/dist/features/errors/sampling.js +1 -1
- package/dist/features/exit-intent/ExitIntentFeature.js +1 -1
- package/dist/features/exit-intent/engine.js +1 -1
- package/dist/features/forms/index.js +1 -1
- package/dist/features/inapp/InApp2Feature.js +1 -1
- package/dist/features/inapp/anchor/controller.d.ts +2 -2
- package/dist/features/inapp/anchor/controller.js +3 -3
- package/dist/features/inapp/api.d.ts +5 -5
- package/dist/features/inapp/api.js +3 -3
- package/dist/features/inapp/blocks/blocks.d.ts +1 -1
- package/dist/features/inapp/blocks/blocks.js +1 -1
- package/dist/features/inapp/blocks/feedback.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/carousel.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/chart.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/code.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/confetti.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/countdown.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/index.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/index.js +18 -18
- package/dist/features/inapp/blocks/heavy/markdown.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/productgrid.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/qr.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/scratch.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/scratch.js +1 -1
- package/dist/features/inapp/blocks/heavy/slot.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/slot.js +1 -1
- package/dist/features/inapp/blocks/heavy/spinwheel.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/spinwheel.js +1 -1
- package/dist/features/inapp/blocks/heavy/steps.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/streak.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/table.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/unavailable.d.ts +1 -1
- package/dist/features/inapp/blocks/heavy/video.d.ts +1 -1
- package/dist/features/inapp/blocks/styles.js +191 -191
- package/dist/features/inapp/center/bridge.d.ts +3 -3
- package/dist/features/inapp/center/bridge.js +1 -1
- package/dist/features/inapp/center/panel.d.ts +2 -2
- package/dist/features/inapp/center/panel.js +33 -33
- package/dist/features/inapp/center/store.d.ts +1 -1
- package/dist/features/inapp/center/sync.d.ts +1 -1
- package/dist/features/inapp/center/types.d.ts +1 -1
- package/dist/features/inapp/core/analytics.d.ts +3 -3
- package/dist/features/inapp/core/analytics.js +1 -1
- package/dist/features/inapp/core/compat.d.ts +2 -2
- package/dist/features/inapp/core/debugOverlay.d.ts +2 -2
- package/dist/features/inapp/core/debugOverlay.js +12 -12
- package/dist/features/inapp/core/engine.d.ts +3 -3
- package/dist/features/inapp/core/engine.js +10 -10
- package/dist/features/inapp/core/host.js +22 -22
- package/dist/features/inapp/core/metrics.d.ts +1 -1
- package/dist/features/inapp/core/migration.d.ts +2 -2
- package/dist/features/inapp/core/migration.js +2 -2
- package/dist/features/inapp/core/orchestrator.d.ts +1 -1
- package/dist/features/inapp/core/respect.d.ts +1 -1
- package/dist/features/inapp/core/targeting.d.ts +1 -1
- package/dist/features/inapp/core/targeting.js +1 -1
- package/dist/features/inapp/core/triggers.d.ts +1 -1
- package/dist/features/inapp/core/triggers.js +2 -2
- package/dist/features/inapp/inappContract.web.d.ts +1 -1
- package/dist/features/inapp/index.d.ts +15 -15
- package/dist/features/inapp/index.js +10 -10
- package/dist/features/inapp/registry.web.canonical.d.ts +1 -1
- package/dist/features/inapp/registry.web.catalog.d.ts +1 -1
- package/dist/features/inapp/surfaces/banner.d.ts +1 -1
- package/dist/features/inapp/surfaces/banner.js +1 -1
- package/dist/features/inapp/surfaces/checklist.d.ts +1 -1
- package/dist/features/inapp/surfaces/coachmark.d.ts +1 -1
- package/dist/features/inapp/surfaces/coachmark.js +2 -2
- package/dist/features/inapp/surfaces/hotspot.d.ts +1 -1
- package/dist/features/inapp/surfaces/hotspot.js +2 -2
- package/dist/features/inapp/surfaces/inline.d.ts +4 -4
- package/dist/features/inapp/surfaces/inline.js +11 -11
- package/dist/features/inapp/surfaces/launcher.d.ts +1 -1
- package/dist/features/inapp/surfaces/modal.d.ts +1 -1
- package/dist/features/inapp/surfaces/modal.js +2 -2
- package/dist/features/inapp/surfaces/mount.d.ts +4 -4
- package/dist/features/inapp/surfaces/mount.js +4 -4
- package/dist/features/inapp/surfaces/palette.d.ts +1 -1
- package/dist/features/inapp/surfaces/palette.js +1 -1
- package/dist/features/inapp/surfaces/panel.d.ts +1 -1
- package/dist/features/inapp/surfaces/popover.d.ts +1 -1
- package/dist/features/inapp/surfaces/popover.js +2 -2
- package/dist/features/inapp/surfaces/render.d.ts +4 -4
- package/dist/features/inapp/surfaces/render.d.ts.map +1 -1
- package/dist/features/inapp/surfaces/render.js +23 -19
- package/dist/features/inapp/surfaces/render.js.map +1 -1
- package/dist/features/inapp/surfaces/slideover.d.ts +1 -1
- package/dist/features/inapp/surfaces/slideover.js +1 -1
- package/dist/features/inapp/surfaces/styles.js +179 -179
- package/dist/features/inapp/surfaces/surface.d.ts +4 -4
- package/dist/features/inapp/surfaces/surface.js +2 -2
- package/dist/features/inapp/surfaces/takeover.d.ts +1 -1
- package/dist/features/inapp/surfaces/takeover.js +2 -2
- package/dist/features/inapp/surfaces/toast.d.ts +1 -1
- package/dist/features/inapp/surfaces/toast.js +1 -1
- package/dist/features/inapp/surfaces/toolbar.d.ts +1 -1
- package/dist/features/inapp/surfaces/toolbar.js +2 -2
- package/dist/features/inapp/surfaces/tour.d.ts +1 -1
- package/dist/features/inapp/surfaces/tour.js +5 -5
- package/dist/features/inbox/InboxFeature.d.ts +1 -1
- package/dist/features/inbox/InboxFeature.js +5 -5
- package/dist/features/inbox/runtime.d.ts +2 -2
- package/dist/features/inbox/runtime.js +3 -3
- package/dist/features/inbox/store.d.ts +1 -1
- package/dist/features/inbox/sync.d.ts +2 -2
- package/dist/features/inbox/sync.js +1 -1
- package/dist/features/inbox/widget/InboxWidget.d.ts +1 -1
- package/dist/features/inbox/widget/InboxWidget.js +85 -85
- package/dist/features/journey/InteractionTracker.js +1 -1
- package/dist/features/journey/JourneyFeature.js +3 -3
- package/dist/features/manifest.d.ts +1 -1
- package/dist/features/manifest.js +18 -18
- package/dist/features/network/NetworkFeature.d.ts +1 -1
- package/dist/features/network/NetworkFeature.js +10 -10
- package/dist/features/network/capture/body.d.ts +1 -1
- package/dist/features/network/capture/body.js +1 -1
- package/dist/features/network/classify.d.ts +1 -1
- package/dist/features/network/fetchInterceptor.d.ts +1 -1
- package/dist/features/network/fetchInterceptor.js +1 -1
- package/dist/features/network/intercept/beacon.d.ts +1 -1
- package/dist/features/network/intercept/sse.d.ts +1 -1
- package/dist/features/network/intercept/streams.d.ts +4 -4
- package/dist/features/network/intercept/streams.js +3 -3
- package/dist/features/network/intercept/websocket.d.ts +1 -1
- package/dist/features/network/lazy.d.ts +3 -3
- package/dist/features/network/lazy.js +2 -2
- package/dist/features/network/normalize.d.ts +1 -1
- package/dist/features/network/normalize.js +3 -3
- package/dist/features/network/parse/graphql.d.ts +1 -1
- package/dist/features/network/sampler.js +1 -1
- package/dist/features/network/timing.d.ts +1 -1
- package/dist/features/network/xhrInterceptor.d.ts +1 -1
- package/dist/features/network/xhrInterceptor.js +1 -1
- package/dist/features/performance/PerformanceFeature.d.ts +2 -2
- package/dist/features/performance/PerformanceFeature.js +11 -11
- package/dist/features/performance/longTasks.js +1 -1
- package/dist/features/performance/normalize.js +1 -1
- package/dist/features/performance/sampler.js +1 -1
- package/dist/features/performance/trace/index.d.ts +4 -4
- package/dist/features/performance/trace/index.js +3 -3
- package/dist/features/performance/trace/pageload.d.ts +1 -1
- package/dist/features/performance/trace/pageload.js +1 -1
- package/dist/features/performance/trace/transaction.d.ts +2 -2
- package/dist/features/performance/trace/transaction.js +2 -2
- package/dist/features/profiler/ProfilerFeature.js +1 -1
- package/dist/features/push/PushFeature.d.ts +4 -4
- package/dist/features/push/PushFeature.js +3 -3
- package/dist/features/push/softAsk.d.ts +1 -1
- package/dist/features/push/softAsk.js +26 -26
- package/dist/features/replay/ReplayFeature.d.ts +1 -1
- package/dist/features/replay/ReplayFeature.js +12 -12
- package/dist/features/replay/engine/canvas.d.ts +2 -2
- package/dist/features/replay/engine/crossOrigin.d.ts +1 -1
- package/dist/features/replay/engine/crossOrigin.js +3 -3
- package/dist/features/replay/engine/cssom.d.ts +2 -2
- package/dist/features/replay/engine/iframe.d.ts +2 -2
- package/dist/features/replay/engine/iframe.js +3 -3
- package/dist/features/replay/engine/interactions.d.ts +1 -1
- package/dist/features/replay/engine/interactions.js +1 -1
- package/dist/features/replay/engine/mutations.d.ts +3 -3
- package/dist/features/replay/engine/mutations.js +2 -2
- package/dist/features/replay/engine/player.d.ts +2 -2
- package/dist/features/replay/engine/player.js +1 -1
- package/dist/features/replay/engine/rebuild.d.ts +1 -1
- package/dist/features/replay/engine/replayWorker.js +16 -16
- package/dist/features/replay/engine/resources.d.ts +1 -1
- package/dist/features/replay/engine/resources.js +1 -1
- package/dist/features/replay/engine/snapshot.d.ts +2 -2
- package/dist/features/replay/engine/snapshot.js +1 -1
- package/dist/features/replay/engine/traverse.d.ts +1 -1
- package/dist/features/replay/lifecycle/recorder.d.ts +1 -1
- package/dist/features/replay/lifecycle/recorder.js +20 -20
- package/dist/features/replay/lifecycle/sampling.js +1 -1
- package/dist/features/replay/lifecycle/viewContext.js +1 -1
- package/dist/features/scroll/index.js +1 -1
- package/dist/features/session/sessionManager.d.ts +1 -1
- package/dist/features/session/sessionManager.js +2 -2
- package/dist/features/session/sessionStore.js +1 -1
- package/dist/features/watchdog/WatchdogFeature.d.ts +1 -1
- package/dist/features/watchdog/WatchdogFeature.js +1 -1
- package/dist/features/watchdog/collectors.d.ts +1 -1
- package/dist/features/watchdog/collectors.js +1 -1
- package/dist/features/watchdog/engine.js +8 -8
- package/dist/features/watchdog/incidents.d.ts +1 -1
- package/dist/features/watchdog/incidents.js +1 -1
- package/dist/features/watchdog/rollup.d.ts +1 -1
- package/dist/features/watchdog/rollup.js +1 -1
- package/dist/features/webVitals/WebVitalsFeature.js +4 -4
- package/dist/features/webVitals/observe.d.ts +1 -1
- package/dist/features/webVitals/observe.js +1 -1
- package/dist/features/webperf/WebPerfFeature.d.ts +1 -1
- package/dist/features/webperf/WebPerfFeature.js +3 -3
- package/dist/features/webperf/collectors.js +1 -1
- package/dist/inapp.d.ts +1 -1
- package/dist/inapp.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/pipeline/pipeline.d.ts +3 -3
- package/dist/pipeline/pipeline.js +4 -4
- package/dist/public/ScaleBunFacade.d.ts +18 -18
- package/dist/public/ScaleBunFacade.js +11 -11
- package/dist/public/index.d.ts +4 -4
- package/dist/public/index.js +2 -2
- package/dist/scalebun-push-sw.js +236 -236
- package/dist/scalebun.min.js +17 -17
- package/dist/scalebun.min.js.map +4 -4
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/transport/httpClient.d.ts +1 -1
- package/dist/transport/httpClient.js +3 -3
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/package.json +7 -7
package/dist/scalebun.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";(()=>{var Oh=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>{for(var t in e)Oh(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 Da(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Fa);if(n)return n;let e=`web_${q()}`;return localStorage.setItem(Fa,e),e}}catch{}return`web_${q()}`}var Fa,Ha=E(()=>{"use strict";Fa="scalebun_device_id"});function qa(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(_s,...e)}}var _s,Ns=E(()=>{"use strict";_s="[scalebun]"});var $a=E(()=>{"use strict"});function za(){return{platform:"web",renderer:"dom",sdk:{name:Nh,version:Bs}}}function Ua(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=Bh(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function Va(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function Wa(){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 Bh(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var Nh,Bs,ja=E(()=>{"use strict";Nh="@scalebun/web",Bs="1.0.0"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function qh(n){return n.replace(Dh,"[email]").replace(Hh,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return qh(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]=Fh.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var Fh,Dh,Hh,Fs=E(()=>{"use strict";Fh=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,Dh=/[\w.+-]+@[\w-]+\.[\w.-]+/g,Hh=/\b\d[\d -]{11,18}\d\b/g});function Ka(n){try{let e=Ga()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function $h(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function zh(){let n=typeof document!="undefined";return{dom:n,storage:Ka("localStorage"),session:Ka("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:$h(),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 Uh(){return Ds===null&&(Ds=zh()),Ds}function qt(n){return Uh()[n]}var Ga,ht,Ds,Hs=E(()=>{"use strict";Ga=()=>globalThis,ht=n=>typeof Ga()[n]!="undefined";Ds=null});function Pe(n,e,t){if(!qt("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var qs=E(()=>{"use strict";Hs()});var bn,Ya=E(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function gt(n){return n.length>Xa?n.slice(0,Xa):n}function jh(n){return n.replace(/[?#].*$/,"")}function Kh(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function Ja(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 Gh(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:Kh(n.level),message:gt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:gt(j(`${n.method} ${jh(n.url)}`)),data:Ja({status:r,duration:n.duration})}}case"event":return Yh(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:gt(j(n.message))};default:return null}}function Yh(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:gt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:Ja({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:gt(j(n))}}function Qa(n){zs=n}function Za(n){if(!zs)return n;try{return zs(n)}catch{return n}}function ec(n){let e=n.message?{...n,message:gt(j(n.message))}:n,t=Za(e);t&&We.add(t)}function tc(n){let e=Gh(n);if(!e)return;let t=Za(e);t&&We.add(t)}function nc(){We.clear()}var Vh,Wh,Xa,$s,We,zs,rc=E(()=>{"use strict";Fs();Vh=50,Wh=200,Xa=256;$s=class{constructor(){this.ring=[];this.max=Vh}setMax(e){this.max=Math.max(1,Math.min(Wh,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 $s});function sc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function ic(){yn=void 0,vn=void 0}var yn,vn,oc=E(()=>{"use strict"});function _e(n){n&&typeof n=="object"&&($t={...$t,...n})}function bt(){return $t}function ac(){let n=$t.deviceId;$t=n!=null?{deviceId:n}:{}}var $t,cc=E(()=>{"use strict";$t={}});function Xh(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function Vs(){return Us===null&&(Us=Xh()),Us}function Jh(){return Vs()==="browser"}function lc(){return!Jh()}var Us,dc=E(()=>{"use strict";Us=null});function wn(n){n&&(Ws=n)}function yt(n){if(Ws)try{n.nonce=Ws}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=yt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Ws,uc=E(()=>{"use strict";Ws=null});var $=E(()=>{"use strict";Ha();Ns();$a();ja();Fs();qs();Ya();rc();oc();cc();dc();Hs();uc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function vt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ks,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function pc(n=Ut,e=Gs){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,vt(r),it=r,r;let s={id:`sess_${q()}`,startedAt:t,lastSeenAt:t,seq:0};return vt(s),it=s,s}function fc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks)===null){it.lastSeenAt=n,vt(it),js=n;return}}catch{}if(n-js<6e4)return;js=n;let e=xn();e&&(e.lastSeenAt=n,vt(e),it=e)}function Ys(n=1){let e=xn();if(!e){let r=zt;return zt+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),vt(e),t}function mc(n){let e=xn();return e?(e.seq<n&&(e.seq=n,vt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ks,Ut,Gs,it,js,zt,Sn=E(()=>{"use strict";$();Ks="scalebun_session",Ut=30*60*1e3,Gs=4*60*60*1e3;it=null,js=0,zt=0});var Js={};O(Js,{SDK_SIGNING_VERSION:()=>hc,signBody:()=>gc,signatureHeaders:()=>eg});function Qh(n,e){let t=Xs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Xs.delete(e)),Xs.set(e,t)),t}function Zh(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function gc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Qh(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Zh(new Uint8Array(i))}catch{return null}}async function eg(n,e){let t=await gc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":hc}:{}}var hc,Xs,Qs=E(()=>{"use strict";hc="1",Xs=new Map});var bc={};O(bc,{gzipString:()=>tg});async function tg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var yc=E(()=>{"use strict"});function sg(){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(wt)||t.createObjectStore(wt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var ng,wt,rg,Be,Vt=E(()=>{"use strict";ng="scalebun",wt="queue",rg="pending";Be=class{constructor(e=rg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=sg()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(wt,"readonly").objectStore(wt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(wt,"readwrite");s.objectStore(wt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function vc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var ig,og,xt,Cn=E(()=>{"use strict";ig=1e3,og=3e4,xt=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(og,ig*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function St(n,e){if(wc(n)<=2e6)return n.slice();let t=e?n.filter(r=>!e(r)):n.slice();for(;t.length&&wc(t)>2e6;)t.shift();return t}var wc,Rn=E(()=>{"use strict";wc=n=>JSON.stringify(n).length});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function Zs(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=E(()=>{"use strict"});function ei(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function kt(n,e,t){if(!(e>0)||!ei(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Ic(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=E(()=>{"use strict"});var Oc={};O(Oc,{anchorOf:()=>Lc,fieldKeyOf:()=>Mc,fieldLabelOf:()=>Pc,formIdOf:()=>_n,installFormAnalytics:()=>Eg,isSensitiveField:()=>Rc,isTrackableField:()=>Tc,stepOf:()=>Wt});function Rc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(gg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return bg.test(t)}function Tc(n){if(!n||typeof n.matches!="function"||!n.matches(vg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return yg.has(e)?!1:!Rc(n)}function Mc(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 Pc(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>Cc?`${t.slice(0,Cc-1)}\u2026`:t}function Sg(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 _n(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_${Sg(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function Wt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function Lc(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 kg(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 Eg(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>=xg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:_n(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:Wt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,wg).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(!Tc(h))return null;let g=h.form;if(!g||Ac(g)||Ac(h))return null;let k=r(g);return k?{form:g,el:h,key:Mc(h,g),st:k}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:k}=h,v=g.fields.get(k);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Pc(h.el)},g.fields.set(k,v)),v.focusedAt=at(),g.lastField=k},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var k;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:_n(h.form),field_key:h.key,error_type:kg(h.el),step:Wt(h.form),...(k=Lc(h.el))!=null?k:{}}})},d=(m,h)=>{var g;for(let k of h.fields.values())k.focusedAt!=null&&(k.ms+=at()-k.focusedAt,k.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:_n(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var gg,bg,yg,vg,wg,xg,Cc,Ac,at,_c=E(()=>{"use strict";$();gg=new Set(["password","hidden"]),bg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,yg=new Set(["submit","button","reset","image"]),vg="input, select, textarea",wg=30,xg=20;Cc=60;Ac=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Nc={};O(Nc,{installScrollTracker:()=>Ig});function Ig(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Cg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=kt(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Ic(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Cg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Bc=E(()=>{"use strict";On()});var Dc={};O(Dc,{ATTENTION_BANDS:()=>Ag,bandFractions:()=>Fc,installAttentionTracker:()=>Rg});function Fc(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 Rg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Tg(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,k=Fc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=k[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function Tg(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Ag,ct,Hc=E(()=>{"use strict";Ag=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var Uc={};O(Uc,{describeElement:()=>Bn,installAutocapture:()=>Fg});function Og(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Bn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:Og(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?zc(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 _g(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(qc))return t;return n&&typeof n.closest=="function"?n.closest(qc):null}function Ng(n){return Lg.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function Bg(n){try{return new URL(n,location.href)}catch{return null}}function $c(){try{return location.pathname}catch{return""}}function Fg(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(_c(),Oc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Bc(),Nc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(Hc(),Dc)).then(R=>{e&&(s=R.installAttentionTracker())}).catch(()=>{});let i=R=>{var ce;if(!e)return;let A=R.target,_=typeof R.composedPath=="function"?R.composedPath():[],z=_g(A,_),D=z!=null?z:A&&Ng(A)?A:null;if(!D||Nn(D))return;let te={...Bn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=Bg(J);if(!Q)return;D.hasAttribute("download")||Pg.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(Mg)||Nn(A))return;let _={...Bn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];_.option_value=A.value,_.option_index=A.selectedIndex,D&&(_.option_text=n.maskText===!0?zc(D.text):D.text),_.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(_.checked=A.checked,_.input_type=A.type,A.value&&A.value!=="on"&&(_.option_value=A.value));n.onEvent({name:"$change",props:_})},a=R=>{var _;if(!e)return;let A=R.target;!A||A.tagName!=="FORM"||Nn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(_=t==null?void 0:t.onSubmit(A))!=null?_:{}}})},c=0,l=null,u=0,d=$c(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},k=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=kt(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(k(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(R=r==null?void 0:r.summary())!=null?R:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},x=new WeakSet,S;typeof IntersectionObserver!="undefined"&&(S=new IntersectionObserver(R=>{if(e)for(let A of R){let _=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!x.has(_)&&(x.add(_),S.unobserve(_),Nn(_)||n.onEvent({name:"$impression",props:{...Bn(_),path:location.pathname}}))}},{threshold:[.5]}));let w=()=>{if(!(!S||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{x.has(R)||S.observe(R)})}catch{}},I=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=$c(),p=!0,f=!1,g(),w()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",k),window.addEventListener("popstate",I);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),I()},history.replaceState=function(...R){M.apply(this,R),I()},I(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",k),window.removeEventListener("popstate",I),S==null||S.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var qc,Mg,Pg,Lg,zc,Nn,Vc=E(()=>{"use strict";On();qc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',Mg='select, input[type="checkbox"], input[type="radio"]',Pg=/\.(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,Lg=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),zc=n=>n.replace(/\S/g,"*");Nn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function tb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function ul(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:li((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:li((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:li(n)}}function pl(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=tb(e.file),t}function nb(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=ul(r);return o?pl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=ul(e.slice(t+1));if(s&&s.file)return pl(r,s)}return null}function fl(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=nb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var ml=E(()=>{"use strict"});function sb(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function ib(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>"}@${sb(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=rb))break}return r.join(">")}function ob(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 hl(n,e,t){let r=ib(e),s=r?`${n}|${r}`:`${n}|${ob(t)}`;return Ee(s).toString(36)}var rb,gl=E(()=>{"use strict";Fe();rb=5});function bl(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 yl=E(()=>{"use strict"});var vl={};O(vl,{computeFingerprint:()=>hl,extractCauses:()=>bl,parseStack:()=>fl});var wl=E(()=>{"use strict";ml();gl();yl()});function Ll(n){try{if(typeof n=="string")return n.length;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size}catch{}return 0}function ui(n,e,t){let r=n.WebSocket;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=0,f=0,m=!1,h=!1,g=a.send.bind(a);a.send=function(y){return u++,p+=Ll(y),g(y)},a.addEventListener("message",v=>{d++,f+=Ll(v.data)}),a.addEventListener("error",()=>{m=!0});let k=(v,y)=>{if(h)return;h=!0;let b={protocol:"ws",method:"GET",url:c,status:m&&v===void 0?0:void 0,startedAt:l,duration:Date.now()-l,error:m?"websocket error":void 0,ws:{messagesSent:u,messagesReceived:d,bytesSent:p,bytesReceived:f,...v!==void 0?{closeCode:v}:{},...y?{closeReason:y}:{}}};e(b)};return a.addEventListener("close",v=>k(v.code,v.reason)),a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSING:{value:r.CLOSING},CLOSED:{value:r.CLOSED}})}catch{}return n.WebSocket=s,()=>{n.WebSocket=r}}var Ol=E(()=>{"use strict"});function pi(n,e,t){let r=n.EventSource;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=!1,f=!1,m=()=>{if(f)return;f=!0;let g={protocol:"sse",method:"GET",url:c,status:p?0:void 0,startedAt:l,duration:Date.now()-l,error:p?"eventsource error":void 0,ws:{messagesReceived:u,bytesReceived:d,messagesSent:0,bytesSent:0}};e(g)};a.addEventListener("message",g=>{u++,d+=typeof g.data=="string"?g.data.length:0}),a.addEventListener("error",()=>{a.readyState===2&&(p=!0,m())});let h=a.close.bind(a);return a.close=function(){return m(),h()},a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSED:{value:r.CLOSED}})}catch{}return n.EventSource=s,()=>{n.EventSource=r}}var _l=E(()=>{"use strict"});function Ab(n){try{if(n==null)return 0;if(typeof n=="string")return n.length;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString().length}catch{}}function fi(n,e,t){let r=n.sendBeacon;return typeof r!="function"?()=>{}:(n.sendBeacon=function(i,o){let a=String(i);if(t(a))return r.call(n,i,o!=null?o:void 0);let c=Date.now(),l=r.call(n,i,o!=null?o:void 0),u={protocol:"beacon",method:"POST",url:a,status:l?void 0:0,startedAt:c,duration:Date.now()-c,requestSize:Ab(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Nl=E(()=>{"use strict"});var Bl={};O(Bl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>Rb,installWebSocket:()=>ui});function Rb(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(ui(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(pi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(fi(e,t,r)),i}var Fl=E(()=>{"use strict";Ol();_l();Nl()});function mi(n,e){if(/graphql/i.test(n))return!0;if(!e)return!1;let t=e.slice(0,200);return/["']?query["']?\s*[:=]/.test(t)||/^\s*(query|mutation|subscription)\b/.test(t)}function hi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=Hl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?Dl(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=Hl(e);return t&&("query"in t||"operationName"in t)?Dl(t):void 0}if(ql.test(e))return Mb(e)}function Xn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Xn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function Dl(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=$l(r);if(s&&(e.operationType=s),!e.operationName){let i=zl(r);i&&(e.operationName=i)}}return e}function Mb(n){let e={},t=$l(n);t&&(e.operationType=t);let r=zl(n);return r&&(e.operationName=r),e}function $l(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=ql.exec(e.slice(0,64));return t?t[1]:void 0}function zl(n){let e=Tb.exec(n);return e&&e[2]?e[2]:void 0}function Hl(n){try{return JSON.parse(n)}catch{return}}var ql,Tb,Ul=E(()=>{"use strict";ql=/\b(query|mutation|subscription)\b/,Tb=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function gi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function bi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var pE,Vl=E(()=>{"use strict";$();pE=64*1024});var Wl={};O(Wl,{enrichHttpCapture:()=>Pb,graphqlResponseHasErrors:()=>Xn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function Pb(n,e){var s,i,o;let t,r=async()=>(t===void 0&&(t=n.readResponseText?await n.readResponseText():null),t);if(e.graphql)try{if(mi(n.url,n.reqBody)){let a=(s=hi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Xn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&gi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:bi(n.reqBody,a.bodyMaxBytes)}),gi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:bi(c,a.bodyMaxBytes)})}}catch{}}}var jl=E(()=>{"use strict";Ul();Vl()});function ld(n){if(er.size)for(let e of er)try{e(n)}catch{}}function dd(n){return er.add(n),()=>{er.delete(n)}}var er,ki=E(()=>{"use strict";er=new Set});var nr,rr,sr=E(()=>{"use strict";nr={startChild:()=>nr,finish(){},setData(){}},rr={startSpan:()=>nr,finish(){}}});function bd(n){var r;let e=new Uint8Array(n);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Date.now()+s*2654435761&255;let t="";for(let s=0;s<n;s++)t+=((r=e[s])!=null?r:0).toString(16).padStart(2,"0");return t}function Ct(){return bd(16)}function je(){return bd(8)}function yd(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function vd(n){var t,r,s;let e=$b.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 $b,ir=E(()=>{"use strict";$b=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var or,wd=E(()=>{"use strict";ir();sr();or=class{constructor(e,t){this.name=e;this.traceId=Ct();this.rootSpanId=je();this.spans=[];this.dropped=0;this.errors=0;var r,s;this.clock=t.clock,this.maxSpans=(r=t.maxSpans)!=null?r:1e3,this.sampled=(s=t.sampled)!=null?s:!0,this.onFinish=t.onFinish,this.startMs=this.clock()}open(e,t,r){if(this.endMs!=null||this.spans.length>=this.maxSpans)return this.dropped++,nr;let s={spanId:je(),parentSpanId:t,op:e,description:r,startMs:this.clock()};this.spans.push(s);let i=this.clock;return{startChild:(o,a)=>this.open(o,s.spanId,a),finish:(o=i())=>{s.endMs==null&&(s.endMs=o)},setData:(o,a)=>{var c;((c=s.data)!=null?c:s.data={})[o]=a}}}startSpan(e,t){return this.open(e,this.rootSpanId,t)}addSpan(e,t,r,s){if(this.endMs!=null||this.spans.length>=this.maxSpans){this.dropped++;return}this.spans.push({spanId:je(),parentSpanId:this.rootSpanId,op:e,startMs:Math.round(t),endMs:Math.round(r),...s?{data:s}:{}})}finish(e=this.clock()){this.endMs==null&&(this.endMs=e,this.onFinish(this))}noteError(){this.endMs==null&&this.errors++}context(){return{traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled}}data(){var e;return{name:this.name,traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled,startMs:this.startMs,durationMs:Math.max(0,((e=this.endMs)!=null?e:this.startMs)-this.startMs),spans:this.spans.slice(),...this.dropped>0?{droppedSpans:this.dropped}:{},...this.errors>0?{errorCount:this.errors}:{}}}}});function xd(n,e){let t=Ct(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ii(a),endMs:Ii(c)})};return i("dns",n.domainLookupStart,n.domainLookupEnd),i("connect",n.connectStart,n.connectEnd),n.secureConnectionStart>0&&i("tls",n.secureConnectionStart,n.connectEnd),i("request",n.requestStart,n.responseStart),i("response",n.responseStart,n.responseEnd),i("dom",n.responseEnd,n.domContentLoadedEventEnd),i("load",n.domContentLoadedEventEnd,n.loadEventEnd),{name:`pageload ${e}`,traceId:t,spanId:r,sampled:!0,startMs:0,durationMs:Ii(n.loadEventEnd||n.duration),spans:s}}var Ii,Sd=E(()=>{"use strict";ir();Ii=n=>Math.round(n)});var kd={};O(kd,{Transaction:()=>or,buildPageload:()=>xd,formatTraceparent:()=>yd,newSpanId:()=>je,newTraceId:()=>Ct,parseTraceparent:()=>vd});var Ed=E(()=>{"use strict";wd();ir();Sd()});var Md={};O(Md,{createBugReportWidget:()=>iy});function ry(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function sy(n){return`[data-scalebun-bugreport]{position:fixed;${ry(n)}z-index:${ny};font-family:system-ui,sans-serif}[data-scalebun-bugreport] .sbbr-launch{cursor:pointer;border:none;border-radius:9999px;padding:10px 16px;font-size:13px;font-weight:600;color:#fff;background:#ef4444;box-shadow:0 2px 8px rgba(0,0,0,.2)}[data-scalebun-bugreport] .sbbr-panel{display:none;width:300px;background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:12px;padding:14px;box-shadow:0 8px 30px rgba(0,0,0,.18);margin-top:8px}[data-scalebun-bugreport] .sbbr-panel.sbbr-open{display:block}[data-scalebun-bugreport] .sbbr-title{font-size:14px;font-weight:700;margin-bottom:8px}[data-scalebun-bugreport] .sbbr-field{width:100%;box-sizing:border-box;font:inherit;font-size:13px;padding:8px;border:1px solid #e5e7eb;border-radius:8px}[data-scalebun-bugreport] textarea.sbbr-field{resize:vertical}[data-scalebun-bugreport] .sbbr-email{margin-top:8px}[data-scalebun-bugreport] .sbbr-status{font-size:12px;color:#6b7280;min-height:16px;margin-top:8px}[data-scalebun-bugreport] .sbbr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}[data-scalebun-bugreport] .sbbr-btn{cursor:pointer;font:inherit;font-size:13px;padding:6px 12px;border-radius:8px}[data-scalebun-bugreport] .sbbr-cancel{border:1px solid #e5e7eb;background:#fff}[data-scalebun-bugreport] .sbbr-send{font-weight:600;border:none;background:#ef4444;color:#fff}`}function iy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,sy(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 Bh=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>{for(var t in e)Bh(n,t,{get:e[t],enumerable:!0})};function $(){let n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.randomUUID=="function")return n.randomUUID();let e=typeof performance!="undefined"?performance.now():0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(Math.floor(e)+Math.floor(Math.random()*16))%16;return(t==="x"?r:r&3|8).toString(16)})}function P(){return Date.now()}function qa(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem($a);if(n)return n;let e=`web_${$()}`;return localStorage.setItem($a,e),e}}catch{}return`web_${$()}`}var $a,za=E(()=>{"use strict";$a="scalebun_device_id"});function Ua(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Os,...e)}}var Os,Ns=E(()=>{"use strict";Os="[scalebun]"});var Va=E(()=>{"use strict"});function Wa(){return{platform:"web",renderer:"dom",sdk:{name:Dh,version:Bs}}}function ja(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=Hh(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function Ka(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function Ga(){let n={};try{typeof navigator!="undefined"&&(n.locale=navigator.language),n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,typeof location!="undefined"&&(n.url=location.href),typeof window!="undefined"&&(n.viewport={width:window.innerWidth,height:window.innerHeight});let e=navigator==null?void 0:navigator.connection;e!=null&&e.effectiveType&&(n.networkType=e.effectiveType)}catch{}return n}function Hh(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var Dh,Bs,Ya=E(()=>{"use strict";Dh="@scalebun/web",Bs="1.2.2"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function Uh(n){return n.replace(qh,"[email]").replace(zh,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return Uh(n);if(Array.isArray(n))return n.slice(0,1e3).map(t=>mt(t,e+1));if(typeof n=="object"){let t={},r=0;for(let s in n){if(r++>200)break;if(!Object.prototype.hasOwnProperty.call(n,s))continue;let i=n[s];t[s]=$h.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var $h,qh,zh,Fs=E(()=>{"use strict";$h=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,qh=/[\w.+-]+@[\w-]+\.[\w.-]+/g,zh=/\b\d[\d -]{11,18}\d\b/g});function Xa(n){try{let e=Ja()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function Vh(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function Wh(){let n=typeof document!="undefined";return{dom:n,storage:Xa("localStorage"),session:Xa("sessionStorage"),indexedDB:ht("indexedDB"),history:typeof history!="undefined"&&typeof history.pushState=="function",network:typeof fetch!="undefined",beacon:typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function",keepalive:Vh(),performance:typeof performance!="undefined"&&typeof performance.now=="function",performanceObserver:ht("PerformanceObserver"),mutationObserver:ht("MutationObserver"),intersectionObserver:ht("IntersectionObserver"),resizeObserver:ht("ResizeObserver"),visibility:n&&typeof document.visibilityState!="undefined",raf:typeof requestAnimationFrame!="undefined",crypto:typeof crypto!="undefined"&&typeof crypto.subtle!="undefined",webWorker:ht("Worker")}}function jh(){return Ds===null&&(Ds=Wh()),Ds}function $t(n){return jh()[n]}var Ja,ht,Ds,Hs=E(()=>{"use strict";Ja=()=>globalThis,ht=n=>typeof Ja()[n]!="undefined";Ds=null});function Pe(n,e,t){if(!$t("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var $s=E(()=>{"use strict";Hs()});var bn,Qa=E(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function gt(n){return n.length>Za?n.slice(0,Za):n}function Yh(n){return n.replace(/[?#].*$/,"")}function Xh(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ec(n){let e={},t=!1;for(let r in n)n[r]!==void 0&&n[r]!==null&&(e[r]=n[r],t=!0);return t?e:void 0}function Jh(n){var t;if(n.kind==="frame"||n.kind==="performance")return null;let e=typeof n.timestamp=="number"?n.timestamp:Date.now();switch(n.kind){case"log":return{ts:e,category:"console",level:Xh(n.level),message:gt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:gt(j(`${n.method} ${Yh(n.url)}`)),data:ec({status:r,duration:n.duration})}}case"event":return Qh(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:gt(j(n.message))};default:return null}}function Qh(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:gt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ec({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:gt(j(n))}}function tc(n){zs=n}function nc(n){if(!zs)return n;try{return zs(n)}catch{return n}}function rc(n){let e=n.message?{...n,message:gt(j(n.message))}:n,t=nc(e);t&&We.add(t)}function sc(n){let e=Jh(n);if(!e)return;let t=nc(e);t&&We.add(t)}function ic(){We.clear()}var Kh,Gh,Za,qs,We,zs,oc=E(()=>{"use strict";Fs();Kh=50,Gh=200,Za=256;qs=class{constructor(){this.ring=[];this.max=Kh}setMax(e){this.max=Math.max(1,Math.min(Gh,Math.floor(e))),this.trim()}add(e){var r;let t=this.ring[this.ring.length-1];if(t&&t.category===e.category&&t.message===e.message&&t.level===e.level){t.count=((r=t.count)!=null?r:1)+1,t.ts=e.ts;return}this.ring.push(e),this.trim()}snapshot(){return this.ring.slice()}clear(){this.ring=[]}trim(){for(;this.ring.length>this.max;)this.ring.shift()}},We=new qs});function ac(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function cc(){yn=void 0,vn=void 0}var yn,vn,lc=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(qt={...qt,...n})}function bt(){return qt}function dc(){let n=qt.deviceId;qt=n!=null?{deviceId:n}:{}}var qt,uc=E(()=>{"use strict";qt={}});function Zh(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function Vs(){return Us===null&&(Us=Zh()),Us}function eg(){return Vs()==="browser"}function pc(){return!eg()}var Us,fc=E(()=>{"use strict";Us=null});function wn(n){n&&(Ws=n)}function yt(n){if(Ws)try{n.nonce=Ws}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=yt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Ws,mc=E(()=>{"use strict";Ws=null});var q=E(()=>{"use strict";za();Ns();Va();Ya();Fs();$s();Qa();oc();lc();uc();fc();Hs();mc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function vt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ks,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function hc(n=Ut,e=Gs){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,vt(r),it=r,r;let s={id:`sess_${$()}`,startedAt:t,lastSeenAt:t,seq:0};return vt(s),it=s,s}function gc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks)===null){it.lastSeenAt=n,vt(it),js=n;return}}catch{}if(n-js<6e4)return;js=n;let e=xn();e&&(e.lastSeenAt=n,vt(e),it=e)}function Ys(n=1){let e=xn();if(!e){let r=zt;return zt+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),vt(e),t}function bc(n){let e=xn();return e?(e.seq<n&&(e.seq=n,vt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ks,Ut,Gs,it,js,zt,Sn=E(()=>{"use strict";q();Ks="scalebun_session",Ut=30*60*1e3,Gs=4*60*60*1e3;it=null,js=0,zt=0});var Js={};_(Js,{SDK_SIGNING_VERSION:()=>yc,signBody:()=>vc,signatureHeaders:()=>rg});function tg(n,e){let t=Xs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Xs.delete(e)),Xs.set(e,t)),t}function ng(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function vc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await tg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return ng(new Uint8Array(i))}catch{return null}}async function rg(n,e){let t=await vc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":yc}:{}}var yc,Xs,Qs=E(()=>{"use strict";yc="1",Xs=new Map});var wc={};_(wc,{gzipString:()=>sg});async function sg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var xc=E(()=>{"use strict"});function ag(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(ig,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(wt)||t.createObjectStore(wt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var ig,wt,og,Be,Vt=E(()=>{"use strict";ig="scalebun",wt="queue",og="pending";Be=class{constructor(e=og){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=ag()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(wt,"readonly").objectStore(wt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(wt,"readwrite");s.objectStore(wt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function Sc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var cg,lg,xt,Cn=E(()=>{"use strict";cg=1e3,lg=3e4,xt=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(lg,cg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function St(n,e){if(kc(n)<=2e6)return n.slice();let t=e?n.filter(r=>!e(r)):n.slice();for(;t.length&&kc(t)>2e6;)t.shift();return t}var kc,Rn=E(()=>{"use strict";kc=n=>JSON.stringify(n).length});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function Zs(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=E(()=>{"use strict"});function ei(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function kt(n,e,t){if(!(e>0)||!ei(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Rc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var _n=E(()=>{"use strict"});var Bc={};_(Bc,{anchorOf:()=>Nc,fieldKeyOf:()=>_c,fieldLabelOf:()=>Oc,formIdOf:()=>On,installFormAnalytics:()=>Ag,isSensitiveField:()=>Pc,isTrackableField:()=>Lc,stepOf:()=>Wt});function Pc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(vg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return wg.test(t)}function Lc(n){if(!n||typeof n.matches!="function"||!n.matches(Sg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return xg.has(e)?!1:!Pc(n)}function _c(n,e){let t=n.getAttribute("name");if(t)return t;if(n.id)return n.id;let r=(n.getAttribute("type")||n.tagName).toLowerCase(),s=-1;try{s=Array.prototype.indexOf.call(e.elements,n)}catch{}return s>=0?`${r}[${s}]`:r}function Oc(n){var r,s,i,o,a;let e="";try{if(e=n.getAttribute("aria-label")||"",!e){let c=n.getAttribute("id"),l=n.ownerDocument;if(c&&l&&(e=((r=l.querySelector(`label[for="${c}"]`))==null?void 0:r.textContent)||""),e||(e=((i=(s=n.closest)==null?void 0:s.call(n,"label"))==null?void 0:i.textContent)||""),!e){let u=n.getAttribute("aria-labelledby");u&&l&&(e=((a=l.getElementById((o=u.split(/\s+/)[0])!=null?o:""))==null?void 0:a.textContent)||"")}}}catch{}let t=j(e.replace(/\s+/g," ").trim());if(t)return t.length>Tc?`${t.slice(0,Tc-1)}\u2026`:t}function Ig(n){let e=5381;for(let t=0;t<n.length;t++)e=(e<<5)+e+n.charCodeAt(t)|0;return(e>>>0).toString(36)}function On(n){var s,i;if(n.id)return n.id;let e=n.getAttribute("name");if(e)return e;let t="";try{t=(s=(n.getAttribute("action")||"").split("?")[0])!=null?s:""}catch{}let r=[];try{for(let o of Array.from(n.elements)){let a=(i=o.getAttribute)==null?void 0:i.call(o,"name");a&&r.push(a)}}catch{}return`form_${Ig(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function Wt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function Nc(n){var e,t,r;try{let s=(e=n.getBoundingClientRect)==null?void 0:e.call(n);if(!s||s.width===0&&s.height===0)return;let i={ex:s.x|0,ey:s.y|0,ew:s.width|0,eh:s.height|0},o=(r=(t=n.closest)==null?void 0:t.call(n,"[data-scalebun-component]"))==null?void 0:r.getAttribute("data-scalebun-component");return o&&(i.component=o),i}catch{return}}function Cg(n){let e=n.validity;return e?e.valueMissing?"required":e.typeMismatch?"type":e.patternMismatch?"pattern":e.tooShort?"too_short":e.tooLong?"too_long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.badInput?"bad_input":e.customError?"custom":"invalid":"invalid"}function Ag(n){if(typeof document=="undefined")return{onSubmit:()=>({}),stop:()=>{}};let e=!0,t=new Map,r=m=>{let h=t.get(m);return h||(t.size>=Eg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:On(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:Wt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,kg).map(([h,g])=>({key:h,ms:Math.round(g.ms),changed:g.changed,errored:g.errored,order:g.order,...g.label?{label:g.label}:{}})),o=m=>{if(!e)return null;let h=m.target;if(!Lc(h))return null;let g=h.form;if(!g||Mc(g)||Mc(h))return null;let k=r(g);return k?{form:g,el:h,key:_c(h,g),st:k}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:k}=h,v=g.fields.get(k);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Oc(h.el)},g.fields.set(k,v)),v.focusedAt=at(),g.lastField=k},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var k;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:On(h.form),field_key:h.key,error_type:Cg(h.el),step:Wt(h.form),...(k=Nc(h.el))!=null?k:{}}})},d=(m,h)=>{var g;for(let k of h.fields.values())k.focusedAt!=null&&(k.ms+=at()-k.focusedAt,k.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:On(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var vg,wg,xg,Sg,kg,Eg,Tc,Mc,at,Fc=E(()=>{"use strict";q();vg=new Set(["password","hidden"]),wg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,xg=new Set(["submit","button","reset","image"]),Sg="input, select, textarea",kg=30,Eg=20;Tc=60;Mc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Dc={};_(Dc,{installScrollTracker:()=>Rg});function Rg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Tg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=kt(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Rc(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Tg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Hc=E(()=>{"use strict";_n()});var qc={};_(qc,{ATTENTION_BANDS:()=>Mg,bandFractions:()=>$c,installAttentionTracker:()=>Pg});function $c(n,e,t,r){let s=new Array(r).fill(0);if(t<=0||e<=0||r<=0)return s;let i=t/r,o=Math.max(0,n),a=Math.min(t,n+e);for(let c=0;c<r;c++){let l=c*i,u=(c+1)*i,d=Math.max(0,Math.min(a,u)-Math.max(o,l));s[c]=i>0?d/i:0}return s}function Pg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Lg(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,k=$c(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=k[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function Lg(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Mg,ct,zc=E(()=>{"use strict";Mg=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var jc={};_(jc,{describeElement:()=>Bn,installAutocapture:()=>$g});function Bg(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Bn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:Bg(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Wc(r):r),n.id&&(t.el_id=n.id);let s=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,3);s.length&&(t.classes=s);let i=n.getAttribute("href");i&&!/^\s*javascript:/i.test(i)&&(t.href=i);let o=n.getAttribute("name");o&&(t.name=o);let a=(c=n.closest("[data-scalebun-variant]"))==null?void 0:c.getAttribute("data-scalebun-variant");return a&&(t.variant=a),t}function Fg(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Uc))return t;return n&&typeof n.closest=="function"?n.closest(Uc):null}function Dg(n){return Ng.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function Hg(n){try{return new URL(n,location.href)}catch{return null}}function Vc(){try{return location.pathname}catch{return""}}function $g(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Fc(),Bc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Hc(),Dc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(zc(),qc)).then(R=>{e&&(s=R.installAttentionTracker())}).catch(()=>{});let i=R=>{var ce;if(!e)return;let A=R.target,O=typeof R.composedPath=="function"?R.composedPath():[],z=Fg(A,O),D=z!=null?z:A&&Dg(A)?A:null;if(!D||Nn(D))return;let te={...Bn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=Hg(J);if(!Q)return;D.hasAttribute("download")||Og.test(Q.pathname+Q.search)?n.onEvent({name:"$download",props:{url:Q.href,file:Q.pathname.split("/").pop()||Q.pathname,path:location.pathname}}):Q.host&&Q.host!==location.host&&n.onEvent({name:"$outbound_link",props:{url:Q.href,host:Q.host,path:location.pathname}})},o=R=>{var z;if(!e)return;let A=R.target;if(!A||typeof A.matches!="function"||!A.matches(_g)||Nn(A))return;let O={...Bn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];O.option_value=A.value,O.option_index=A.selectedIndex,D&&(O.option_text=n.maskText===!0?Wc(D.text):D.text),O.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(O.checked=A.checked,O.input_type=A.type,A.value&&A.value!=="on"&&(O.option_value=A.value));n.onEvent({name:"$change",props:O})},a=R=>{var O;if(!e)return;let A=R.target;!A||A.tagName!=="FORM"||Nn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(O=t==null?void 0:t.onSubmit(A))!=null?O:{}}})},c=0,l=null,u=0,d=Vc(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},k=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=kt(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(k(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(R=r==null?void 0:r.summary())!=null?R:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},x=new WeakSet,S;typeof IntersectionObserver!="undefined"&&(S=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!x.has(O)&&(x.add(O),S.unobserve(O),Nn(O)||n.onEvent({name:"$impression",props:{...Bn(O),path:location.pathname}}))}},{threshold:[.5]}));let w=()=>{if(!(!S||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{x.has(R)||S.observe(R)})}catch{}},I=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=Vc(),p=!0,f=!1,g(),w()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",k),window.addEventListener("popstate",I);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),I()},history.replaceState=function(...R){M.apply(this,R),I()},I(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",k),window.removeEventListener("popstate",I),S==null||S.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Uc,_g,Og,Ng,Wc,Nn,Kc=E(()=>{"use strict";_n();Uc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',_g='select, input[type="checkbox"], input[type="radio"]',Og=/\.(pdf|zip|gz|tar|rar|7z|csv|tsv|xlsx?|docx?|pptx?|dmg|pkg|exe|msi|apk|ipa|mp3|mp4|mov|avi|wav|svg|png|jpe?g|gif|webp|txt|json|xml)(\?|#|$)/i,Ng=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Wc=n=>n.replace(/\S/g,"*");Nn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function sb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function ml(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:li((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:li((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:li(n)}}function hl(n,e){let t={};return n&&n!=="<anonymous>"&&(t.function=n),e.file&&(t.file=e.file),e.line!=null&&(t.line=e.line),e.col!=null&&(t.col=e.col),t.inApp=sb(e.file),t}function ib(n){let e=n.trim();if(!e)return null;if(e.indexOf("at ")===0){let r=e.slice(3).trim().replace(/^async\s+/,""),s,i=r.indexOf(" (");i!==-1&&r.endsWith(")")&&(s=r.slice(0,i).trim()||void 0,r=r.slice(i+2,-1));let o=ml(r);return o?hl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=ml(e.slice(t+1));if(s&&s.file)return hl(r,s)}return null}function gl(n){var r;if(!n)return[];let e=[],t=n.split(`
|
|
2
|
+
`);for(let s=0;s<t.length&&e.length<50;s++){let i=ib((r=t[s])!=null?r:"");i&&e.push(i)}return e}var bl=E(()=>{"use strict"});function ab(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function cb(n){var i;if(!n||!n.length)return"";let e=n.filter(o=>o.inApp),t=e.length?e:n,r=[],s="";for(let o of t){let a=`${(i=o.function)!=null?i:"<anonymous>"}@${ab(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=ob))break}return r.join(">")}function lb(n){return n.replace(/0x[0-9a-f]+/gi,"0x?").replace(/\b[0-9a-f]{8,}\b/gi,"H").replace(/\d+/g,"N").replace(/(['"]).*?\1/g,"S").trim().slice(0,200)}function yl(n,e,t){let r=cb(e),s=r?`${n}|${r}`:`${n}|${lb(t)}`;return Ee(s).toString(36)}var ob,vl=E(()=>{"use strict";Fe();ob=5});function wl(n,e){let t=[],r=new Set,s=a=>{var u;if(!a||typeof a!="object"||r.has(a)||t.length>=5)return;r.add(a);let c=a,l=e(c.stack);t.push({type:c.name,message:String((u=c.message)!=null?u:a),...l.length?{frames:l}:{}})},i=n==null?void 0:n.errors;if(Array.isArray(i))for(let a of i)s(a);let o=n==null?void 0:n.cause;for(;o&&t.length<5&&!r.has(o);)s(o),o=o==null?void 0:o.cause;return t}var xl=E(()=>{"use strict"});var Sl={};_(Sl,{computeFingerprint:()=>yl,extractCauses:()=>wl,parseStack:()=>gl});var kl=E(()=>{"use strict";bl();vl();xl()});function Nl(n){try{if(typeof n=="string")return n.length;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size}catch{}return 0}function ui(n,e,t){let r=n.WebSocket;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=0,f=0,m=!1,h=!1,g=a.send.bind(a);a.send=function(y){return u++,p+=Nl(y),g(y)},a.addEventListener("message",v=>{d++,f+=Nl(v.data)}),a.addEventListener("error",()=>{m=!0});let k=(v,y)=>{if(h)return;h=!0;let b={protocol:"ws",method:"GET",url:c,status:m&&v===void 0?0:void 0,startedAt:l,duration:Date.now()-l,error:m?"websocket error":void 0,ws:{messagesSent:u,messagesReceived:d,bytesSent:p,bytesReceived:f,...v!==void 0?{closeCode:v}:{},...y?{closeReason:y}:{}}};e(b)};return a.addEventListener("close",v=>k(v.code,v.reason)),a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSING:{value:r.CLOSING},CLOSED:{value:r.CLOSED}})}catch{}return n.WebSocket=s,()=>{n.WebSocket=r}}var Bl=E(()=>{"use strict"});function pi(n,e,t){let r=n.EventSource;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=!1,f=!1,m=()=>{if(f)return;f=!0;let g={protocol:"sse",method:"GET",url:c,status:p?0:void 0,startedAt:l,duration:Date.now()-l,error:p?"eventsource error":void 0,ws:{messagesReceived:u,bytesReceived:d,messagesSent:0,bytesSent:0}};e(g)};a.addEventListener("message",g=>{u++,d+=typeof g.data=="string"?g.data.length:0}),a.addEventListener("error",()=>{a.readyState===2&&(p=!0,m())});let h=a.close.bind(a);return a.close=function(){return m(),h()},a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSED:{value:r.CLOSED}})}catch{}return n.EventSource=s,()=>{n.EventSource=r}}var Fl=E(()=>{"use strict"});function Mb(n){try{if(n==null)return 0;if(typeof n=="string")return n.length;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString().length}catch{}}function fi(n,e,t){let r=n.sendBeacon;return typeof r!="function"?()=>{}:(n.sendBeacon=function(i,o){let a=String(i);if(t(a))return r.call(n,i,o!=null?o:void 0);let c=Date.now(),l=r.call(n,i,o!=null?o:void 0),u={protocol:"beacon",method:"POST",url:a,status:l?void 0:0,startedAt:c,duration:Date.now()-c,requestSize:Mb(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Dl=E(()=>{"use strict"});var Hl={};_(Hl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>Pb,installWebSocket:()=>ui});function Pb(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(ui(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(pi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(fi(e,t,r)),i}var $l=E(()=>{"use strict";Bl();Fl();Dl()});function mi(n,e){if(/graphql/i.test(n))return!0;if(!e)return!1;let t=e.slice(0,200);return/["']?query["']?\s*[:=]/.test(t)||/^\s*(query|mutation|subscription)\b/.test(t)}function hi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=zl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?ql(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=zl(e);return t&&("query"in t||"operationName"in t)?ql(t):void 0}if(Ul.test(e))return _b(e)}function Xn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Xn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function ql(n){let e={},t=n.operationName;typeof t=="string"&&t&&(e.operationName=t);let r=typeof n.query=="string"?n.query:void 0;if(r){let s=Vl(r);if(s&&(e.operationType=s),!e.operationName){let i=Wl(r);i&&(e.operationName=i)}}return e}function _b(n){let e={},t=Vl(n);t&&(e.operationType=t);let r=Wl(n);return r&&(e.operationName=r),e}function Vl(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Ul.exec(e.slice(0,64));return t?t[1]:void 0}function Wl(n){let e=Lb.exec(n);return e&&e[2]?e[2]:void 0}function zl(n){try{return JSON.parse(n)}catch{return}}var Ul,Lb,jl=E(()=>{"use strict";Ul=/\b(query|mutation|subscription)\b/,Lb=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function gi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function bi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var bE,Kl=E(()=>{"use strict";q();bE=64*1024});var Gl={};_(Gl,{enrichHttpCapture:()=>Ob,graphqlResponseHasErrors:()=>Xn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function Ob(n,e){var s,i,o;let t,r=async()=>(t===void 0&&(t=n.readResponseText?await n.readResponseText():null),t);if(e.graphql)try{if(mi(n.url,n.reqBody)){let a=(s=hi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Xn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&gi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:bi(n.reqBody,a.bodyMaxBytes)}),gi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:bi(c,a.bodyMaxBytes)})}}catch{}}}var Yl=E(()=>{"use strict";jl();Kl()});function pd(n){if(er.size)for(let e of er)try{e(n)}catch{}}function fd(n){return er.add(n),()=>{er.delete(n)}}var er,ki=E(()=>{"use strict";er=new Set});var nr,rr,sr=E(()=>{"use strict";nr={startChild:()=>nr,finish(){},setData(){}},rr={startSpan:()=>nr,finish(){}}});function wd(n){var r;let e=new Uint8Array(n);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Date.now()+s*2654435761&255;let t="";for(let s=0;s<n;s++)t+=((r=e[s])!=null?r:0).toString(16).padStart(2,"0");return t}function Ct(){return wd(16)}function je(){return wd(8)}function xd(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Sd(n){var t,r,s;let e=Vb.exec(n.trim().toLowerCase());return e?{traceId:(t=e[1])!=null?t:"",spanId:(r=e[2])!=null?r:"",sampled:(parseInt((s=e[3])!=null?s:"0",16)&1)===1}:null}var Vb,ir=E(()=>{"use strict";Vb=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var or,kd=E(()=>{"use strict";ir();sr();or=class{constructor(e,t){this.name=e;this.traceId=Ct();this.rootSpanId=je();this.spans=[];this.dropped=0;this.errors=0;var r,s;this.clock=t.clock,this.maxSpans=(r=t.maxSpans)!=null?r:1e3,this.sampled=(s=t.sampled)!=null?s:!0,this.onFinish=t.onFinish,this.startMs=this.clock()}open(e,t,r){if(this.endMs!=null||this.spans.length>=this.maxSpans)return this.dropped++,nr;let s={spanId:je(),parentSpanId:t,op:e,description:r,startMs:this.clock()};this.spans.push(s);let i=this.clock;return{startChild:(o,a)=>this.open(o,s.spanId,a),finish:(o=i())=>{s.endMs==null&&(s.endMs=o)},setData:(o,a)=>{var c;((c=s.data)!=null?c:s.data={})[o]=a}}}startSpan(e,t){return this.open(e,this.rootSpanId,t)}addSpan(e,t,r,s){if(this.endMs!=null||this.spans.length>=this.maxSpans){this.dropped++;return}this.spans.push({spanId:je(),parentSpanId:this.rootSpanId,op:e,startMs:Math.round(t),endMs:Math.round(r),...s?{data:s}:{}})}finish(e=this.clock()){this.endMs==null&&(this.endMs=e,this.onFinish(this))}noteError(){this.endMs==null&&this.errors++}context(){return{traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled}}data(){var e;return{name:this.name,traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled,startMs:this.startMs,durationMs:Math.max(0,((e=this.endMs)!=null?e:this.startMs)-this.startMs),spans:this.spans.slice(),...this.dropped>0?{droppedSpans:this.dropped}:{},...this.errors>0?{errorCount:this.errors}:{}}}}});function Ed(n,e){let t=Ct(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ii(a),endMs:Ii(c)})};return i("dns",n.domainLookupStart,n.domainLookupEnd),i("connect",n.connectStart,n.connectEnd),n.secureConnectionStart>0&&i("tls",n.secureConnectionStart,n.connectEnd),i("request",n.requestStart,n.responseStart),i("response",n.responseStart,n.responseEnd),i("dom",n.responseEnd,n.domContentLoadedEventEnd),i("load",n.domContentLoadedEventEnd,n.loadEventEnd),{name:`pageload ${e}`,traceId:t,spanId:r,sampled:!0,startMs:0,durationMs:Ii(n.loadEventEnd||n.duration),spans:s}}var Ii,Id=E(()=>{"use strict";ir();Ii=n=>Math.round(n)});var Cd={};_(Cd,{Transaction:()=>or,buildPageload:()=>Ed,formatTraceparent:()=>xd,newSpanId:()=>je,newTraceId:()=>Ct,parseTraceparent:()=>Sd});var Ad=E(()=>{"use strict";kd();ir();Id()});var _d={};_(_d,{createBugReportWidget:()=>cy});function oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function ay(n){return`[data-scalebun-bugreport]{position:fixed;${oy(n)}z-index:${iy};font-family:system-ui,sans-serif}[data-scalebun-bugreport] .sbbr-launch{cursor:pointer;border:none;border-radius:9999px;padding:10px 16px;font-size:13px;font-weight:600;color:#fff;background:#ef4444;box-shadow:0 2px 8px rgba(0,0,0,.2)}[data-scalebun-bugreport] .sbbr-panel{display:none;width:300px;background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:12px;padding:14px;box-shadow:0 8px 30px rgba(0,0,0,.18);margin-top:8px}[data-scalebun-bugreport] .sbbr-panel.sbbr-open{display:block}[data-scalebun-bugreport] .sbbr-title{font-size:14px;font-weight:700;margin-bottom:8px}[data-scalebun-bugreport] .sbbr-field{width:100%;box-sizing:border-box;font:inherit;font-size:13px;padding:8px;border:1px solid #e5e7eb;border-radius:8px}[data-scalebun-bugreport] textarea.sbbr-field{resize:vertical}[data-scalebun-bugreport] .sbbr-email{margin-top:8px}[data-scalebun-bugreport] .sbbr-status{font-size:12px;color:#6b7280;min-height:16px;margin-top:8px}[data-scalebun-bugreport] .sbbr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}[data-scalebun-bugreport] .sbbr-btn{cursor:pointer;font:inherit;font-size:13px;padding:6px 12px;border-radius:8px}[data-scalebun-bugreport] .sbbr-cancel{border:1px solid #e5e7eb;background:#fff}[data-scalebun-bugreport] .sbbr-send{font-weight:600;border:none;background:#ef4444;color:#fff}`}function cy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,ay(n.position));let t=document.createElement("button");t.type="button",t.className="sbbr-launch",t.textContent=n.label;let r=document.createElement("div");r.className="sbbr-panel",r.innerHTML=`
|
|
3
3
|
<div class="sbbr-title">Report a bug</div>
|
|
4
4
|
<textarea data-scalebun-msg class="sbbr-field" placeholder="What went wrong?" rows="4"></textarea>
|
|
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),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;try{h=await n.onSubmit({message:m,email:i.value.trim()||void 0})}catch{h=null}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="Could not send the report. Please try again."};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 ny,Pd=E(()=>{"use strict";$();ny=2147483e3});var zd={};O(zd,{normalizeConfig:()=>Oi});function Dd(n){let e=Oe(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Re(e.cooldownHours),maxImpressions:Re(e.maxImpressions),samplePct:Re(e.samplePct)});return Object.keys(t).length?t:void 0}function Hd(n){let e=Oe(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Re(e.seconds),sessions:Re(e.sessions),slowMs:Re(e.slowMs),screen:U(e.screen),delaySeconds:Re(e.delaySeconds)});return Object.keys(t).length?t:void 0}function qd(n){let e=Oe(n),t=Ke({platforms:Li(e.platforms),minAppVersion:U(e.minAppVersion),segments:Li(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 py(n){var t;let e=[];for(let r of Pi(n)){let s=Oe(r),i=U(s.key),o=U(s.kind);!i||!o||!uy.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Li(s.choices),scaleMax:Re(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 fy(n){let e=Oe(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!dy.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function $d(n){let e=Oe(n),t=U(e.body);if(!t)return null;let r=Oe(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:fy(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 my(n){let e=Oe(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=$d(e.variantB);return Ke({enabled:dt(e.enabled),split:Re(e.split),variantB:t!=null?t:void 0})}function hy(n){var s,i,o;let e=Oe(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:py(e.questions),scale:Re(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:Hd(e.triggerConfig),targeting:qd(e.targeting),throttle:Dd(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 gy(n){let e=Oe(n),t=U(e.id),r=$d(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&ly.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Re(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:Hd(e.triggerConfig),targeting:qd(e.targeting),throttle:Dd(e.throttle),spec:r,revision:U(e.revision),experiment:my(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 Oi(n){var t,r;let e=Oe(n);return{configVersion:(t=Re(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Pi(e.campaigns).map(hy).filter(s=>s!==null),inAppMessages:Pi(e.inAppMessages).map(gy).filter(s=>s!==null)}}var Oe,Pi,U,Re,dt,Li,Ke,ly,dy,uy,_i=E(()=>{"use strict";Oe=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Pi=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Re=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,Li=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},ly=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],dy=new Set(["dismiss","link","custom"]),uy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var by,en,Ud=E(()=>{"use strict";by={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},en=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=by[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 Gd={};O(Gd,{clearEngageState:()=>vy,hasTestSeen:()=>Fi,markTestSeen:()=>Di,passesThrottle:()=>Er,readState:()=>Ni,recordCompleted:()=>Bi,recordShown:()=>Ir});function tn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Ni(n){let e=tn();if(!e)return{...Sr};try{let t=e.getItem(Wd(n));if(!t)return{...Sr};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{...Sr}}}function jd(n,e){let t=tn();if(t)try{t.setItem(Wd(n),JSON.stringify(e))}catch{}}function Kd(n){let e=Ni(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...Sr,revision:n.revision}:e}function Er(n,e){let t=n.throttle;if(!t)return!0;let r=Kd(n);return!(t.showOnce&&(r.completed||r.impressions>0)||typeof t.maxImpressions=="number"&&r.impressions>=t.maxImpressions||typeof t.cooldownHours=="number"&&e-r.lastShownAt<t.cooldownHours*36e5)}function Ir(n,e){let t=Kd(n);jd(n.id,{impressions:t.impressions+1,lastShownAt:e,completed:t.completed,revision:n.revision})}function Bi(n){var t;let e=Ni(n.id);jd(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function Fi(n){var t;let e=tn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function Di(n){var t;let e=tn();if(e)try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>yy;)r.shift();e.setItem(kr,JSON.stringify(r))}catch{}}function vy(){let n=tn();if(n)try{let e=[];for(let t=0;t<n.length;t++){let r=n.key(t);r&&(r.startsWith(Vd)||r==="scalebun_engage_sessions"||r===kr)&&e.push(r)}for(let t of e)n.removeItem(t)}catch{}}var Vd,Wd,Sr,kr,yy,Hi=E(()=>{"use strict";Vd="scalebun_engage_throttle:";Wd=n=>`${Vd}${n}`,Sr={impressions:0,lastShownAt:0,completed:!1};kr="scalebun_engage_test_seen",yy=50});function Qd(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:Jd.test(e)||Ey.test(e)||Iy.test(e)||Cy.has(e.toLowerCase())}function qi(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(!Xd.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}Qd(r[s])&&(t[s]=r[s].trim())}return t}function Ay(n){let e=Ry(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 Ry(n){let e=n.trim();if(Jd.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 $i(n,e){if(e&&Qd(e))return e;let t=Ay(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function Oy(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(Yd)){let s=t[r];typeof s=="string"&&Yd[r].includes(s)&&(e[r]=s)}return e}function Zd(n,e={}){var u,d;let t=e.dark?xy:wy,r=e.dark?ky:Sy,s=qi(n),i={};for(let p of Xd)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=$i(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...Ty,...Oy(n)},c=My[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=Py[a.radius],i.maxWidth=Ly[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var Xd,wy,xy,Sy,ky,Jd,Ey,Iy,Cy,Yd,Ty,My,Py,Ly,zi=E(()=>{"use strict";Xd=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],wy={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},xy={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},Sy={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},ky={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},Jd=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ey=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Iy=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Cy=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);Yd={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},Ty={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},My={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},Py={sharp:"4px",soft:"16px",round:"26px"},Ly={narrow:"340px",standard:"420px",wide:"540px"}});var eu=E(()=>{"use strict"});var Wi={};O(Wi,{CssomRecorder:()=>Vi,adoptedSheetId:()=>Cr});function Cr(n){let e=tu.get(n);return e==null&&(e=_y++,tu.set(n,e)),e}function nu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var tu,_y,Ui,Vi,Ar=E(()=>{"use strict";tu=new WeakMap,_y=1;Ui="__scalebun_cssom_patched__",Vi=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[Ui])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:nu(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:nu(this)})}),s}),e[Ui]=!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[Ui],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:Cr(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 _r={};O(_r,{MAX_INLINED_CSS_BYTES:()=>ru,NO_MASK_TEXT_PARENTS:()=>Tr,SENSITIVE_ATTRS:()=>Mr,UNRESOLVED_SHEET_ATTR:()=>su,absUrl:()=>He,absolutizeAttrValue:()=>Or,absolutizeCssUrls:()=>nn,absolutizeSrcset:()=>au,isMaskedSubtree:()=>Pr,isPasswordField:()=>At,maskSecret:()=>Rt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Ye,serializeShadow:()=>Lr,takeSnapshot:()=>Dy});function Fy(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${ji},${e.join(",")}`:ji;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return ji}}function Pr(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:Fy(n.maskSelectors),cssBudget:{used:0}}}function Dy(n,e,t={}){var r;return(r=Ye(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Ye(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Rr(n,e,t)},a=ou(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(Hy(i))return $y(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===Ny?"svg":i.namespaceURI===By?"math":void 0,l=a==="style"?zy(i,e):Rr(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=Lr(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||Pr(n.parentElement,t.maskSel))&&!Tr.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 Rr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Ye(s,e,t);i&&r.push(i)}),r}function Hy(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 qy(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 $y(n,e,t,r){let s=e.add(n),i=qy(n);if(i&&r.used+i.length<=ru){r.used+=i.length;let a=nn(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"]=He(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[su]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function zy(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=nn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function At(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&&Mr.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:"";At(n)?t.value=Rt(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 Vy){let u=t[l];u!=null&&(t[l]=Or(l,u,r,s))}return t}function Lr(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Rr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=ou(n,i);return o.length&&(s.adoptedStyles=o),s}function ou(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:Cr(s),css:nn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Rt(n){return"*".repeat(n.length)}function He(n,e){let t=n.trim();if(!t||!e||Uy.test(t))return n;try{return new URL(t,e).href}catch{return n}}function nn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${He(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${He(i,e)}${s}`),t}function Or(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return He(e,r);case"srcset":return au(e,r);case"style":return nn(e,r);case"href":return t==="link"||t==="use"||t==="image"?He(e,r):e;case"xlink:href":return t==="use"||t==="image"?He(e,r):e;case"data":return t==="object"?He(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?He(r,e):He(r.slice(0,s),e)+r.slice(s)}).join(", ")}var Tr,Mr,Ny,By,ji,ru,su,Uy,Vy,et=E(()=>{"use strict";Ar();Tr=new Set(["STYLE","SCRIPT"]),Mr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),Ny="http://www.w3.org/2000/svg",By="http://www.w3.org/1998/Math/MathML",ji='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';ru=2*1024*1024,su="data-scalebun-sheet-unresolved";Uy=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;Vy=["src","srcset","poster","style","href","xlink:href","data"]});var Nr={};O(Nr,{NodeRegistry:()=>rn});var rn,sn=E(()=>{"use strict";rn=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 Ki={};O(Ki,{captureScreenshot:()=>Wy,startVoiceRecording:()=>Gy});async function Wy(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),_r)),Promise.resolve().then(()=>(sn(),Nr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:lu}),contentType:lu,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Ky(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of jy)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 Gy(){var h,g,k;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=Ky(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),x=()=>{y.getFloatTimeDomainData(b);let S=0;for(let w=0;w<b.length;w++)S+=b[w]*b[w];o==null||o(Math.sqrt(S/b.length)),c=requestAnimationFrame(x)};c=requestAnimationFrame(x)}}catch{}let l="",u,d=(k=globalThis.SpeechRecognition)!=null?k: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,x="";for(let S=0;S<b.length;S++)x+=b[S][0].transcript;l=x,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 x=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:x}),contentType:x,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var lu,jy,Gi=E(()=>{"use strict";eu();lu="application/scalebun-snapshot+json";jy=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Yy(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 Jy(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 du(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage","");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=Zd(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=Yy(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
|
-
${
|
|
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),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;try{h=await n.onSubmit({message:m,email:i.value.trim()||void 0})}catch{h=null}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="Could not send the report. Please try again."};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 iy,Od=E(()=>{"use strict";q();iy=2147483e3});var Wd={};_(Wd,{normalizeConfig:()=>_i});function qd(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Re(e.cooldownHours),maxImpressions:Re(e.maxImpressions),samplePct:Re(e.samplePct)});return Object.keys(t).length?t:void 0}function zd(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Re(e.seconds),sessions:Re(e.sessions),slowMs:Re(e.slowMs),screen:U(e.screen),delaySeconds:Re(e.delaySeconds)});return Object.keys(t).length?t:void 0}function Ud(n){let e=_e(n),t=Ke({platforms:Li(e.platforms),minAppVersion:U(e.minAppVersion),segments:Li(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 hy(n){var t;let e=[];for(let r of Pi(n)){let s=_e(r),i=U(s.key),o=U(s.kind);!i||!o||!my.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Li(s.choices),scaleMax:Re(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 gy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!fy.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function Vd(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:gy(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 by(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=Vd(e.variantB);return Ke({enabled:dt(e.enabled),split:Re(e.split),variantB:t!=null?t:void 0})}function yy(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:hy(e.questions),scale:Re(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:zd(e.triggerConfig),targeting:Ud(e.targeting),throttle:qd(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 vy(n){let e=_e(n),t=U(e.id),r=Vd(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&py.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Re(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:zd(e.triggerConfig),targeting:Ud(e.targeting),throttle:qd(e.throttle),spec:r,revision:U(e.revision),experiment:by(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 _i(n){var t,r;let e=_e(n);return{configVersion:(t=Re(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Pi(e.campaigns).map(yy).filter(s=>s!==null),inAppMessages:Pi(e.inAppMessages).map(vy).filter(s=>s!==null)}}var _e,Pi,U,Re,dt,Li,Ke,py,fy,my,Oi=E(()=>{"use strict";_e=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Pi=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Re=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,Li=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},py=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],fy=new Set(["dismiss","link","custom"]),my=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var wy,en,jd=E(()=>{"use strict";wy={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},en=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=wy[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 Jd={};_(Jd,{clearEngageState:()=>Sy,hasTestSeen:()=>Fi,markTestSeen:()=>Di,passesThrottle:()=>Er,readState:()=>Ni,recordCompleted:()=>Bi,recordShown:()=>Ir});function tn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Ni(n){let e=tn();if(!e)return{...Sr};try{let t=e.getItem(Gd(n));if(!t)return{...Sr};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{...Sr}}}function Yd(n,e){let t=tn();if(t)try{t.setItem(Gd(n),JSON.stringify(e))}catch{}}function Xd(n){let e=Ni(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...Sr,revision:n.revision}:e}function Er(n,e){let t=n.throttle;if(!t)return!0;let r=Xd(n);return!(t.showOnce&&(r.completed||r.impressions>0)||typeof t.maxImpressions=="number"&&r.impressions>=t.maxImpressions||typeof t.cooldownHours=="number"&&e-r.lastShownAt<t.cooldownHours*36e5)}function Ir(n,e){let t=Xd(n);Yd(n.id,{impressions:t.impressions+1,lastShownAt:e,completed:t.completed,revision:n.revision})}function Bi(n){var t;let e=Ni(n.id);Yd(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function Fi(n){var t;let e=tn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function Di(n){var t;let e=tn();if(e)try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>xy;)r.shift();e.setItem(kr,JSON.stringify(r))}catch{}}function Sy(){let n=tn();if(n)try{let e=[];for(let t=0;t<n.length;t++){let r=n.key(t);r&&(r.startsWith(Kd)||r==="scalebun_engage_sessions"||r===kr)&&e.push(r)}for(let t of e)n.removeItem(t)}catch{}}var Kd,Gd,Sr,kr,xy,Hi=E(()=>{"use strict";Kd="scalebun_engage_throttle:";Gd=n=>`${Kd}${n}`,Sr={impressions:0,lastShownAt:0,completed:!1};kr="scalebun_engage_test_seen",xy=50});function tu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:eu.test(e)||Ay.test(e)||Ry.test(e)||Ty.has(e.toLowerCase())}function $i(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(!Zd.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}tu(r[s])&&(t[s]=r[s].trim())}return t}function My(n){let e=Py(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 Py(n){let e=n.trim();if(eu.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 qi(n,e){if(e&&tu(e))return e;let t=My(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function By(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(Qd)){let s=t[r];typeof s=="string"&&Qd[r].includes(s)&&(e[r]=s)}return e}function nu(n,e={}){var u,d;let t=e.dark?Ey:ky,r=e.dark?Cy:Iy,s=$i(n),i={};for(let p of Zd)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=qi(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...Ly,...By(n)},c=_y[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=Oy[a.radius],i.maxWidth=Ny[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var Zd,ky,Ey,Iy,Cy,eu,Ay,Ry,Ty,Qd,Ly,_y,Oy,Ny,zi=E(()=>{"use strict";Zd=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],ky={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},Ey={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},Iy={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},Cy={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},eu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ay=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Ry=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Ty=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);Qd={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},Ly={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},_y={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},Oy={sharp:"4px",soft:"16px",round:"26px"},Ny={narrow:"340px",standard:"420px",wide:"540px"}});var ru=E(()=>{"use strict"});var Wi={};_(Wi,{CssomRecorder:()=>Vi,adoptedSheetId:()=>Cr});function Cr(n){let e=su.get(n);return e==null&&(e=Fy++,su.set(n,e)),e}function iu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var su,Fy,Ui,Vi,Ar=E(()=>{"use strict";su=new WeakMap,Fy=1;Ui="__scalebun_cssom_patched__",Vi=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[Ui])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:iu(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:iu(this)})}),s}),e[Ui]=!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[Ui],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:Cr(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 Or={};_(Or,{MAX_INLINED_CSS_BYTES:()=>ou,NO_MASK_TEXT_PARENTS:()=>Tr,SENSITIVE_ATTRS:()=>Mr,UNRESOLVED_SHEET_ATTR:()=>au,absUrl:()=>He,absolutizeAttrValue:()=>_r,absolutizeCssUrls:()=>nn,absolutizeSrcset:()=>du,isMaskedSubtree:()=>Pr,isPasswordField:()=>At,maskSecret:()=>Rt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Ye,serializeShadow:()=>Lr,takeSnapshot:()=>qy});function $y(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${ji},${e.join(",")}`:ji;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return ji}}function Pr(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:$y(n.maskSelectors),cssBudget:{used:0}}}function qy(n,e,t={}){var r;return(r=Ye(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Ye(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Rr(n,e,t)},a=lu(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(zy(i))return Vy(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===Dy?"svg":i.namespaceURI===Hy?"math":void 0,l=a==="style"?Wy(i,e):Rr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:cu(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Lr(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||Pr(n.parentElement,t.maskSel))&&!Tr.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 Rr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Ye(s,e,t);i&&r.push(i)}),r}function zy(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 Uy(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 Vy(n,e,t,r){let s=e.add(n),i=Uy(n);if(i&&r.used+i.length<=ou){r.used+=i.length;let a=nn(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"]=He(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=cu(n,t);return o[au]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function Wy(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=nn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function At(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 cu(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Mr.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:"";At(n)?t.value=Rt(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 Ky){let u=t[l];u!=null&&(t[l]=_r(l,u,r,s))}return t}function Lr(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Rr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=lu(n,i);return o.length&&(s.adoptedStyles=o),s}function lu(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:Cr(s),css:nn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Rt(n){return"*".repeat(n.length)}function He(n,e){let t=n.trim();if(!t||!e||jy.test(t))return n;try{return new URL(t,e).href}catch{return n}}function nn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${He(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${He(i,e)}${s}`),t}function _r(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return He(e,r);case"srcset":return du(e,r);case"style":return nn(e,r);case"href":return t==="link"||t==="use"||t==="image"?He(e,r):e;case"xlink:href":return t==="use"||t==="image"?He(e,r):e;case"data":return t==="object"?He(e,r):e;default:return e}}function du(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?He(r,e):He(r.slice(0,s),e)+r.slice(s)}).join(", ")}var Tr,Mr,Dy,Hy,ji,ou,au,jy,Ky,et=E(()=>{"use strict";Ar();Tr=new Set(["STYLE","SCRIPT"]),Mr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),Dy="http://www.w3.org/2000/svg",Hy="http://www.w3.org/1998/Math/MathML",ji='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';ou=2*1024*1024,au="data-scalebun-sheet-unresolved";jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;Ky=["src","srcset","poster","style","href","xlink:href","data"]});var Nr={};_(Nr,{NodeRegistry:()=>rn});var rn,sn=E(()=>{"use strict";rn=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 Ki={};_(Ki,{captureScreenshot:()=>Gy,startVoiceRecording:()=>Jy});async function Gy(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Or)),Promise.resolve().then(()=>(sn(),Nr))]),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 Xy(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of Yy)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 Jy(){var h,g,k;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=Xy(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),x=()=>{y.getFloatTimeDomainData(b);let S=0;for(let w=0;w<b.length;w++)S+=b[w]*b[w];o==null||o(Math.sqrt(S/b.length)),c=requestAnimationFrame(x)};c=requestAnimationFrame(x)}}catch{}let l="",u,d=(k=globalThis.SpeechRecognition)!=null?k: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,x="";for(let S=0;S<b.length;S++)x+=b[S][0].transcript;l=x,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 x=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:x}),contentType:x,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,Yy,Gi=E(()=>{"use strict";ru();pu="application/scalebun-snapshot+json";Yy=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Qy(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 ev(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 fu(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage","");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=nu(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=Qy(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
|
+
${tv}`);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=ev(a),k=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))},x=()=>{A.disabled=!b(k),A.textContent=k===v?"Submit":"Next",R.style.display=k>0?"":"none",w.textContent=g.length>1?`Page ${k+1} of ${g.length}`:""},S=()=>{var H,V;I.replaceChildren();for(let K of(H=g[k])!=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),nv(de,K,se=>{c.set(K.key,se),u(),x()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),x()},c.get(K.key)),I.appendChild(de)}x(),(V=I.querySelector("textarea, .opt, .emoji"))==null||V.focus()},w=document.createElement("div");w.className="pg",f.appendChild(w);let I=document.createElement("div");f.appendChild(I);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),S();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",te=()=>{if(e.onSubmit(rv(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(k<v){k+=1,u(),S();return}te()},Q=()=>{k!==0&&(k-=1,S())},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=I.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 nv(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(()=>(Gi(),Ki)),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(()=>(Gi(),Ki));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=[];Zy.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 rv(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 Zy,tv,mu=E(()=>{"use strict";q();zi();Zy=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];tv=`
|
|
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
|
|
73
|
+
`});function iv(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 Yi(n,e,t){var y,b,x,S,w,I;let r=document.createElement("div");r.setAttribute("data-scalebun-engage","");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=(S=(x=e.style)==null?void 0:x.text)!=null?S:i?"#f9fafb":"#111827",c=(I=(w=e.style)==null?void 0:w.accent)!=null?I:"#111827",l=sv.includes(n),u=yt(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
|
-
${nv(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 k=document.createElement("div");if(k.className="b",k.textContent=e.body,p.appendChild(k),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 tv,pu=E(()=>{"use strict";$();tv=["modal","fullscreen","bottom_sheet"]});function Xi(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(fu,n)}function mu(n){return Xi(n)?fu[n]:null}function hu(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 gu(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 Ji(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 bu(n,e){var a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,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((x=(b=(y=(v=(k=t.outcomeId)!=null?k:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?x: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),_=typeof A=="number"&&Array.isArray(t.segments)?ut(t.segments[A]):{},z=be((R=(M=(C=(I=(w=(S=t.winningId)!=null?S:t.segmentId)!=null?w:r.segmentId)!=null?I:r.id)!=null?C:_.id)!=null?M:_.value)!=null?R:_.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 Ji(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function yu(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 fu,ut,be,Qi=E(()=>{"use strict";fu={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 wu(n){if(!Xi(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=rv(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=gu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:yu(t,e,r,()=>sv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:hu(n.ext)});if(n.preview){let a=bu(o,n.ext);return a?vu(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?vu(Ji(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 vu(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 rv,sv,xu=E(()=>{"use strict";Qi();rv=n=>typeof n=="string"?n.trim():"",sv=0});var Tt,Zi=E(()=>{"use strict";Tt=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 Su={};O(Su,{engageSlots:()=>Mt,hasInAppSlot:()=>eo,registerInAppSlot:()=>iv,slotNameFor:()=>Br});function iv(n,e){return!n||!e?()=>{}:(Mt.register(n,e),()=>Mt.unregister(n))}function Br(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function eo(n){let e=Br(n);return!!e&&!!Mt.get(e)}var Mt,to=E(()=>{"use strict";Zi();Mt=new Tt});function Pt(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)==="right"?"side-right":"side-left":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"}`:uv[n.surface]}function fv(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||!pv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),av.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),cv.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)ov.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||!dv.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||!lv.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 ku(n){return fv(n).length===0}var ov,av,cv,lv,dv,uv,no,ro,pv,Fr=E(()=>{"use strict";ov=["web","ios","android"],av=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],cv=["critical","high","normal","low","passive"],lv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],dv=["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"],uv={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"},no={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"},ro={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};pv=/^[a-z0-9][a-z0-9_-]*$/i});var Dr,so=E(()=>{"use strict";Dr=`
|
|
90
|
+
${iv(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 k=document.createElement("div");if(k.className="b",k.textContent=e.body,p.appendChild(k),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 sv,hu=E(()=>{"use strict";q();sv=["modal","fullscreen","bottom_sheet"]});function Xi(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(gu,n)}function bu(n){return Xi(n)?gu[n]:null}function yu(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 vu(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 Ji(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 wu(n,e){var a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,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((x=(b=(y=(v=(k=t.outcomeId)!=null?k:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?x: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=(I=(w=(S=t.winningId)!=null?S:t.segmentId)!=null?w:r.segmentId)!=null?I: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 Ji(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function xu(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 gu,ut,be,Qi=E(()=>{"use strict";gu={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 ku(n){if(!Xi(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=ov(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=vu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:xu(t,e,r,()=>av+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:yu(n.ext)});if(n.preview){let a=wu(o,n.ext);return a?Su(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?Su(Ji(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 Su(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 ov,av,Eu=E(()=>{"use strict";Qi();ov=n=>typeof n=="string"?n.trim():"",av=0});var Tt,Zi=E(()=>{"use strict";Tt=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 Iu={};_(Iu,{engageSlots:()=>Mt,hasInAppSlot:()=>eo,registerInAppSlot:()=>cv,slotNameFor:()=>Br});function cv(n,e){return!n||!e?()=>{}:(Mt.register(n,e),()=>Mt.unregister(n))}function Br(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function eo(n){let e=Br(n);return!!e&&!!Mt.get(e)}var Mt,to=E(()=>{"use strict";Zi();Mt=new Tt});function Pt(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)==="right"?"side-right":"side-left":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"}`:mv[n.surface]}function gv(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||!hv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),dv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),uv.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)lv.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||!fv.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||!pv.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 Cu(n){return gv(n).length===0}var lv,dv,uv,pv,fv,mv,no,ro,hv,Fr=E(()=>{"use strict";lv=["web","ios","android"],dv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],uv=["critical","high","normal","low","passive"],pv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],fv=["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"],mv={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"},no={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"},ro={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};hv=/^[a-z0-9][a-z0-9_-]*$/i});var Dr,so=E(()=>{"use strict";Dr=`
|
|
91
91
|
.scalebun-h{ font-size:17px; font-weight:700; margin:0 0 6px; color:var(--scalebun-fg); }
|
|
92
92
|
.scalebun-text{ font-size:14px; line-height:1.5; margin:0 0 6px; color:var(--scalebun-fg); }
|
|
93
93
|
.scalebun-rich{ font-size:14px; line-height:1.5; color:var(--scalebun-fg); }
|
|
@@ -278,7 +278,7 @@ ${nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
|
|
|
278
278
|
.scalebun-poll-pct{ position:relative; z-index:1; font-size:12px; color:var(--scalebun-muted); }
|
|
279
279
|
.scalebun-quiz-opt.correct{ border-color:#2fa96b; background:color-mix(in srgb, #2fa96b 14%, transparent); }
|
|
280
280
|
.scalebun-quiz-opt.incorrect{ border-color:#e0483d; background:color-mix(in srgb, #e0483d 14%, transparent); }
|
|
281
|
-
`});var
|
|
281
|
+
`});var Au,Ru=E(()=>{"use strict";Au=`
|
|
282
282
|
/* shared close button */
|
|
283
283
|
.scalebun-x{ background:none; border:0; color:var(--scalebun-muted); cursor:pointer; font-size:16px; line-height:1;
|
|
284
284
|
padding:4px 6px; border-radius:6px; }
|
|
@@ -457,9 +457,9 @@ ${nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
|
|
|
457
457
|
.scalebun-launcher-item{ text-align:left; background:none; border:0; color:var(--scalebun-fg); cursor:pointer; font:inherit;
|
|
458
458
|
font-size:13.5px; padding:9px 12px; border-radius:8px; }
|
|
459
459
|
.scalebun-launcher-item:hover{ background:color-mix(in srgb, var(--scalebun-fg) 7%, transparent); }
|
|
460
|
-
`});var
|
|
461
|
-
`).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function
|
|
462
|
-
`)){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",ao(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");ao(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",ao(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var zu={};O(zu,{codeRenderer:()=>Av});var Av,Uu=E(()=>{"use strict";Av=(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 k=e.doc.createRange();k.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(k)}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 Ur={};O(Ur,{chartRenderer:()=>Mv,sparklineRenderer:()=>Rv,statRenderer:()=>Tv});function Wu(n,e,t){let r=n.createElementNS(lo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var lo,Vu,Rv,Tv,Mv,Vr=E(()=>{"use strict";lo="http://www.w3.org/2000/svg",Vu=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];Rv=(n,e)=>{var p;let t=Vu((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=Wu(e.doc,s,i),d=e.doc.createElementNS(lo,"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},Tv=(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},Mv=(n,e)=>{var l;let t=Vu((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=Wu(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(lo,"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 ju={};O(ju,{tableRenderer:()=>Pv});var Pv,Ku=E(()=>{"use strict";Pv=(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 Gu={};O(Gu,{videoRenderer:()=>Lv});var Lv,Yu=E(()=>{"use strict";Lv=(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 Xu={};O(Xu,{countdownRenderer:()=>_v});function Ov(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 Wr,_v,Ju=E(()=>{"use strict";Wr=n=>String(Math.max(0,n)).padStart(2,"0"),_v=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=Ov(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=Wr(c),i[1][1].textContent=Wr(l),i[2][1].textContent=Wr(u),i[3][1].textContent=Wr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var Qu={};O(Qu,{carouselRenderer:()=>Nv});var uo,Nv,Zu=E(()=>{"use strict";uo=n=>typeof n=="string"&&n?n:void 0,Nv=(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=uo(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(uo(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(uo(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 ep={};O(ep,{productGridRenderer:()=>Bv});var jr,Bv,tp=E(()=>{"use strict";jr=n=>n==null?void 0:String(n),Bv=(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=jr(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=jr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=jr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=jr(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 rp={};O(rp,{confettiRenderer:()=>Dv});function Fv(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var np,Dv,sp=E(()=>{"use strict";np=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];Dv=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",Fv()||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:np[h%np.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 Lt(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 Kr=E(()=>{"use strict"});var ap={};O(ap,{spinwheelRenderer:()=>$v});function fo(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 qv(n,e,t,r,s){let i=fo(n,e,t,s),o=fo(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 op(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var ip,Hv,po,$v,cp=E(()=>{"use strict";Kr();ip=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],Hv=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};po="http://www.w3.org/2000/svg",$v=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(Hv).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(po,"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,x)=>{let S=e.doc.createElementNS(po,"path");S.setAttribute("d",qv(c,c,l,x*u,(x+1)*u)),S.setAttribute("fill",ip[x%ip.length]),d.appendChild(S);let w=fo(c,c,l*.62,x*u+u/2),I=e.doc.createElementNS(po,"text");I.setAttribute("x",String(w.x)),I.setAttribute("y",String(w.y)),I.setAttribute("fill","#fff"),I.setAttribute("font-size","10"),I.setAttribute("text-anchor","middle"),I.setAttribute("transform",`rotate(${x*u+u/2} ${w.x} ${w.y})`),I.textContent=b.slice(0,12),d.appendChild(I)});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,x)=>{var I;let S=((I=x!=null?x:r[b])!=null?I:"").slice(0,14);if(op()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=S;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let w=()=>{f.textContent=S};d.addEventListener("transitionend",w,{once:!0}),setTimeout(w,3600)},k=b=>{m=!0,f.disabled=!0,Ot(o),op()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(x=>{var w,I,C;if(!x.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,Lt(o,e.doc,x,{onRetry:()=>k(b+1)}),(w=e.onInteraction)==null||w.call(e,"spin_unavailable");return}let S=Math.max(0,Math.min(s-1,Number((I=x.index)!=null?I:0)));(C=e.onInteraction)==null||C.call(e,`spin:${S}`),g(S,x.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){k(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var dp={};O(dp,{scratchRenderer:()=>zv});function lp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var zv,up=E(()=>{"use strict";Kr();zv=(n,e)=>{var k,v;let t=typeof((k=n.props)==null?void 0:k.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",Lt(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(lp())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(lp()||!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 x;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.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 x;let b=y.touches[0];if(b){let S=h(b);m(S.x,S.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.call(e,"scratch_reveal"))}}),s}});var pp={};O(pp,{slotRenderer:()=>Wv});function Vv(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Uv,Wv,fp=E(()=>{"use strict";Kr();Uv=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Wv=(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:Uv,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 k=e.doc.createElement("div");k.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,k.appendChild(y)}g.appendChild(k),a.push(k),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,k)=>{let v=(g.children.length-1)*44;Vv()||(g.style.transition=`transform ${1.6+k*.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,Lt(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let k=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((x,S)=>{var I,C;let w=x.children[x.children.length-1];w&&(w.textContent=(C=(I=k[S])!=null?I:s[S])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${k.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 mp={};O(mp,{qrRenderer:()=>Yv});function jv(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 Kv(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 Gv(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 mo,Yv,hp=E(()=>{"use strict";mo="http://www.w3.org/2000/svg";Yv=(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(mo,"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(mo,"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(Kv(f,p)?m=Gv(f,p):f===6||p===6?m=(f+p)%2===0:m=jv(t,f,p),!m)continue;let h=e.doc.createElementNS(mo,"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 gp={};O(gp,{streakRenderer:()=>Xv});var ho,Xv,bp=E(()=>{"use strict";ho=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Xv=(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,ho(t.days,s.length||7))),o=Math.max(0,Math.min(i,ho(t.filled,0))),a=r?Math.max(0,Math.min(i,ho(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 wp={};O(wp,{nextStepIndex:()=>vp,stepLabels:()=>yp,stepsRenderer:()=>Qv});function yp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=qe(e.backLabel))!=null?t:"Back",skip:(s=(r=qe(e.skipLabel))!=null?r:qe(e.secondaryLabel))!=null?s:"Skip",next:(i=qe(e.nextLabel))!=null?i:"Next",finish:(a=(o=qe(e.finalLabel))!=null?o:qe(e.ctaLabel))!=null?a:"Finish"}}function vp(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Jv(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=qe(i.title))!=null?o:qe(i.label),body:(a=qe(i.body))!=null?a:qe(i.text)}});return r.length?r:[{}]}var qe,Qv,xp=E(()=>{"use strict";qe=n=>typeof n=="string"&&n.trim()?n.trim():void 0;Qv=(n,e)=>{let t=n.props,r=Jv(t),s=yp(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,x)=>{let S=i.createElement("button");return S.type="button",S.className=x,S.textContent=b,f.appendChild(S),S},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),k=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var S,w,I;let b=(S=r[o])!=null?S:{};d.textContent=(w=b.title)!=null?w:"",d.style.display=b.title?"":"none",p.textContent=(I=b.body)!=null?I:"",p.style.display=b.body?"":"none";let x=o+1>=r.length;k.textContent=x?s.finish:s.next,h.hidden=o===0,g.hidden=x,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 S;let x=vp(o,r.length,b);x!==o&&(o=x,v(),(S=e.onInteraction)==null||S.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")}),k.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 Sp(n){let e=new Set;for(let t of n)go[t]&&!Hr[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{Hr[t]=await go[t]()}catch{}}))}var go,yC,kp=E(()=>{"use strict";$r();go={markdown:()=>Promise.resolve().then(()=>($u(),qu)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(Uu(),zu)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(Ku(),ju)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(Yu(),Gu)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(Ju(),Xu)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(Zu(),Qu)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(tp(),ep)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(sp(),rp)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(cp(),ap)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(up(),dp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(fp(),pp)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(hp(),mp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(bp(),gp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(xp(),wp)).then(n=>n.stepsRenderer)},yC=Object.keys(go)});var Ep={};O(Ep,{bannerSurface:()=>Zv});function Zv(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 Ip=E(()=>{"use strict";Te()});var Cp={};O(Cp,{toastSurface:()=>ew});function ew(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 Ap=E(()=>{"use strict";Te()});function nw(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 Rp(n){return Array.from(n.querySelectorAll(tw)).filter(nw)}function rw(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function _t(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Rp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=rw(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 Gr(n){let e=Rp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Yr(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 Nt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var tw,Xr=E(()=>{"use strict";tw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Tp={};O(Tp,{modalSurface:()=>iw});function iw(n){var h,g,k,v,y,b,x;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Nt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(k=r.role)!=null?k:"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(S=>S.classList.contains("scalebun-h"));if(u){let S=`scalebun-mt-${++sw}`;u.id=S,a.setAttribute("aria-labelledby",S)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let S=e.createElement("button");S.type="button",S.className="scalebun-x scalebun-modal-x",S.setAttribute("aria-label","Close dialog"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),a.appendChild(S)}for(let S of l)a.appendChild(S);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",S=>{S.target===o&&n.requestClose("backdrop")});let d=S=>{S.key==="Escape"&&s.escClose!==!1&&(S.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=_t(a,e),f=(x=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?x:o,m=Yr(f,e);return{el:o,afterMount:()=>Gr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var sw,Mp=E(()=>{"use strict";Te();Xr();sw=0});var _p={};O(_p,{slideoverSurface:()=>cw});function ow(n,e){try{let t=localStorage.getItem(Op(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Lp,Math.max(Pp,r)):e}catch{return e}}function aw(n,e){try{localStorage.setItem(Op(n),String(Math.round(e)))}catch{}}function cw(n){var g,k,v,y,b,x,S,w,I,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((k=t.surfaceOptions)==null?void 0:k.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",(S=(x=t.a11y)==null?void 0:x.labelledBy)!=null?S:t.name);let l=ow(t.id,(I=(w=t.surfaceOptions)==null?void 0:w.maxWidth)!=null?I: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 _=()=>{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{}_()}),_(),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,_=l;f=z=>{let D=i?z.clientX-A:A-z.clientX;l=Math.min(Lp,Math.max(Pp,_+D)),u()},m=()=>{aw(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 Pp,Lp,Op,Np=E(()=>{"use strict";Te();Pp=280,Lp=640,Op=n=>`scalebun_inapp_slideover_${n}`});function Bp(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function on(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&&on(i,e,t,r)}return r}function bo(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=bo(i,e,!0);if(o)return o}}return null}function lw(n,e,t,r){let s=e.trim(),i=on(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 dw(n,e,t,r){var a,c;let s=e?`[role="${Bp(e)}"]`:"button,a,[role],input,select,textarea,summary",i=on(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 uw(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 pw(n,e,t){var r;switch(n.kind){case"selector":return bo(e,n.value,t);case"data-attr":return bo(e,`[data-scalebun-anchor="${Bp(n.value)}"]`,t);case"nth":return(r=on(e,n.selector,t)[n.index])!=null?r:null;case"text":return lw(e,n.value,n.scope,t);case"aria":return dw(e,n.role,n.name,t);case"xpath":return uw(n.value)}}function Fp(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of on(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?pw(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function Dp(n){return n.el!=null&&n.strategyIndex>0}var Jr=E(()=>{"use strict"});function yo(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 Hp(n,e,t,r,s){let i=(an(n)?t.height:t.width)+s;return yo(n,e,r)>=i}function Qr(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function Zr(n){var h,g,k,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(k=n.arrowSize)!=null?k: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(!Hp(c,s,i,o,e)){let y=fw[c];(Hp(y,s,i,o,e)||yo(y,s,o)>yo(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&an(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;an(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(an(c)){let y=Qr(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=Qr(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return an(c)?(m.x=Qr(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=Qr(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 fw,an,vo=E(()=>{"use strict";fw={top:"bottom",bottom:"top",left:"right",right:"left"},an=n=>n==="top"||n==="bottom"});var tt,es=E(()=>{"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 mw(){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 qp(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,Bt=E(()=>{"use strict";Jr();vo();es();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),Dp(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=Zr({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:mw(),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 $p={};O($p,{popoverSurface:()=>bw});function hw(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 gw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function bw(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=hw(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:()=>{let f=s.getBoundingClientRect();return{width:f.width||s.offsetWidth||320,height:f.height||s.offsetHeight||120}},preferred:{side:gw(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 zp=E(()=>{"use strict";Te();Bt()});var Up={};O(Up,{coachmarkSurface:()=>ww});function yw(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 vw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ww(n){var p,f,m,h,g,k;let{doc:e,variant:t}=n,r=yw(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:()=>{let v=a.getBoundingClientRect();return{width:v.width||a.offsetWidth||300,height:v.height||a.offsetHeight||120}},preferred:{side:vw(n),align:"center"},offset:(k=t.surfaceOptions)==null?void 0:k.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 Vp=E(()=>{"use strict";Te();Bt()});function Ft(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Ft(l,e));if("any"in n)return n.any.some(l=>Ft(l,e));if("not"in n)return!Ft(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 Wp(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Ft(t.when,e))return t.to}return null}var jp=E(()=>{"use strict"});var Dt,wo=E(()=>{"use strict";jp();Dt=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&&Ft(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=Wp(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 So(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 xo(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Kp(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 Gp(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 xw(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&So(xo(n),Kp(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!Gp(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(xo(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 Sw(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&So(xo(n),Kp(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!Gp(n)?"not-clickable":"timeout":"not-found"}function ts(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();xw(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,Sw(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ns=E(()=>{"use strict"});var Yp={};O(Yp,{tourSurface:()=>Ew});function kw(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 Ew(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 S;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(S=p.step.title)!=null?S:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let w=e.createElement("h2");w.className="scalebun-h",w.textContent=p.step.title,f.appendChild(w)}if(p.step.body){let w=e.createElement("p");w.className="scalebun-text",w.textContent=p.step.body,f.appendChild(w)}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 k=(w,I,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${I}`,M.textContent=w,M.addEventListener("click",C),M};p.index>0&&g.appendChild(k("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(k("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(k(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,x=()=>{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 w=qp(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let I=6;b=new Me({spec:p.step.anchor,size:()=>{let C=f.getBoundingClientRect();return{width:C.width||f.offsetWidth||300,height:C.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-I}px`,y.style.left=`${R.x-I}px`,y.style.width=`${R.width+I*2}px`,y.style.height=`${R.height+I*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(w)},onLost:C=>{var M;x(),(M=n.metrics)==null||M.recordFailedSelector(w),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 Dt({hub:s,resolveAnchor:pt,waitFor:ts,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(ko(p)):localStorage.setItem(ko(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(ko(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(kw)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var ko,Xp=E(()=>{"use strict";wo();Jr();ns();es();Bt();ko=n=>`scalebun_inapp_tour_${n}`});var Jp={};O(Jp,{hotspotSurface:()=>Aw});function Iw(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 Cw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Aw(n){let{doc:e,variant:t}=n,r=Iw(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:()=>{let d=o.getBoundingClientRect();return{width:d.width||o.offsetWidth||240,height:d.height||o.offsetHeight||90}},preferred:{side:Cw(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 Qp=E(()=>{"use strict";Te();Bt()});var Zp={};O(Zp,{toolbarSurface:()=>Mw});function Rw(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 Tw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Mw(n){var a,c,l,u;let{doc:e,variant:t}=n,r=Rw(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:()=>{let d=s.getBoundingClientRect();return{width:d.width||s.offsetWidth||220,height:d.height||s.offsetHeight||80}},preferred:{side:Tw(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 ef=E(()=>{"use strict";Te();Bt()});var tf={};O(tf,{paletteSurface:()=>Pw});function Pw(n){var k,v,y;let{doc:e,variant:t}=n,r=(v=(k=t.surfaceOptions)==null?void 0:k.commands)!=null?v:[],s=Nt(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,x)=>{let S=e.createElement("li");S.className="scalebun-palette-item"+(x===u?" active":""),S.setAttribute("role","option"),S.setAttribute("aria-selected",String(x===u));let w=e.createElement("span");if(w.className="scalebun-palette-label",w.textContent=b.label,S.appendChild(w),b.hint){let I=e.createElement("span");I.className="scalebun-palette-hint",I.textContent=b.hint,S.appendChild(I)}S.addEventListener("mousemove",()=>{u=x,f()}),S.addEventListener("click",()=>d(b)),c.appendChild(S)})},f=()=>{Array.from(c.children).forEach((b,x)=>{b.classList.toggle("active",x===u),b.setAttribute("aria-selected",String(x===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(x=>x.label.toLowerCase().includes(b)||x.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=_t(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var nf=E(()=>{"use strict";Xr()});var rf={};O(rf,{panelSurface:()=>Lw});function Lw(n){var g,k,v,y,b,x;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=(k=t.a11y)==null?void 0:k.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 S=e.createElement("button");S.type="button",S.className="scalebun-x",S.setAttribute("aria-label","Close panel"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),i.appendChild(S)}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=(x=(b=t.blocks.find(S=>S.kind==="text"))==null?void 0:b.props)==null?void 0:x.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(S,w){let I=e.createElement("div");return I.className=`scalebun-bubble scalebun-bubble-${S}`,I.textContent=w,a.appendChild(I),a.scrollTop=a.scrollHeight,I}let m=S=>{S.preventDefault();let w=u.value.trim();w&&(f("user",w),u.value="",n.hooks.onInteraction(`ai_prompt:${w}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:S=>{var w;p||(p=f("assistant","")),p.textContent=((w=p.textContent)!=null?w:"")+S,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 sf=E(()=>{"use strict"});var af={};O(af,{checklistSurface:()=>Ow});function Ow(n){var x,S,w,I,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((x=r==null?void 0:r.props)==null?void 0:x.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(w=(S=t.blocks.find(R=>R.kind==="heading"))==null?void 0:S.props)==null?void 0:w.text,o=new Set;try{let R=localStorage.getItem(of(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(of(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(I=t.a11y)==null?void 0:I.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 k=!1,v=()=>{let R=s.length||1,A=s.filter(_=>o.has(_.id)).length;m.style.width=`${Math.round(A/R*100)}%`,h.textContent=`${A} of ${s.length} complete`,g.replaceChildren();for(let _ of s){let z=e.createElement("li");z.className="scalebun-cl-item"+(o.has(_.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(_.id))),D.textContent=o.has(_.id)?"\u2713":"",D.addEventListener("click",()=>y(_.id));let te=e.createElement("span");te.className="scalebun-cl-label",te.textContent=_.label,z.append(D,te),g.appendChild(z)}A>=s.length&&s.length>0&&!k?(k=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(k=!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 of,cf=E(()=>{"use strict";of=n=>`scalebun_inapp_checklist_${n}`});var lf={};O(lf,{takeoverSurface:()=>Nw});function Nw(n){var m,h,g,k,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Nt(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-${++_w}`;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=_t(o,e),p=(v=(k=n.host.shadowRoot)==null?void 0:k.host)!=null?v:o,f=Yr(p,e);return{el:o,afterMount:()=>Gr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var _w,df=E(()=>{"use strict";Te();Xr();_w=0});var uf={};O(uf,{launcherSurface:()=>Bw});function Bw(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 pf=E(()=>{"use strict"});var hf={};O(hf,{ShadowHost:()=>cn,applyThemeVars:()=>rs,resolveScheme:()=>mf});function mf(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 rs(n,e){let t=Dw[mf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var Fw,ff,Dw,cn,ss=E(()=>{"use strict";$();Fw="scalebun-inapp-host",ff=`
|
|
460
|
+
`});var Tu,io,Mu,Pu,Lu,_u,Ou,Nu,Bu=E(()=>{"use strict";Tu=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),io=n=>Array.isArray(n)?n:[],Mu=n=>io(n).map(e=>typeof e=="string"?{id:e,label:e}:e),Pu=(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},Lu=(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},_u=(n,e)=>{var s,i;let t=io((s=n.props)==null?void 0:s.emojis).length?io((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},Ou=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=Tu((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 Mu((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},Nu=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=Tu((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 Mu((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,k;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=(k=m.state)!=null?k:{};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 Du(n,e,t){e.split(`
|
|
461
|
+
`).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function $r(n,e){let t=[];for(let r of n){let s=Hr[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,bv,yv,vv,Fu,wv,xv,Sv,kv,Ev,Iv,Cv,Av,Rv,Hr,qr=E(()=>{"use strict";Bu();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},bv=(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},yv=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return Du(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},vv=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return Du(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},Fu=(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},wv=(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},xv=(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},Sv=(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},kv=(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},Ev=(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},Iv=(n,e)=>ve(e.doc,"hr","scalebun-divider"),Cv=(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},Av=new Set(["primary","secondary","link","ghost","dismiss"]),Rv=(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=Av.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},Hr={heading:bv,text:yv,richtext:vv,image:Fu,illustration:Fu,list:xv,checklist:wv,callout:Sv,badge:kv,progress:Ev,divider:Iv,spacer:Cv,cta:Rv,nps:Pu,rating:Lu,emoji:_u,poll:Ou,quiz:Nu}});async function Hu(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 $u=E(()=>{"use strict"});function oo(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){Hu(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return $r(n.variant.blocks,oo(n))}function zr(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=E(()=>{"use strict";qr();$u()});function qu(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",Dr),n.addStyles("scalebun-surfaces",Au);let i=n.zone(Pt(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=zr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var zu=E(()=>{"use strict";Fr();so();Ru();Te()});var Uu={};_(Uu,{markdownRenderer:()=>Tv});function ao(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(co(e,"strong",i[2]));else if(i[4])t.push(co(e,"em",i[4]));else if(i[6])t.push(co(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 co(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var Tv,Vu=E(()=>{"use strict";Tv=(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(`
|
|
462
|
+
`)){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",ao(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");ao(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",ao(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var Wu={};_(Wu,{codeRenderer:()=>Mv});var Mv,ju=E(()=>{"use strict";Mv=(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 k=e.doc.createRange();k.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(k)}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 Ur={};_(Ur,{chartRenderer:()=>_v,sparklineRenderer:()=>Pv,statRenderer:()=>Lv});function Gu(n,e,t){let r=n.createElementNS(lo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var lo,Ku,Pv,Lv,_v,Vr=E(()=>{"use strict";lo="http://www.w3.org/2000/svg",Ku=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];Pv=(n,e)=>{var p;let t=Ku((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=Gu(e.doc,s,i),d=e.doc.createElementNS(lo,"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},Lv=(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},_v=(n,e)=>{var l;let t=Ku((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=Gu(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(lo,"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 Yu={};_(Yu,{tableRenderer:()=>Ov});var Ov,Xu=E(()=>{"use strict";Ov=(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 Ju={};_(Ju,{videoRenderer:()=>Nv});var Nv,Qu=E(()=>{"use strict";Nv=(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 Zu={};_(Zu,{countdownRenderer:()=>Fv});function Bv(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 Wr,Fv,ep=E(()=>{"use strict";Wr=n=>String(Math.max(0,n)).padStart(2,"0"),Fv=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=Bv(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=Wr(c),i[1][1].textContent=Wr(l),i[2][1].textContent=Wr(u),i[3][1].textContent=Wr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var tp={};_(tp,{carouselRenderer:()=>Dv});var uo,Dv,np=E(()=>{"use strict";uo=n=>typeof n=="string"&&n?n:void 0,Dv=(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=uo(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(uo(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(uo(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 rp={};_(rp,{productGridRenderer:()=>Hv});var jr,Hv,sp=E(()=>{"use strict";jr=n=>n==null?void 0:String(n),Hv=(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=jr(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=jr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=jr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=jr(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 op={};_(op,{confettiRenderer:()=>qv});function $v(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var ip,qv,ap=E(()=>{"use strict";ip=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];qv=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",$v()||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:ip[h%ip.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 Lt(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 _t(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Kr=E(()=>{"use strict"});var dp={};_(dp,{spinwheelRenderer:()=>Vv});function fo(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 Uv(n,e,t,r,s){let i=fo(n,e,t,s),o=fo(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 lp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var cp,zv,po,Vv,up=E(()=>{"use strict";Kr();cp=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],zv=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};po="http://www.w3.org/2000/svg",Vv=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(zv).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(po,"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,x)=>{let S=e.doc.createElementNS(po,"path");S.setAttribute("d",Uv(c,c,l,x*u,(x+1)*u)),S.setAttribute("fill",cp[x%cp.length]),d.appendChild(S);let w=fo(c,c,l*.62,x*u+u/2),I=e.doc.createElementNS(po,"text");I.setAttribute("x",String(w.x)),I.setAttribute("y",String(w.y)),I.setAttribute("fill","#fff"),I.setAttribute("font-size","10"),I.setAttribute("text-anchor","middle"),I.setAttribute("transform",`rotate(${x*u+u/2} ${w.x} ${w.y})`),I.textContent=b.slice(0,12),d.appendChild(I)});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,x)=>{var I;let S=((I=x!=null?x:r[b])!=null?I:"").slice(0,14);if(lp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=S;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let w=()=>{f.textContent=S};d.addEventListener("transitionend",w,{once:!0}),setTimeout(w,3600)},k=b=>{m=!0,f.disabled=!0,_t(o),lp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(x=>{var w,I,C;if(!x.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,Lt(o,e.doc,x,{onRetry:()=>k(b+1)}),(w=e.onInteraction)==null||w.call(e,"spin_unavailable");return}let S=Math.max(0,Math.min(s-1,Number((I=x.index)!=null?I:0)));(C=e.onInteraction)==null||C.call(e,`spin:${S}`),g(S,x.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){k(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var fp={};_(fp,{scratchRenderer:()=>Wv});function pp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Wv,mp=E(()=>{"use strict";Kr();Wv=(n,e)=>{var k,v;let t=typeof((k=n.props)==null?void 0:k.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){_t(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",Lt(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 x;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.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 x;let b=y.touches[0];if(b){let S=h(b);m(S.x,S.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.call(e,"scratch_reveal"))}}),s}});var hp={};_(hp,{slotRenderer:()=>Gv});function Kv(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var jv,Gv,gp=E(()=>{"use strict";Kr();jv=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Gv=(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:jv,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 k=e.doc.createElement("div");k.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,k.appendChild(y)}g.appendChild(k),a.push(k),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,k)=>{let v=(g.children.length-1)*44;Kv()||(g.style.transition=`transform ${1.6+k*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,_t(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,Lt(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let k=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((x,S)=>{var I,C;let w=x.children[x.children.length-1];w&&(w.textContent=(C=(I=k[S])!=null?I:s[S])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${k.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={};_(bp,{qrRenderer:()=>Qv});function Yv(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 Xv(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 Jv(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 mo,Qv,yp=E(()=>{"use strict";mo="http://www.w3.org/2000/svg";Qv=(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(mo,"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(mo,"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(Xv(f,p)?m=Jv(f,p):f===6||p===6?m=(f+p)%2===0:m=Yv(t,f,p),!m)continue;let h=e.doc.createElementNS(mo,"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 vp={};_(vp,{streakRenderer:()=>Zv});var ho,Zv,wp=E(()=>{"use strict";ho=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Zv=(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,ho(t.days,s.length||7))),o=Math.max(0,Math.min(i,ho(t.filled,0))),a=r?Math.max(0,Math.min(i,ho(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 kp={};_(kp,{nextStepIndex:()=>Sp,stepLabels:()=>xp,stepsRenderer:()=>tw});function xp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=$e(e.backLabel))!=null?t:"Back",skip:(s=(r=$e(e.skipLabel))!=null?r:$e(e.secondaryLabel))!=null?s:"Skip",next:(i=$e(e.nextLabel))!=null?i:"Next",finish:(a=(o=$e(e.finalLabel))!=null?o:$e(e.ctaLabel))!=null?a:"Finish"}}function Sp(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function ew(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=$e(i.title))!=null?o:$e(i.label),body:(a=$e(i.body))!=null?a:$e(i.text)}});return r.length?r:[{}]}var $e,tw,Ep=E(()=>{"use strict";$e=n=>typeof n=="string"&&n.trim()?n.trim():void 0;tw=(n,e)=>{let t=n.props,r=ew(t),s=xp(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,x)=>{let S=i.createElement("button");return S.type="button",S.className=x,S.textContent=b,f.appendChild(S),S},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),k=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var S,w,I;let b=(S=r[o])!=null?S:{};d.textContent=(w=b.title)!=null?w:"",d.style.display=b.title?"":"none",p.textContent=(I=b.body)!=null?I:"",p.style.display=b.body?"":"none";let x=o+1>=r.length;k.textContent=x?s.finish:s.next,h.hidden=o===0,g.hidden=x,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 S;let x=Sp(o,r.length,b);x!==o&&(o=x,v(),(S=e.onInteraction)==null||S.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")}),k.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 Ip(n){let e=new Set;for(let t of n)go[t]&&!Hr[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{Hr[t]=await go[t]()}catch{}}))}var go,kC,Cp=E(()=>{"use strict";qr();go={markdown:()=>Promise.resolve().then(()=>(Vu(),Uu)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(ju(),Wu)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(Xu(),Yu)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(Qu(),Ju)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(ep(),Zu)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(np(),tp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(sp(),rp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(ap(),op)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(up(),dp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(mp(),fp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(gp(),hp)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(yp(),bp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(wp(),vp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Ep(),kp)).then(n=>n.stepsRenderer)},kC=Object.keys(go)});var Ap={};_(Ap,{bannerSurface:()=>nw});function nw(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 Rp=E(()=>{"use strict";Te()});var Tp={};_(Tp,{toastSurface:()=>rw});function rw(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 Mp=E(()=>{"use strict";Te()});function iw(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 Pp(n){return Array.from(n.querySelectorAll(sw)).filter(iw)}function ow(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Ot(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Pp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=ow(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 Gr(n){let e=Pp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Yr(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 Nt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var sw,Xr=E(()=>{"use strict";sw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Lp={};_(Lp,{modalSurface:()=>cw});function cw(n){var h,g,k,v,y,b,x;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Nt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(k=r.role)!=null?k:"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(S=>S.classList.contains("scalebun-h"));if(u){let S=`scalebun-mt-${++aw}`;u.id=S,a.setAttribute("aria-labelledby",S)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let S=e.createElement("button");S.type="button",S.className="scalebun-x scalebun-modal-x",S.setAttribute("aria-label","Close dialog"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),a.appendChild(S)}for(let S of l)a.appendChild(S);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",S=>{S.target===o&&n.requestClose("backdrop")});let d=S=>{S.key==="Escape"&&s.escClose!==!1&&(S.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Ot(a,e),f=(x=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?x:o,m=Yr(f,e);return{el:o,afterMount:()=>Gr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var aw,_p=E(()=>{"use strict";Te();Xr();aw=0});var Fp={};_(Fp,{slideoverSurface:()=>uw});function lw(n,e){try{let t=localStorage.getItem(Bp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Np,Math.max(Op,r)):e}catch{return e}}function dw(n,e){try{localStorage.setItem(Bp(n),String(Math.round(e)))}catch{}}function uw(n){var g,k,v,y,b,x,S,w,I,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((k=t.surfaceOptions)==null?void 0:k.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",(S=(x=t.a11y)==null?void 0:x.labelledBy)!=null?S:t.name);let l=lw(t.id,(I=(w=t.surfaceOptions)==null?void 0:w.maxWidth)!=null?I: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(Np,Math.max(Op,O+D)),u()},m=()=>{dw(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 Op,Np,Bp,Dp=E(()=>{"use strict";Te();Op=280,Np=640,Bp=n=>`scalebun_inapp_slideover_${n}`});function Hp(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function on(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&&on(i,e,t,r)}return r}function bo(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=bo(i,e,!0);if(o)return o}}return null}function pw(n,e,t,r){let s=e.trim(),i=on(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 fw(n,e,t,r){var a,c;let s=e?`[role="${Hp(e)}"]`:"button,a,[role],input,select,textarea,summary",i=on(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 mw(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 hw(n,e,t){var r;switch(n.kind){case"selector":return bo(e,n.value,t);case"data-attr":return bo(e,`[data-scalebun-anchor="${Hp(n.value)}"]`,t);case"nth":return(r=on(e,n.selector,t)[n.index])!=null?r:null;case"text":return pw(e,n.value,n.scope,t);case"aria":return fw(e,n.role,n.name,t);case"xpath":return mw(n.value)}}function $p(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of on(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?hw(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function qp(n){return n.el!=null&&n.strategyIndex>0}var Jr=E(()=>{"use strict"});function yo(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 zp(n,e,t,r,s){let i=(an(n)?t.height:t.width)+s;return yo(n,e,r)>=i}function Qr(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function Zr(n){var h,g,k,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(k=n.arrowSize)!=null?k: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(!zp(c,s,i,o,e)){let y=gw[c];(zp(y,s,i,o,e)||yo(y,s,o)>yo(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&an(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;an(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(an(c)){let y=Qr(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=Qr(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return an(c)?(m.x=Qr(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=Qr(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 gw,an,vo=E(()=>{"use strict";gw={top:"bottom",bottom:"top",left:"right",right:"left"},an=n=>n==="top"||n==="bottom"});var tt,es=E(()=>{"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 bw(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function qe(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 Up(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,Bt=E(()=>{"use strict";Jr();vo();es();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),qp(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=Zr({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:bw(),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 Vp={};_(Vp,{popoverSurface:()=>ww});function yw(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 vw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ww(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=yw(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:qe(r),size:()=>{let f=s.getBoundingClientRect();return{width:f.width||s.offsetWidth||320,height:f.height||s.offsetHeight||120}},preferred:{side:vw(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 Wp=E(()=>{"use strict";Te();Bt()});var jp={};_(jp,{coachmarkSurface:()=>kw});function xw(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 Sw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function kw(n){var p,f,m,h,g,k;let{doc:e,variant:t}=n,r=xw(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:qe(r),size:()=>{let v=a.getBoundingClientRect();return{width:v.width||a.offsetWidth||300,height:v.height||a.offsetHeight||120}},preferred:{side:Sw(n),align:"center"},offset:(k=t.surfaceOptions)==null?void 0:k.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 Kp=E(()=>{"use strict";Te();Bt()});function Ft(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Ft(l,e));if("any"in n)return n.any.some(l=>Ft(l,e));if("not"in n)return!Ft(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 Gp(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Ft(t.when,e))return t.to}return null}var Yp=E(()=>{"use strict"});var Dt,wo=E(()=>{"use strict";Yp();Dt=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&&Ft(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=Gp(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 So(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 xo(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Xp(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 Jp(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 Ew(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&So(xo(n),Xp(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!Jp(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(xo(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 Iw(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&So(xo(n),Xp(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!Jp(n)?"not-clickable":"timeout":"not-found"}function ts(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();Ew(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,Iw(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ns=E(()=>{"use strict"});var Qp={};_(Qp,{tourSurface:()=>Aw});function Cw(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?qe(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 Aw(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 S;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(S=p.step.title)!=null?S:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let w=e.createElement("h2");w.className="scalebun-h",w.textContent=p.step.title,f.appendChild(w)}if(p.step.body){let w=e.createElement("p");w.className="scalebun-text",w.textContent=p.step.body,f.appendChild(w)}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 k=(w,I,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${I}`,M.textContent=w,M.addEventListener("click",C),M};p.index>0&&g.appendChild(k("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(k("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(k(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,x=()=>{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 w=Up(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let I=6;b=new Me({spec:p.step.anchor,size:()=>{let C=f.getBoundingClientRect();return{width:C.width||f.offsetWidth||300,height:C.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-I}px`,y.style.left=`${R.x-I}px`,y.style.width=`${R.width+I*2}px`,y.style.height=`${R.height+I*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(w)},onLost:C=>{var M;x(),(M=n.metrics)==null||M.recordFailedSelector(w),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 Dt({hub:s,resolveAnchor:pt,waitFor:ts,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(ko(p)):localStorage.setItem(ko(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(ko(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(Cw)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var ko,Zp=E(()=>{"use strict";wo();Jr();ns();es();Bt();ko=n=>`scalebun_inapp_tour_${n}`});var ef={};_(ef,{hotspotSurface:()=>Mw});function Rw(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 Tw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Mw(n){let{doc:e,variant:t}=n,r=Rw(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:qe(r),size:()=>{let d=o.getBoundingClientRect();return{width:d.width||o.offsetWidth||240,height:d.height||o.offsetHeight||90}},preferred:{side:Tw(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 tf=E(()=>{"use strict";Te();Bt()});var nf={};_(nf,{toolbarSurface:()=>_w});function Pw(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 Lw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function _w(n){var a,c,l,u;let{doc:e,variant:t}=n,r=Pw(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:qe(r),size:()=>{let d=s.getBoundingClientRect();return{width:d.width||s.offsetWidth||220,height:d.height||s.offsetHeight||80}},preferred:{side:Lw(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 rf=E(()=>{"use strict";Te();Bt()});var sf={};_(sf,{paletteSurface:()=>Ow});function Ow(n){var k,v,y;let{doc:e,variant:t}=n,r=(v=(k=t.surfaceOptions)==null?void 0:k.commands)!=null?v:[],s=Nt(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,x)=>{let S=e.createElement("li");S.className="scalebun-palette-item"+(x===u?" active":""),S.setAttribute("role","option"),S.setAttribute("aria-selected",String(x===u));let w=e.createElement("span");if(w.className="scalebun-palette-label",w.textContent=b.label,S.appendChild(w),b.hint){let I=e.createElement("span");I.className="scalebun-palette-hint",I.textContent=b.hint,S.appendChild(I)}S.addEventListener("mousemove",()=>{u=x,f()}),S.addEventListener("click",()=>d(b)),c.appendChild(S)})},f=()=>{Array.from(c.children).forEach((b,x)=>{b.classList.toggle("active",x===u),b.setAttribute("aria-selected",String(x===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(x=>x.label.toLowerCase().includes(b)||x.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=Ot(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var of=E(()=>{"use strict";Xr()});var af={};_(af,{panelSurface:()=>Nw});function Nw(n){var g,k,v,y,b,x;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=(k=t.a11y)==null?void 0:k.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 S=e.createElement("button");S.type="button",S.className="scalebun-x",S.setAttribute("aria-label","Close panel"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),i.appendChild(S)}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=(x=(b=t.blocks.find(S=>S.kind==="text"))==null?void 0:b.props)==null?void 0:x.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(S,w){let I=e.createElement("div");return I.className=`scalebun-bubble scalebun-bubble-${S}`,I.textContent=w,a.appendChild(I),a.scrollTop=a.scrollHeight,I}let m=S=>{S.preventDefault();let w=u.value.trim();w&&(f("user",w),u.value="",n.hooks.onInteraction(`ai_prompt:${w}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:S=>{var w;p||(p=f("assistant","")),p.textContent=((w=p.textContent)!=null?w:"")+S,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 cf=E(()=>{"use strict"});var df={};_(df,{checklistSurface:()=>Bw});function Bw(n){var x,S,w,I,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((x=r==null?void 0:r.props)==null?void 0:x.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(w=(S=t.blocks.find(R=>R.kind==="heading"))==null?void 0:S.props)==null?void 0:w.text,o=new Set;try{let R=localStorage.getItem(lf(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(lf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(I=t.a11y)==null?void 0:I.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 k=!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&&!k?(k=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(k=!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 lf,uf=E(()=>{"use strict";lf=n=>`scalebun_inapp_checklist_${n}`});var pf={};_(pf,{takeoverSurface:()=>Dw});function Dw(n){var m,h,g,k,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Nt(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-${++Fw}`;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=Ot(o,e),p=(v=(k=n.host.shadowRoot)==null?void 0:k.host)!=null?v:o,f=Yr(p,e);return{el:o,afterMount:()=>Gr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var Fw,ff=E(()=>{"use strict";Te();Xr();Fw=0});var mf={};_(mf,{launcherSurface:()=>Hw});function Hw(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 hf=E(()=>{"use strict"});var yf={};_(yf,{ShadowHost:()=>cn,applyThemeVars:()=>rs,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 rs(n,e){let t=qw[bf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var $w,gf,qw,cn,ss=E(()=>{"use strict";q();$w="scalebun-inapp-host",gf=`
|
|
463
463
|
:host{ all: initial; }
|
|
464
464
|
.layer{
|
|
465
465
|
position: fixed; inset: 0; z-index: 2147483600;
|
|
@@ -480,13 +480,13 @@ ${nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
|
|
|
480
480
|
.zone-anchored{ inset: 0; pointer-events: none; }
|
|
481
481
|
.zone-center{ top: 0; right: 0; }
|
|
482
482
|
@media (prefers-reduced-motion: reduce){ .layer *{ animation: none !important; transition: none !important; } }
|
|
483
|
-
`,
|
|
483
|
+
`,qw={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"}};cn=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=$w,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(gf),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=yt(document.createElement("style"));t.textContent=gf,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=yt(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&&rs(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 vf={};_(vf,{mountInline:()=>Uw});function Uw(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,x;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",rs(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,Dr+zw);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 k=oo({doc:m,hooks:t,requestClose:S=>c(S)});for(let S of $r(e.blocks,k))g.appendChild(S);if((x=e.dismiss)!=null&&x.xButton){let S=m.createElement("button");S.type="button",S.className="scalebun-x",S.setAttribute("aria-label","Dismiss"),S.textContent="\xD7",S.addEventListener("click",()=>c("x")),g.appendChild(S)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=zr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var zw,wf=E(()=>{"use strict";q();ss();so();Te();qr();zw=`
|
|
484
484
|
:host{ display:block; }
|
|
485
485
|
.scalebun-inline{ position:relative; background:var(--scalebun-bg); color:var(--scalebun-fg);
|
|
486
486
|
border:1px solid var(--scalebun-border); border-radius:var(--scalebun-radius); padding:18px; }
|
|
487
487
|
.scalebun-inline .scalebun-x{ position:absolute; top:8px; right:8px; background:none; border:0;
|
|
488
488
|
color:var(--scalebun-muted); cursor:pointer; font-size:16px; border-radius:6px; }
|
|
489
|
-
`});var vf={};O(vf,{SURFACE_LOADERS:()=>Eo,isSurfaceSupported:()=>$w,renderVariant:()=>Io});function $w(n){return n==="inline"||n in Eo}async function Io(n,e,t){var a;let r=Sp(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return yf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(bf(),gf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Eo[n.surface];if(!s)return yf(n.id);let[i]=await Promise.all([s(),r]),o=Du(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function yf(n){return{variantId:n,close:()=>{}}}var Eo,Co=E(()=>{"use strict";Hu();kp();Eo={banner:()=>Promise.resolve().then(()=>(Ip(),Ep)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Ap(),Cp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Mp(),Tp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Np(),_p)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(zp(),$p)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(Vp(),Up)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(Xp(),Yp)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(Qp(),Jp)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(ef(),Zp)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(nf(),tf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(sf(),rf)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(cf(),af)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(df(),lf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(pf(),uf)).then(n=>n.launcherSurface)}});function Sf(n){To=n}function Mo(n){try{Ro==null||Ro(n)}catch{}}function kf(n,e){let t=typeof e=="string"&&e?e:null;return t?zw.has(t)?t:null:n&&Vw[n]||null}function Ef(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 Po(n,e){let t=Ef(e!=null?e:n.spec);return kf(n.variantKey,t)?!0:t?(Ww.has(t)||Mo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Mo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Kw(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Br(n);return!r||!eo(n)?(Mo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=jw[e])!=null?t:null}function Qw(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,_,z,D,te,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:Yw(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:Xw(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(X=>{var ee,T,L;let Y=ae(X);return{image:B((ee=Y.image)!=null?ee:Y.imageUrl),title:pe(X),text:B((L=(T=Y.text)!=null?T:Y.body)!=null?L:Y.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),X=(x=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(k=ie.prompt)!=null?k:ie.question)!=null?v:ie.label))!=null?b:t)!=null?x:"Tell us",Y=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=Y.length?Y:ue(ie,["options","answers","choices"]),T=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((L,N)=>({id:String(N),label:pe(L)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:X}}];case"rating_request":return[{kind:"rating",props:{question:X,max:Ao(Number((S=e.max)!=null?S:e.scale),5)}}];case"emoji_reaction_bar":{let L=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:X,...L.length?{emojis:L}:{}}}]}case"quiz_card":{let L=ae((w=e.outcome)!=null?w:e.quizOutcome),N=B((I=L.answeredId)!=null?I:e.answeredId),F=B((C=L.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:X,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:X,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],X=ie.map((L,N)=>{let F=ae(L);return{id:String(N),label:pe(L),done:F.done===!0||F.checked===!0||F.complete===!0}}),Y=Gw((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:Y}},T=B((z=(_=e.reward)!=null?_:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let L=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ie=>{let Ce=ae(Ie);return Ce.done===!0||Ce.checked===!0||Ce.complete===!0}).length,re=Ao(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ie=>ae(Ie).today===!0),he=[{kind:"streak",props:{mode:L?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Ao(Number((Q=e.days)!=null?Q:e.calendarLength),7)},...L&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let L=Y>=100,N=[ee];return T&&N.push({kind:"callout",props:{icon:L?"\u{1F389}":"\u{1F512}",text:L?T:`Unlock ${T}`}}),N}case"goal_tracker":{let L=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(L)?Number.isFinite(N)?`${L} / ${N}`:L:`${Math.round(Y)}%`,label:(K=B((V=(H=e.goalLabel)!=null?H:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let L=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(L)&&N.push({kind:"stat",props:{value:L,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:X.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:X}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(X=>{var ee,T;let Y=ae(X);return{title:pe(X)||void 0,body:B((T=(ee=Y.body)!=null?ee:Y.text)!=null?T:Y.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return xf(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let X=ue(e,["products","items"]).map(ee=>{var L,N,F;let T=ae(ee);return{id:String((L=T.id)!=null?L:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(ee),price:(F=T.price)!=null?F:T.amount}}),Y=B(e.productTitle);return!X.length&&Y&&X.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:Y,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:X}}),G}default:return xf(e,s)}}function Zw(n,e){var u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,_,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(I=(w=(S=(x=(b=(y=(v=(k=(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?k:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?x:n.instruction)!=null?S:n.instructions)!=null?w:n.closedMessage)!=null?I: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=(te=(D=(z=(_=(A=n.price)!=null?A:n.eventTime)!=null?_: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 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 xf(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 ex(n,e){var f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,_,z,D,te,J;let t=(f=kf(n.variantKey,Ef(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=Uw[t])!=null?m:Kw(r))!=null?h:wf[n.layout])!=null?g:wf.modal,i=B((k=r.sidePosition)!=null?k: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=(I=(w=(S=(x=(b=r.eventTitle)!=null?b:r.passTitle)!=null?x:r.expandedTitle)!=null?S:r.subject)!=null?w:r.vipTitle)!=null?I: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=Zw(r,u);a.push(...d.lead),a.push(...Qw(t,r,l,n.variantKey,u)),a.push(...d.trail);let p=[];return(_=e.cta)!=null&&_.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 nx(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?tx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function rx(n,e){let t=qi(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",$i(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function If(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Co(),vf)),Promise.resolve().then(()=>(ss(),hf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(rx(o,e),nx(o,e));let a=ae(e.ext),c=wu({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...To?{handler:To}:{}});if(c&&mu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=ex(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:Mt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Ao,pe,ue,zw,Uw,Vw,Ro,To,Ww,jw,wf,Gw,Yw,Xw,Jw,tx,Cf=E(()=>{"use strict";zi();xu();to();Qi();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Ao=(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[]},zw=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),Uw={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},Vw={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"},Ro=null,To=null;Ww=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),jw={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}}};wf={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"}}},Gw=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Yw=(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},Xw=n=>{var r;let e=Jw(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}},Jw=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};tx={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 Rf={};O(Rf,{installShakeDetector:()=>ox});function ox(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,k;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Lo,p=((g=u.y)!=null?g:0)/Lo,f=((k=u.z)!=null?k:0)/Lo;if(Math.sqrt(d*d+p*p+f*f)<sx)return;let m=P();if(!(m-e<ix)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Af)}catch{return null}},a=l=>{try{sessionStorage.setItem(Af,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 sx,ix,Lo,Af,Tf=E(()=>{"use strict";$();sx=2.3,ix=1500,Lo=9.80665,Af="scalebun_shake_perm"});var Mf={};O(Mf,{EngageRuntime:()=>Oo});var Oo,Pf=E(()=>{"use strict";Ud();Hi();uu();pu();Cf();Fe();Oo=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 en(r=>this.tryShow(r)),this.inapp=new en(r=>this.tryShowInApp(r)),Sf((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(()=>(Tf(),Rf));(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||!Fi(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&&Di(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),Po(r,s)){this.showRich(r,s,i,!0);return}this.active=Yi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finish()},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finish()}})}showRich(e,t,r,s=!1){If(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finish()}}).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}}tryShowInApp(e){if(this.showing||!Er(e,this.deps.now()))return;this.showing=!0,Ir(e,this.deps.now());let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),Po(e,t)){this.showRich(e,t,r);return}this.active=Yi(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finish()}})}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||!Er(e,this.deps.now())||(this.showing=!0,this.startedAt=this.deps.now(),Ir(e,this.deps.now()),this.beacon(e,"shown"),this.event(e,"impression"),this.active=du(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;Bi(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])}}});var _f,we,_o=E(()=>{"use strict";_f={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 No={};O(No,{mountInbox:()=>gx});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function mx(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 hx(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)"),k=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"),x=l("gap","11px"),S=l("z","2147483600"),w=M=>l("radius",M),I=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
|
|
489
|
+
`});var Sf={};_(Sf,{SURFACE_LOADERS:()=>Eo,isSurfaceSupported:()=>Vw,renderVariant:()=>Io});function Vw(n){return n==="inline"||n in Eo}async function Io(n,e,t){var a;let r=Ip(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,xf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(wf(),vf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Eo[n.surface];if(!s)return await r,xf(n.id);let[i]=await Promise.all([s(),r]),o=qu(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function xf(n){return{variantId:n,close:()=>{}}}var Eo,Co=E(()=>{"use strict";zu();Cp();Eo={banner:()=>Promise.resolve().then(()=>(Rp(),Ap)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Mp(),Tp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(_p(),Lp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Dp(),Fp)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(Wp(),Vp)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(Kp(),jp)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(Zp(),Qp)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(tf(),ef)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(rf(),nf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(of(),sf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(cf(),af)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(uf(),df)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(ff(),pf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(hf(),mf)).then(n=>n.launcherSurface)}});function If(n){To=n}function Mo(n){try{Ro==null||Ro(n)}catch{}}function Cf(n,e){let t=typeof e=="string"&&e?e:null;return t?Ww.has(t)?t:null:n&&Kw[n]||null}function Af(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 Po(n,e){let t=Af(e!=null?e:n.spec);return Cf(n.variantKey,t)?!0:t?(Gw.has(t)||Mo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Mo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Xw(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Br(n);return!r||!eo(n)?(Mo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=Yw[e])!=null?t:null}function tx(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,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:Qw(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:Zw(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(X=>{var ee,T,L;let Y=ae(X);return{image:B((ee=Y.image)!=null?ee:Y.imageUrl),title:pe(X),text:B((L=(T=Y.text)!=null?T:Y.body)!=null?L:Y.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),X=(x=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(k=ie.prompt)!=null?k:ie.question)!=null?v:ie.label))!=null?b:t)!=null?x:"Tell us",Y=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=Y.length?Y:ue(ie,["options","answers","choices"]),T=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((L,N)=>({id:String(N),label:pe(L)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:X}}];case"rating_request":return[{kind:"rating",props:{question:X,max:Ao(Number((S=e.max)!=null?S:e.scale),5)}}];case"emoji_reaction_bar":{let L=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:X,...L.length?{emojis:L}:{}}}]}case"quiz_card":{let L=ae((w=e.outcome)!=null?w:e.quizOutcome),N=B((I=L.answeredId)!=null?I:e.answeredId),F=B((C=L.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:X,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:X,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],X=ie.map((L,N)=>{let F=ae(L);return{id:String(N),label:pe(L),done:F.done===!0||F.checked===!0||F.complete===!0}}),Y=Jw((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:Y}},T=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let L=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ie=>{let Ce=ae(Ie);return Ce.done===!0||Ce.checked===!0||Ce.complete===!0}).length,re=Ao(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ie=>ae(Ie).today===!0),he=[{kind:"streak",props:{mode:L?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Ao(Number((Q=e.days)!=null?Q:e.calendarLength),7)},...L&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let L=Y>=100,N=[ee];return T&&N.push({kind:"callout",props:{icon:L?"\u{1F389}":"\u{1F512}",text:L?T:`Unlock ${T}`}}),N}case"goal_tracker":{let L=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(L)?Number.isFinite(N)?`${L} / ${N}`:L:`${Math.round(Y)}%`,label:(K=B((V=(H=e.goalLabel)!=null?H:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let L=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(L)&&N.push({kind:"stat",props:{value:L,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:X.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:X}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(X=>{var ee,T;let Y=ae(X);return{title:pe(X)||void 0,body:B((T=(ee=Y.body)!=null?ee:Y.text)!=null?T:Y.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return Ef(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let X=ue(e,["products","items"]).map(ee=>{var L,N,F;let T=ae(ee);return{id:String((L=T.id)!=null?L:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(ee),price:(F=T.price)!=null?F:T.amount}}),Y=B(e.productTitle);return!X.length&&Y&&X.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:Y,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:X}}),G}default:return Ef(e,s)}}function nx(n,e){var u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(I=(w=(S=(x=(b=(y=(v=(k=(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?k:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?x:n.instruction)!=null?S:n.instructions)!=null?w:n.closedMessage)!=null?I: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=(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 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 Ef(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 rx(n,e){var f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J;let t=(f=Cf(n.variantKey,Af(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=jw[t])!=null?m:Xw(r))!=null?h:kf[n.layout])!=null?g:kf.modal,i=B((k=r.sidePosition)!=null?k: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=(I=(w=(S=(x=(b=r.eventTitle)!=null?b:r.passTitle)!=null?x:r.expandedTitle)!=null?S:r.subject)!=null?w:r.vipTitle)!=null?I: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=nx(r,u);a.push(...d.lead),a.push(...tx(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 ix(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?sx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function ox(n,e){let t=$i(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",qi(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function Rf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Co(),Sf)),Promise.resolve().then(()=>(ss(),yf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(ox(o,e),ix(o,e));let a=ae(e.ext),c=ku({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...To?{handler:To}:{}});if(c&&bu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=rx(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:Mt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Ao,pe,ue,Ww,jw,Kw,Ro,To,Gw,Yw,kf,Jw,Qw,Zw,ex,sx,Tf=E(()=>{"use strict";zi();Eu();to();Qi();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Ao=(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[]},Ww=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),jw={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},Kw={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"},Ro=null,To=null;Gw=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),Yw={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}}};kf={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"}}},Jw=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Qw=(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},Zw=n=>{var r;let e=ex(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}},ex=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};sx={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 Pf={};_(Pf,{installShakeDetector:()=>lx});function lx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,k;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Lo,p=((g=u.y)!=null?g:0)/Lo,f=((k=u.z)!=null?k:0)/Lo;if(Math.sqrt(d*d+p*p+f*f)<ax)return;let m=P();if(!(m-e<cx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Mf)}catch{return null}},a=l=>{try{sessionStorage.setItem(Mf,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 ax,cx,Lo,Mf,Lf=E(()=>{"use strict";q();ax=2.3,cx=1500,Lo=9.80665,Mf="scalebun_shake_perm"});var _f={};_(_f,{EngageRuntime:()=>_o});var _o,Of=E(()=>{"use strict";jd();Hi();mu();hu();Tf();Fe();_o=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 en(r=>this.tryShow(r)),this.inapp=new en(r=>this.tryShowInApp(r)),If((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(()=>(Lf(),Pf));(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||!Fi(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&&Di(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),Po(r,s)){this.showRich(r,s,i,!0);return}this.active=Yi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finish()},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finish()}})}showRich(e,t,r,s=!1){Rf(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finish()}}).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}}tryShowInApp(e){if(this.showing||!Er(e,this.deps.now()))return;this.showing=!0,Ir(e,this.deps.now());let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),Po(e,t)){this.showRich(e,t,r);return}this.active=Yi(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finish()}})}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||!Er(e,this.deps.now())||(this.showing=!0,this.startedAt=this.deps.now(),Ir(e,this.deps.now()),this.beacon(e,"shown"),this.event(e,"impression"),this.active=fu(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;Bi(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])}}});var Ff,we,Oo=E(()=>{"use strict";Ff={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 No={};_(No,{mountInbox:()=>vx});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function bx(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 yx(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)"),k=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"),x=l("gap","11px"),S=l("z","2147483600"),w=M=>l("radius",M),I=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
|
|
490
490
|
:host{all:initial;direction:${t?"rtl":"ltr"};${C}}
|
|
491
491
|
*{box-sizing:border-box;font-family:${v}}
|
|
492
492
|
button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h};outline-offset:2px}
|
|
@@ -569,7 +569,7 @@ ${r!=="dropdown"?"":`
|
|
|
569
569
|
cursor:pointer;padding:8px;border-radius:${I("8px")}}
|
|
570
570
|
.foot button:hover{background:${m}}
|
|
571
571
|
`}
|
|
572
|
-
@media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function gx(n,e,t){var G,ie,X,Y,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"&&Nf(e.trigger)?"dropdown":"drawer",a=e.accent,c={..._f,...(X=t==null?void 0:t.labels)!=null?X:{},...(Y=e.labels)!=null?Y:{}},l=(ee=e.formatTime)!=null?ee:mx,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox","");let p=d.attachShadow({mode:"open"});Ne(p,hx(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"),k=Z("div","ti",c.title),v=Z("div","mt");g.append(k,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 x=Z("div","body"),S=Z("div","live");if(S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),m.append(h,b,x,S),e.onViewAll){let T=Z("div","foot"),L=document.createElement("button");L.type="button",L.textContent=c.viewAll,L.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(L),m.appendChild(T)}p.append(f,m);let w,I,C=Nf(e.trigger);C||(w=document.createElement("button"),w.className="bell",w.type="button",w.setAttribute("aria-label",c.open),w.setAttribute("aria-expanded","false"),w.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?w.textContent=e.icon:e.icon?w.appendChild(e.icon):w.innerHTML=fx,I=document.createElement("span"),I.className="badge",I.setAttribute("aria-hidden","true"),w.appendChild(I),p.appendChild(w));let M=C!=null?C:w,R=!1,A=null,_=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),L=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-L:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-L-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 L,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),w==null||w.setAttribute("aria-expanded",String(T)),T?(A=(N=(L=p.activeElement)!=null?L:M)!=null?N:null,_=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();w==null||w.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 L=xe(),N=L[0],F=L[L.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 L=T.unreadCount;I&&(I.textContent=L>99?"99+":String(L),I.classList.toggle("on",L>0)),v.textContent=L>0?c.unread(L):c.noUnread,w&&w.setAttribute("aria-label",L>0?c.openUnread(L):c.open),R&&Ve()}),le=null;function H(){let T=Z("div","empty");return T.appendChild(Z("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,L,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",L),F.title=L,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ie,Ce;let L=Z("div","row"+(T.state==="unread"?" unread":""));L.setAttribute("role","listitem"),L.tabIndex=0,L.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),L.dataset.id=T.id,L.appendChild(Z("span","dot"));let N=Z("div","ic");if(T.iconUrl){let Ae=document.createElement("img");Ae.src=T.iconUrl,Ae.alt="",N.appendChild(Ae)}else N.textContent=((Ie=(he=T.category)==null?void 0:he[0])!=null?Ie:"\u2022").toUpperCase();L.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)),(Ce=T.cta)!=null&&Ce.length){let Ae=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)}),Ae.appendChild(ke)}),F.appendChild(Ae)}L.appendChild(F);let re=Z("div","ract"),ge=V(dx,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(ux,c.archive,()=>void n.archive(T.id)),V(px,c.delete,()=>void n.remove(T.id))),L.appendChild(re),L.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),L}function de(T){var re,ge,he;let L=T.target.closest(".row");if(!L)return;let N=[...x.querySelectorAll(".row")],F=N.indexOf(L),W=L.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))}x.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let L=(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(L(c.allTab,null));for(let N of T)b.appendChild(L(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ie,Ce,Ae,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let L=(Ce=(Ie=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ie.call(he,".row"))==null?void 0:Ce.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,(Ae=e.maxItems)!=null?Ae:5):1/0,re=F.length>W?F.slice(0,W):F;if(x.textContent="",!re.length){x.appendChild(H()),S.textContent=c.emptyAnnounce,_&&(_=!1,y.focus());return}let ge=Z("div","list");ge.setAttribute("role","list");for(let ke of re)ge.appendChild(K(ke));x.appendChild(ge),S.textContent=`${F.length} notification${F.length===1?"":"s"}`,_?(_=!1,((Je=x.querySelector(".row"))!=null?Je:y).focus()):L&&((st=x.querySelector(`.row[data-id="${L}"]`))==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),x.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Nf(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var dx,ux,px,fx,Bo=E(()=>{"use strict";$();_o();dx='<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>',ux='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',px='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',fx='<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 Bf={};O(Bf,{InboxStore:()=>ln,NOOP_STORE:()=>Fo});function yx(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(bx+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 bx,ze,nt,ln,Fo,Do=E(()=>{"use strict";bx="scalebun_inbox_",ze="messages",nt="meta";ln=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=yx(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()}})}},Fo={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var Ff={};O(Ff,{InboxSync:()=>Ho,InboxTransport:()=>qo,mergeMessage:()=>$o,stateRank:()=>xx});function $o(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 wx)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 xx(n){return vx[n]}var vx,wx,Ho,qo,zo=E(()=>{"use strict";Cn();vx={unread:0,read:1,archived:2,deleted:3},wx=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];Ho=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")}}},qo=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 qf={};O(qf,{InboxRuntime:()=>Uo});function Hf(n){return`${n.createdAt}_${n.id}`}var Df,Sx,Uo,$f=E(()=>{"use strict";_o();Do();zo();Df={unread:0,read:1,archived:2,deleted:3},Sx=20;Uo=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 ln(e.scope):Fo}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)&&Df[t]<=Df[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=>Hf(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:Sx,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?Hf(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=$o(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}}});function Vo(n){return n>=200?"critical":n>=100?"warning":"info"}function Wo(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 jo(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 Ko=E(()=>{"use strict"});var Vf={};O(Vf,{startCollectors:()=>Ix});function Ix(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,Uf)}},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=jo(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(k=>{var v;for(let y of k.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Ex||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Vo(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,Go);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<kx)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=Wo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,Go)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,Go),performance.memory&&(i=setTimeout(a,Uf)),()=>{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 kx,Go,Ex,Uf,Wf=E(()=>{"use strict";Ko();kx=5e3,Go=25e3,Ex=50,Uf=3e4});function Yo(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function jf(n,e=10){if(!Yo())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 Kf=E(()=>{"use strict"});function Jf(n){return n?{...Gf,...n}:Gf}var Gf,Yf,Xf,Xo=E(()=>{"use strict";Gf={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},Yf=10*6e4,Xf=10});function Rx(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var ds,ls,Qf=E(()=>{"use strict";Xo();ds=class ds{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>ds.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=Rx([...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<Yf),this.emitTimes.length>=Xf){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};ds.LAG_RING=32;ls=ds});function Zf(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var us,em=E(()=>{"use strict";$();us=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(Zf(r,.5)),lagP95:Math.round(Zf(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 tm(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function nm(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=()=>{tm()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),tm()&&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 rm=E(()=>{"use strict";$()});var sm={};O(sm,{startWatchdog:()=>_x});function Mx(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 Px(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function _x(n){var k,v,y,b;let e=(k=n.watchdogOptions)!=null?k:{};if(!Mx(n.sessionId,e.sampleRate))return Tx;let t=(x,S,w,I)=>{let C=ne();n.emit({kind:"performance",metric:x,value:S,screenName:Px(),metadata:C?{...w,replay:C}:w,clientId:I!=null?I:`wd_${q()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=x=>{if(!r||s||!Yo())return;let S=P();S-i<Ox||(i=S,s=!0,jf(Lx).then(w=>{w&&t("js_profile",w.samples,{profile:w.profile,format:"w3c-js-self-profiling",incidentClientId:x})}).finally(()=>{s=!1}))},a=Jf(e.thresholds),c=new us,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new ls({thresholds:a,now:P,pressureAvailable:d,onIncident:x=>{var w;l++,c.noteIncident();let S=`wd_${q()}`;t("resource_incident",(w=x.value)!=null?w:1,x,S),n.signal("resource_pressure"),o(S)}}),f=dd(x=>p.onJank(x)),m=nm({onHeartbeat:x=>{p.onHeartbeat(x),c.onHeartbeat(x)},onPressure:x=>{p.onPressure(x),c.onPressure(x)},onMemory:(x,S)=>{p.onMemory(x,S),c.onMemory(x)}},{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 x=c.drain(h(),p.dropped);t("resource_health",x.lagP95,x)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var Tx,Lx,Ox,im=E(()=>{"use strict";$();Fe();ki();Kf();Qf();em();rm();Xo();Tx={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};Lx=1e4,Ox=6e4});var pm={};O(pm,{EXIT_THRESHOLD:()=>am,EXIT_WEIGHTS:()=>om,REVERSAL_DEFAULTS:()=>Qo,ScrollReversalDetector:()=>fs,canFire:()=>um,isTopExit:()=>lm,reversalMetrics:()=>dm,startExitIntent:()=>Dx});function lm(n,e,t=cm){return n&&e<=t}function dm(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 um(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:Fx)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Bx))}function Dx(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...Qo,...e!=null?e:{}},i=new fs(s),o=()=>{try{return kt(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=om[u];if(p===void 0||p<am||!um(Jo(),r,t))return;t++,r=Jo();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=>{lm(!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,Jo(),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 om,am,Bx,Fx,cm,Qo,fs,Jo,fm=E(()=>{"use strict";On();om={top_exit:.8,scroll_reversal:.5},am=.5,Bx=3e4,Fx=3,cm=40,Qo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:cm};fs=class{constructor(e=Qo){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=dm(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)}};Jo=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function Hx(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function qx(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var mm,Zo,hs,hm=E(()=>{"use strict";mm="scalebun_inapp_outbox";Zo=class{constructor(e,t=qx()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=Hx((s=(r=this.storage)==null?void 0:r.getItem(mm))!=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(mm,JSON.stringify(this.queue))}catch{}}};hs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Zo(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 $x(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 ea(n,e){return!n||n.length===0?!0:n.some(t=>$x(t).test(e))}function zx(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 Vx(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function Wx(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return Vx(e).has(t.slice(8).trim());for(let s of Ux){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 jx(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>Wx(t,e))}function bm(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return ea(r.route,e.route)?zx(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"}:jx(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 Kx(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var Ux,gm,gs,ta=E(()=>{"use strict";ns();Ux=[">=","<=","!=","=",">","<"];gm="scalebun_inapp_freq",gs=class{constructor(e=Kx()){this.storage=e;this.map=this.load()}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(gm);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(gm,JSON.stringify(this.map))}catch{}}canShow(e,t){var i;let r=e.frequency,s=this.map[e.id];return s?!(s.dismissed&&((i=e.dismiss)!=null&&i.persistDismiss)||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 s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save()}recordDismiss(e,t){var s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save()}clear(){this.map={},this.save()}}});var ym=E(()=>{"use strict"});function vm(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return ea(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 wm(){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 xm(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Sm(){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 bs,km=E(()=>{"use strict";ta();ym();bs=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 Xx(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return Gx[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=Yx[n.category])!=null?s:0)}function Im(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:Xx(b,s)})).sort((b,x)=>x.score-b.score||b.c.id.localeCompare(x.c.id)),o=[],a=(b,x,S,w,I)=>o.push({id:b.id,action:x,reason:S,zone:b.zone,score:w,preempts:I}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>ys(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,k=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:x}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",x);continue}c.set(b.campaignId,x)}let S=(y=r.guard)==null?void 0:y.call(r,b);if(S){a(b,S.action,S.reason,x);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",x);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",x);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",x);continue}if(ys(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",x);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",x);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",x);continue}if(b.zone==="modal"&&k>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",x);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",x);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",x);continue}}let I;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!ys(M.zone)&&Em[M.tier]<Em.critical);C&&(I=C.id)}a(b,I?"PREEMPT":"SHOW",I?"preempt:critical":"show",x,I),l.set(b.zone,b.id),b.zone==="toast"&&d++,ys(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&k++,f=!0,v=s)}return o}var Gx,Yx,Em,ys,Cm=E(()=>{"use strict";Gx={critical:1e3,high:400,normal:200,low:100,passive:50},Yx={security:300,system:250,billing:200},Em={critical:4,high:3,normal:2,low:1,passive:0};ys=n=>n==="modal"||n==="takeover"});function Jx(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 Qx(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 Zx(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 eS(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 tS(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=Jx(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:Qx(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:Zx(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:eS(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function Am(n,e={}){return(n!=null?n:[]).map(t=>tS(t,e))}var Rm=E(()=>{"use strict"});function nS(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Tm(n){var r;let e=nS(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...Am(n.legacyMessages)),t.filter(ku)}var Mm=E(()=>{"use strict";Rm();Fr()});var Pm={};O(Pm,{InAppEngine:()=>na});var rS,na,Lm=E(()=>{"use strict";hm();km();ta();Cm();Mm();ss();Zi();Co();Fr();_i();rS=120,na=class{constructor(e){this.deps=e;this.freq=new gs;this.host=new cn;this.slots=new Tt;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.transport=new hs(e.apiBaseUrl,e.clientKey),this.bus=new bs(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=Oi(e),r=e==null?void 0:e.variants;this.variants=Tm({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(wm()),this.bus.use(xm()),this.bus.use(Sm()),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=>vm(s,e))&&bm(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:Pt(e),focus:no[e.surface],cost:ro[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()},rS))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Im(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 Io(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Pt(e),focus:no[e.surface],tier:e.priority},surface:i});let o=ro[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Pt(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 sa={};O(sa,{SegmentBuffer:()=>ra,approxBytes:()=>dn});function dn(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 ra,ws=E(()=>{"use strict";ra=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=dn(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=dn(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}}});function sS(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function Om(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 xs,_m=E(()=>{"use strict";xs=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 ia(n){let e=n;for(let t of oS)e=e.replace(t,iS);return e}function Nm(n){let e=n.snapshot;e&&typeof e=="object"&&Ss(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)aS(r)}function Ss(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=ia(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=ia(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)Ss(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)Ss(t)}function aS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=ia(n.value)),n.op==="add"&&n.node&&Ss(n.node)}var iS,oS,Bm=E(()=>{"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 Hm={};O(Hm,{deviceMemoryGB:()=>Dm,networkHint:()=>Fm,shouldDeferHeavyEgress:()=>oa,userOptedOutOfTracking:()=>lS});function cS(){if(typeof navigator!="undefined")return navigator.connection}function Fm(){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 Dm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function oa(){let n=Fm();if(n.saveData||n.slow)return!0;let e=Dm();return typeof e=="number"&&e<=1}var aa=E(()=>{"use strict"});function ca(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(qm);return n||(n=`t_${q()}`,sessionStorage.setItem(qm,n)),n}}catch{}return ks!=null?ks:ks=`t_${q()}`}function la(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function da(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var qm,ks,$m=E(()=>{"use strict";$();qm="scalebun_replay_tab"});var pa={};O(pa,{GZ_PREFIX:()=>un,ReplayEncoder:()=>ua,decodeSnapshotValue:()=>uS,gunzipBase64:()=>Um,gzipBase64:()=>zm});async function zm(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 Um(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(un)?JSON.parse(await Um(n.slice(un.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 un,dS,ua,fa=E(()=>{"use strict";un="gz:",dS=`
|
|
572
|
+
@media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function vx(n,e,t){var G,ie,X,Y,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"&&Df(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Ff,...(X=t==null?void 0:t.labels)!=null?X:{},...(Y=e.labels)!=null?Y:{}},l=(ee=e.formatTime)!=null?ee:bx,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox","");let p=d.attachShadow({mode:"open"});Ne(p,yx(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"),k=Z("div","ti",c.title),v=Z("div","mt");g.append(k,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 x=Z("div","body"),S=Z("div","live");if(S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),m.append(h,b,x,S),e.onViewAll){let T=Z("div","foot"),L=document.createElement("button");L.type="button",L.textContent=c.viewAll,L.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(L),m.appendChild(T)}p.append(f,m);let w,I,C=Df(e.trigger);C||(w=document.createElement("button"),w.className="bell",w.type="button",w.setAttribute("aria-label",c.open),w.setAttribute("aria-expanded","false"),w.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?w.textContent=e.icon:e.icon?w.appendChild(e.icon):w.innerHTML=gx,I=document.createElement("span"),I.className="badge",I.setAttribute("aria-hidden","true"),w.appendChild(I),p.appendChild(w));let M=C!=null?C:w,R=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),L=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-L:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-L-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 L,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),w==null||w.setAttribute("aria-expanded",String(T)),T?(A=(N=(L=p.activeElement)!=null?L:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();w==null||w.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 L=xe(),N=L[0],F=L[L.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 L=T.unreadCount;I&&(I.textContent=L>99?"99+":String(L),I.classList.toggle("on",L>0)),v.textContent=L>0?c.unread(L):c.noUnread,w&&w.setAttribute("aria-label",L>0?c.openUnread(L):c.open),R&&Ve()}),le=null;function H(){let T=Z("div","empty");return T.appendChild(Z("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,L,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",L),F.title=L,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ie,Ce;let L=Z("div","row"+(T.state==="unread"?" unread":""));L.setAttribute("role","listitem"),L.tabIndex=0,L.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),L.dataset.id=T.id,L.appendChild(Z("span","dot"));let N=Z("div","ic");if(T.iconUrl){let Ae=document.createElement("img");Ae.src=T.iconUrl,Ae.alt="",N.appendChild(Ae)}else N.textContent=((Ie=(he=T.category)==null?void 0:he[0])!=null?Ie:"\u2022").toUpperCase();L.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)),(Ce=T.cta)!=null&&Ce.length){let Ae=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)}),Ae.appendChild(ke)}),F.appendChild(Ae)}L.appendChild(F);let re=Z("div","ract"),ge=V(fx,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(mx,c.archive,()=>void n.archive(T.id)),V(hx,c.delete,()=>void n.remove(T.id))),L.appendChild(re),L.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),L}function de(T){var re,ge,he;let L=T.target.closest(".row");if(!L)return;let N=[...x.querySelectorAll(".row")],F=N.indexOf(L),W=L.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))}x.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let L=(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(L(c.allTab,null));for(let N of T)b.appendChild(L(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ie,Ce,Ae,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let L=(Ce=(Ie=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ie.call(he,".row"))==null?void 0:Ce.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,(Ae=e.maxItems)!=null?Ae:5):1/0,re=F.length>W?F.slice(0,W):F;if(x.textContent="",!re.length){x.appendChild(H()),S.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));x.appendChild(ge),S.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=x.querySelector(".row"))!=null?Je:y).focus()):L&&((st=x.querySelector(`.row[data-id="${L}"]`))==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),x.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Df(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var fx,mx,hx,gx,Bo=E(()=>{"use strict";q();Oo();fx='<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>',mx='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',hx='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',gx='<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 Hf={};_(Hf,{InboxStore:()=>ln,NOOP_STORE:()=>Fo});function xx(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(wx+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 wx,ze,nt,ln,Fo,Do=E(()=>{"use strict";wx="scalebun_inbox_",ze="messages",nt="meta";ln=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=xx(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()}})}},Fo={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var $f={};_($f,{InboxSync:()=>Ho,InboxTransport:()=>$o,mergeMessage:()=>qo,stateRank:()=>Ex});function qo(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 kx)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 Ex(n){return Sx[n]}var Sx,kx,Ho,$o,zo=E(()=>{"use strict";Cn();Sx={unread:0,read:1,archived:2,deleted:3},kx=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];Ho=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")}}},$o=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 Uf={};_(Uf,{InboxRuntime:()=>Uo});function zf(n){return`${n.createdAt}_${n.id}`}var qf,Ix,Uo,Vf=E(()=>{"use strict";Oo();Do();zo();qf={unread:0,read:1,archived:2,deleted:3},Ix=20;Uo=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 ln(e.scope):Fo}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)&&qf[t]<=qf[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=>zf(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:Ix,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?zf(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=qo(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}}});function Vo(n){return n>=200?"critical":n>=100?"warning":"info"}function Wo(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 jo(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 Ko=E(()=>{"use strict"});var Kf={};_(Kf,{startCollectors:()=>Rx});function Rx(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,jf)}},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=jo(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(k=>{var v;for(let y of k.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Ax||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Vo(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,Go);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Cx)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=Wo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,Go)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,Go),performance.memory&&(i=setTimeout(a,jf)),()=>{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 Cx,Go,Ax,jf,Gf=E(()=>{"use strict";Ko();Cx=5e3,Go=25e3,Ax=50,jf=3e4});function Yo(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function Yf(n,e=10){if(!Yo())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 Xf=E(()=>{"use strict"});function em(n){return n?{...Jf,...n}:Jf}var Jf,Qf,Zf,Xo=E(()=>{"use strict";Jf={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},Qf=10*6e4,Zf=10});function Px(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var ds,ls,tm=E(()=>{"use strict";Xo();ds=class ds{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>ds.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=Px([...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<Qf),this.emitTimes.length>=Zf){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};ds.LAG_RING=32;ls=ds});function nm(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var us,rm=E(()=>{"use strict";q();us=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(nm(r,.5)),lagP95:Math.round(nm(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 sm(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function im(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=()=>{sm()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),sm()&&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 om=E(()=>{"use strict";q()});var am={};_(am,{startWatchdog:()=>Fx});function _x(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 Ox(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Fx(n){var k,v,y,b;let e=(k=n.watchdogOptions)!=null?k:{};if(!_x(n.sessionId,e.sampleRate))return Lx;let t=(x,S,w,I)=>{let C=ne();n.emit({kind:"performance",metric:x,value:S,screenName:Ox(),metadata:C?{...w,replay:C}:w,clientId:I!=null?I:`wd_${$()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=x=>{if(!r||s||!Yo())return;let S=P();S-i<Bx||(i=S,s=!0,Yf(Nx).then(w=>{w&&t("js_profile",w.samples,{profile:w.profile,format:"w3c-js-self-profiling",incidentClientId:x})}).finally(()=>{s=!1}))},a=em(e.thresholds),c=new us,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new ls({thresholds:a,now:P,pressureAvailable:d,onIncident:x=>{var w;l++,c.noteIncident();let S=`wd_${$()}`;t("resource_incident",(w=x.value)!=null?w:1,x,S),n.signal("resource_pressure"),o(S)}}),f=fd(x=>p.onJank(x)),m=im({onHeartbeat:x=>{p.onHeartbeat(x),c.onHeartbeat(x)},onPressure:x=>{p.onPressure(x),c.onPressure(x)},onMemory:(x,S)=>{p.onMemory(x,S),c.onMemory(x)}},{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 x=c.drain(h(),p.dropped);t("resource_health",x.lagP95,x)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var Lx,Nx,Bx,cm=E(()=>{"use strict";q();Fe();ki();Xf();tm();rm();om();Xo();Lx={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};Nx=1e4,Bx=6e4});var hm={};_(hm,{EXIT_THRESHOLD:()=>dm,EXIT_WEIGHTS:()=>lm,REVERSAL_DEFAULTS:()=>Qo,ScrollReversalDetector:()=>fs,canFire:()=>mm,isTopExit:()=>pm,reversalMetrics:()=>fm,startExitIntent:()=>qx});function pm(n,e,t=um){return n&&e<=t}function fm(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 mm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:$x)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Hx))}function qx(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...Qo,...e!=null?e:{}},i=new fs(s),o=()=>{try{return kt(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=lm[u];if(p===void 0||p<dm||!mm(Jo(),r,t))return;t++,r=Jo();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=>{pm(!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,Jo(),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 lm,dm,Hx,$x,um,Qo,fs,Jo,gm=E(()=>{"use strict";_n();lm={top_exit:.8,scroll_reversal:.5},dm=.5,Hx=3e4,$x=3,um=40,Qo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:um};fs=class{constructor(e=Qo){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=fm(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)}};Jo=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function zx(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Ux(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var bm,Zo,hs,ym=E(()=>{"use strict";bm="scalebun_inapp_outbox";Zo=class{constructor(e,t=Ux()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=zx((s=(r=this.storage)==null?void 0:r.getItem(bm))!=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(bm,JSON.stringify(this.queue))}catch{}}};hs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Zo(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 Vx(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 ea(n,e){return!n||n.length===0?!0:n.some(t=>Vx(t).test(e))}function Wx(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 Kx(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function Gx(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return Kx(e).has(t.slice(8).trim());for(let s of jx){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 Yx(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>Gx(t,e))}function wm(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return ea(r.route,e.route)?Wx(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"}:Yx(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 Xx(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var jx,vm,gs,ta=E(()=>{"use strict";ns();jx=[">=","<=","!=","=",">","<"];vm="scalebun_inapp_freq",gs=class{constructor(e=Xx()){this.storage=e;this.map=this.load()}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(vm);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(vm,JSON.stringify(this.map))}catch{}}canShow(e,t){var i;let r=e.frequency,s=this.map[e.id];return s?!(s.dismissed&&((i=e.dismiss)!=null&&i.persistDismiss)||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 s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save()}recordDismiss(e,t){var s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save()}clear(){this.map={},this.save()}}});var xm=E(()=>{"use strict"});function Sm(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return ea(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 km(){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 Em(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Im(){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 bs,Cm=E(()=>{"use strict";ta();xm();bs=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 Zx(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return Jx[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=Qx[n.category])!=null?s:0)}function Rm(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:Zx(b,s)})).sort((b,x)=>x.score-b.score||b.c.id.localeCompare(x.c.id)),o=[],a=(b,x,S,w,I)=>o.push({id:b.id,action:x,reason:S,zone:b.zone,score:w,preempts:I}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>ys(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,k=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:x}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",x);continue}c.set(b.campaignId,x)}let S=(y=r.guard)==null?void 0:y.call(r,b);if(S){a(b,S.action,S.reason,x);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",x);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",x);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",x);continue}if(ys(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",x);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",x);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",x);continue}if(b.zone==="modal"&&k>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",x);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",x);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",x);continue}}let I;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!ys(M.zone)&&Am[M.tier]<Am.critical);C&&(I=C.id)}a(b,I?"PREEMPT":"SHOW",I?"preempt:critical":"show",x,I),l.set(b.zone,b.id),b.zone==="toast"&&d++,ys(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&k++,f=!0,v=s)}return o}var Jx,Qx,Am,ys,Tm=E(()=>{"use strict";Jx={critical:1e3,high:400,normal:200,low:100,passive:50},Qx={security:300,system:250,billing:200},Am={critical:4,high:3,normal:2,low:1,passive:0};ys=n=>n==="modal"||n==="takeover"});function eS(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 tS(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 nS(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 rS(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 sS(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=eS(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:tS(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:nS(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:rS(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function Mm(n,e={}){return(n!=null?n:[]).map(t=>sS(t,e))}var Pm=E(()=>{"use strict"});function iS(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Lm(n){var r;let e=iS(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...Mm(n.legacyMessages)),t.filter(Cu)}var _m=E(()=>{"use strict";Pm();Fr()});var Om={};_(Om,{InAppEngine:()=>na});var oS,na,Nm=E(()=>{"use strict";ym();Cm();ta();Tm();_m();ss();Zi();Co();Fr();Oi();oS=120,na=class{constructor(e){this.deps=e;this.freq=new gs;this.host=new cn;this.slots=new Tt;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.transport=new hs(e.apiBaseUrl,e.clientKey),this.bus=new bs(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=_i(e),r=e==null?void 0:e.variants;this.variants=Lm({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(km()),this.bus.use(Em()),this.bus.use(Im()),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=>Sm(s,e))&&wm(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:Pt(e),focus:no[e.surface],cost:ro[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()},oS))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Rm(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 Io(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Pt(e),focus:no[e.surface],tier:e.priority},surface:i});let o=ro[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Pt(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 sa={};_(sa,{SegmentBuffer:()=>ra,approxBytes:()=>dn});function dn(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 ra,ws=E(()=>{"use strict";ra=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=dn(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=dn(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}}});function aS(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function Bm(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 xs,Fm=E(()=>{"use strict";xs=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=aS(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 ia(n){let e=n;for(let t of lS)e=e.replace(t,cS);return e}function Dm(n){let e=n.snapshot;e&&typeof e=="object"&&Ss(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)dS(r)}function Ss(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=ia(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=ia(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)Ss(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)Ss(t)}function dS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=ia(n.value)),n.op==="add"&&n.node&&Ss(n.node)}var cS,lS,Hm=E(()=>{"use strict";cS="[redacted]",lS=[/\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 zm={};_(zm,{deviceMemoryGB:()=>qm,networkHint:()=>$m,shouldDeferHeavyEgress:()=>oa,userOptedOutOfTracking:()=>pS});function uS(){if(typeof navigator!="undefined")return navigator.connection}function $m(){let n=uS(),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 pS(){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 qm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function oa(){let n=$m();if(n.saveData||n.slow)return!0;let e=qm();return typeof e=="number"&&e<=1}var aa=E(()=>{"use strict"});function ca(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(Um);return n||(n=`t_${$()}`,sessionStorage.setItem(Um,n)),n}}catch{}return ks!=null?ks:ks=`t_${$()}`}function la(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function da(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Um,ks,Vm=E(()=>{"use strict";q();Um="scalebun_replay_tab"});var pa={};_(pa,{GZ_PREFIX:()=>un,ReplayEncoder:()=>ua,decodeSnapshotValue:()=>mS,gunzipBase64:()=>jm,gzipBase64:()=>Wm});async function Wm(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 hS(new Uint8Array(r))}async function jm(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 mS(n){return typeof n=="string"&&n.startsWith(un)?JSON.parse(await jm(n.slice(un.length))):n}function hS(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 un,fS,ua,fa=E(()=>{"use strict";un="gz:",fS=`
|
|
573
573
|
self.onmessage = async (e) => {
|
|
574
574
|
const { id, json } = e.data;
|
|
575
575
|
try {
|
|
@@ -585,7 +585,7 @@ self.onmessage = async (e) => {
|
|
|
585
585
|
self.postMessage({ id, err: String(err) });
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
-
`,ua=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 un+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return un+await zm(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 Vm(n){var e;return(e=n.shadowRoot)!=null?e:null}function Es(n,e){e.remove(n);let t=Vm(n);t&&t.childNodes.forEach(r=>Es(r,e)),n.childNodes.forEach(r=>Es(r,e))}function Is(n,e=[]){let t=Vm(n);return t&&(e.push(t),t.childNodes.forEach(r=>Is(r,e))),n.childNodes.forEach(r=>Is(r,e)),e}function ma(n,e){e.add(n),n.childNodes.forEach(t=>ma(t,e))}var Wm=E(()=>{"use strict"});var ha={};O(ha,{MutationRecorder:()=>ft,buildMutations:()=>jm});function fS(n){Cs.add(n),!(Ht||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&(Ht=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=Ht.call(this,e);if(e&&e.mode==="open")for(let r of Cs)try{r(this,t)}catch{}return t})}function mS(n){Cs.delete(n),Cs.size===0&&Ht&&(Element.prototype.attachShadow=Ht,Ht=null)}function As(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),As(s,e)),As(r,e)})}function jm(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 k=e.getId(g.target);if(k==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Mr.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&At(g.target)&&(v=Rt(v)),v!=null){let y=g.target;v=Or(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(`${k}:${g.attributeName}`,{op:"attr",id:k,key:g.attributeName,value:v})}else if(g.type==="characterData"){let k=e.getId(g.target);if(k==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,x=(t.maskAllText||Pr(g.target.parentElement,t.maskSel))&&!Tr.has(v)?Ge(y):y;s.set(k,{op:"text",id:k,value:x})}else g.type==="childList"&&(g.removedNodes.forEach(k=>{var y;let v=e.getId(k);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),Es(k,e))}),g.addedNodes.forEach(k=>o.push({node:k,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:k,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(k);if(y==null)continue;let b=Ye(g,e,t);b&&(ma(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 Cs,Ht,ft,pn=E(()=>{"use strict";et();Wm();Cs=new Set,Ht=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,As(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:Lr(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),As(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=jm(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 Is(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ba={};O(ba,{InteractionRecorder:()=>ga});function Km(){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 Gm(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,ga,gS,ya=E(()=>{"use strict";et();hS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},ga=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.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.pending.push({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r})};this.onClick=e=>{var m;let t=e,r=Date.now(),s=this.reg.getId(e.target),i=this.offsetFor(e.target),o=this.rootScroll(e.target),a=t.clientX+i.x,c=t.clientY+i.y;this.clickHistory=this.clickHistory.filter(h=>r-h.t<this.o.rageWindowMs);let l=this.clickHistory.filter(h=>Math.hypot(h.x-a,h.y-c)<=this.o.rageRadius);this.clickHistory.push({x:a,y:c,t:r});let u=l.length+1>=this.o.rageMin,d=(m=e.composedPath)==null?void 0:m.call(e),p=d&&d.length?d[0]:e.target,f=vS(p,this.o.maskText);this.pending.push({k:"click",x:a,y:c,sx:o.sx,sy:o.sy,id:s,t:r,...u?{rage:!0}:{},...f?{el:f}:{}}),this.armDeadCheck(p,{x:a,y:c,sx:o.sx,sy:o.sy,id:s,at:r,el:f})};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.pending.push({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t})};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:"";At(t)?s=Rt(s):this.o.maskInputs&&(s=Ge(s)),this.pending.push({k:"input",id:r,value:s,t:Date.now()})};this.onResize=()=>{this.pending.push({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()})};this.o={...hS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Km(),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.flush(),this.o.flushMs))}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"&&(Gm(m.addedNodes)||Gm(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&&Km()===this.startHref&&this.pending.push({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}})},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 Zm={};O(Zm,{bridgeCrossOriginFrame:()=>va,installChildSatellite:()=>xS,nodeIdBaseFor:()=>wa});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!==Ym||s||!Qm(o.origin,n))return;s=!0;let c=new rn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Ye(document,c,t);u&&l({scalebun:Xm,doc:u}),r=new ft(c,d=>l({scalebun:Jm,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function va(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!Qm(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Xm&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Jm&&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:Ym,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Ym,Xm,Jm,Qm,wa,xa=E(()=>{"use strict";sn();et();pn();Ym="scalebun:frame-init",Xm="scalebun:frame-key",Jm="scalebun:frame-mut",Qm=(n,e)=>e.includes("*")||e.includes(n);wa=n=>n*1e6});var ka={};O(ka,{IframeManager:()=>Sa});var Sa,Ea=E(()=>{"use strict";et();pn();xa();Sa=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=Ye(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=va(e,t,{nodeIdBase:wa(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 eh={};O(eh,{CanvasRecorder:()=>Ia});var SS,Ia,th=E(()=>{"use strict";SS="data-scalebun-block",Ia=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 nh={};O(nh,{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 rh=E(()=>{"use strict"});var ah={};O(ah,{RecorderController:()=>Ts,createRecorder:()=>RS});async function RS(n,e){let t=new Ts(n,e);return await t.init(),t}function ih(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function oh(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var sh,Rs,ES,IS,CS,AS,Ts,ch=E(()=>{"use strict";$();Vt();Rn();ws();_m();Bm();aa();$m();Sn();sh=120,Rs=2e5,ES=8,IS=3e6,CS=3e4,AS=5*6e4;Ts=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.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&oa()&&(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,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}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(fa(),pa)),Promise.resolve().then(()=>(ws(),sa))]);this.segBuf=new t(ES,IS),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 k,v,y,b;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(()=>(sn(),Nr)),Promise.resolve().then(()=>(et(),_r)),Promise.resolve().then(()=>(pn(),ha)),Promise.resolve().then(()=>(ya(),ba)),Promise.resolve().then(()=>(Ar(),Wi)),Promise.resolve().then(()=>(Ea(),ka))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(k=e.maskInputs)!=null?k:!0,maskSelectors:e.maskSelectors};this.redactPII=((v=e.replaySampling)==null?void 0:v.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:ih(),href:oh(),tabId:ca(),viewId:da(),route:la(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new i(c,x=>{this.push(this.delta({events:x}))},{maskText:!!l.maskAllText}),f=new s(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l),m=new o(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))}),h=new a(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l,{onFrame:(x,S)=>p.observeFrame(x,S),onUnframe:x=>p.unobserveFrame(x),frameOrigins:(y=e.replayFrameOrigins)!=null?y:[]});if(((b=e.replayFrameOrigins)!=null?b:[]).length&&Promise.resolve().then(()=>(xa(),Zm)).then(({installChildSatellite:x})=>{var S;this.childSatelliteStop=x((S=e.replayFrameOrigins)!=null?S:[],l)}),this.mutationRec=f,this.cssomRec=m,f.observe(document.documentElement),p.observe(),m.install(),h.start(),this.disconnectRecorder=()=>f.disconnect(),this.disconnectInteractions=()=>p.disconnect(),this.disconnectCssom=()=>m.disconnect(),this.disconnectIframes=()=>h.disconnect(),e.replayCanvas){let{CanvasRecorder:x}=await Promise.resolve().then(()=>(th(),eh)),S=new x(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))},(...w)=>e.log(...w));S.start(),this.disconnectCanvas=()=>S.disconnect()}this.adaptive=new xs(e.egressPending);let{installCadence:g}=await Promise.resolve().then(()=>(rh(),nh));this.disconnectCadence=g({keyframeIntervalMs:CS,onCheckpoint:x=>this.checkpoint(x)})}disarm(){var e,t,r,s,i,o,a,c;(e=this.disconnectRecorder)==null||e.call(this),(t=this.disconnectInteractions)==null||t.call(this),(r=this.disconnectCssom)==null||r.call(this),(s=this.disconnectCanvas)==null||s.call(this),(i=this.disconnectIframes)==null||i.call(this),(o=this.childSatelliteStop)==null||o.call(this),(a=this.disconnectCadence)==null||a.call(this),(c=this.adaptive)==null||c.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:ca(),viewId:da(),route:la(),masked:!0,timestamp:P()}}push(e){if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&Nm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let r=Om(e,this.adaptive.level);if(!r){this.shed++;return}e=r}if(this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=dn(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=sh||this.streamChainBytes>=Rs)&&this.checkpoint(this.streamChainBytes>=Rs?"segment-bytes":"segment-frames"));return}let t=this.segBuf;t&&(e.frameType==="keyframe"?t.openSegment(e):t.append(e),!this.checkpointing&&e.frameType==="delta"&&(t.currentFrameCount>=sh||t.currentBytes>=Rs)&&this.checkpoint(t.currentBytes>=Rs?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")&&!(e==="time"&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<AS)){this.checkpointing=!0;try{(t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush();let s=this.takeSnapshotFn(document,this.reg,this.snapOpts),i=`f_${q()}`;this.keyframeId=i,this.streamChainBytes=0,this.streamChainFrames=0;let o={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:i,seq:this.nextSeq(),snapshot:s,viewport:ih(),href:oh(),masked:!0,trigger:e,timestamp:P()};this.push(o),this.compressInPlace(o,s),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(St(this.segBuf.drainFrames()))}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;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),this.segBuf)for(let i of this.segBuf.drainFrames())this.ctx.emit(i);(r=this.segBuf)==null||r.clear(),this.streaming=!0,(s=this.replayStore)==null||s.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 lh={};O(lh,{decideSampling:()=>PS});function PS(n,e){let t={...MS,...n},r=Le(e,TS),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 TS,MS,dh=E(()=>{"use strict";Fe();TS="wzb-replay-v1",MS={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var ph={};O(ph,{installWebGLPreserve:()=>OS});function uh(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[Ca])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&LS.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[Ca]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[Ca]}}function OS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=uh(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=uh(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var Ca,LS,fh=E(()=>{"use strict";Ca="__scalebunWebglPatched",LS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var wh={};O(wh,{armSoftAsk:()=>qS});function yh(){try{let n=Number(localStorage.getItem(vh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function DS(n){try{localStorage.setItem(vh,String(Date.now()+n*864e5))}catch{}}function HS(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
|
|
588
|
+
`,ua=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([fS],{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 un+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return un+await Wm(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 Km(n){var e;return(e=n.shadowRoot)!=null?e:null}function Es(n,e){e.remove(n);let t=Km(n);t&&t.childNodes.forEach(r=>Es(r,e)),n.childNodes.forEach(r=>Es(r,e))}function Is(n,e=[]){let t=Km(n);return t&&(e.push(t),t.childNodes.forEach(r=>Is(r,e))),n.childNodes.forEach(r=>Is(r,e)),e}function ma(n,e){e.add(n),n.childNodes.forEach(t=>ma(t,e))}var Gm=E(()=>{"use strict"});var ha={};_(ha,{MutationRecorder:()=>ft,buildMutations:()=>Ym});function gS(n){Cs.add(n),!(Ht||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&(Ht=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=Ht.call(this,e);if(e&&e.mode==="open")for(let r of Cs)try{r(this,t)}catch{}return t})}function bS(n){Cs.delete(n),Cs.size===0&&Ht&&(Element.prototype.attachShadow=Ht,Ht=null)}function As(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),As(s,e)),As(r,e)})}function Ym(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 k=e.getId(g.target);if(k==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Mr.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&At(g.target)&&(v=Rt(v)),v!=null){let y=g.target;v=_r(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(`${k}:${g.attributeName}`,{op:"attr",id:k,key:g.attributeName,value:v})}else if(g.type==="characterData"){let k=e.getId(g.target);if(k==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,x=(t.maskAllText||Pr(g.target.parentElement,t.maskSel))&&!Tr.has(v)?Ge(y):y;s.set(k,{op:"text",id:k,value:x})}else g.type==="childList"&&(g.removedNodes.forEach(k=>{var y;let v=e.getId(k);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),Es(k,e))}),g.addedNodes.forEach(k=>o.push({node:k,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:k,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(k);if(y==null)continue;let b=Ye(g,e,t);b&&(ma(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 Cs,Ht,ft,pn=E(()=>{"use strict";et();Gm();Cs=new Set,Ht=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,As(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:Lr(s,this.reg,this.o)}])},gS(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),As(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&&(bS(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=Ym(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 Is(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ba={};_(ba,{InteractionRecorder:()=>ga});function Xm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function wS(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 xS(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 SS(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,vS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?wS(a):void 0,label:xS(a,e)}}catch{return}}function Jm(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function kS(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 yS,ga,vS,ya=E(()=>{"use strict";et();yS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},ga=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.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.pending.push({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r})};this.onClick=e=>{var m;let t=e,r=Date.now(),s=this.reg.getId(e.target),i=this.offsetFor(e.target),o=this.rootScroll(e.target),a=t.clientX+i.x,c=t.clientY+i.y;this.clickHistory=this.clickHistory.filter(h=>r-h.t<this.o.rageWindowMs);let l=this.clickHistory.filter(h=>Math.hypot(h.x-a,h.y-c)<=this.o.rageRadius);this.clickHistory.push({x:a,y:c,t:r});let u=l.length+1>=this.o.rageMin,d=(m=e.composedPath)==null?void 0:m.call(e),p=d&&d.length?d[0]:e.target,f=SS(p,this.o.maskText);this.pending.push({k:"click",x:a,y:c,sx:o.sx,sy:o.sy,id:s,t:r,...u?{rage:!0}:{},...f?{el:f}:{}}),this.armDeadCheck(p,{x:a,y:c,sx:o.sx,sy:o.sy,id:s,at:r,el:f})};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.pending.push({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t})};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:"";At(t)?s=Rt(s):this.o.maskInputs&&(s=Ge(s)),this.pending.push({k:"input",id:r,value:s,t:Date.now()})};this.onResize=()=>{this.pending.push({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()})};this.o={...yS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Xm(),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.flush(),this.o.flushMs))}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?kS(m.target,c):!1,g=m.type==="childList"&&(Jm(m.addedNodes)||Jm(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&&Xm()===this.startHref&&this.pending.push({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}})},this.o.deadMs);this.deadTimers.add(p)}};vS='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 nh={};_(nh,{bridgeCrossOriginFrame:()=>va,installChildSatellite:()=>ES,nodeIdBaseFor:()=>wa});function ES(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!==Qm||s||!th(o.origin,n))return;s=!0;let c=new rn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Ye(document,c,t);u&&l({scalebun:Zm,doc:u}),r=new ft(c,d=>l({scalebun:eh,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function va(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!th(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Zm&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===eh&&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:Qm,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Qm,Zm,eh,th,wa,xa=E(()=>{"use strict";sn();et();pn();Qm="scalebun:frame-init",Zm="scalebun:frame-key",eh="scalebun:frame-mut",th=(n,e)=>e.includes("*")||e.includes(n);wa=n=>n*1e6});var ka={};_(ka,{IframeManager:()=>Sa});var Sa,Ea=E(()=>{"use strict";et();pn();xa();Sa=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=Ye(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=va(e,t,{nodeIdBase:wa(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 rh={};_(rh,{CanvasRecorder:()=>Ia});var IS,Ia,sh=E(()=>{"use strict";IS="data-scalebun-block",Ia=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(IS)))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 ih={};_(ih,{installCadence:()=>CS});function CS(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 oh=E(()=>{"use strict"});var dh={};_(dh,{RecorderController:()=>Ts,createRecorder:()=>PS});async function PS(n,e){let t=new Ts(n,e);return await t.init(),t}function ch(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function lh(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var ah,Rs,AS,RS,TS,MS,Ts,uh=E(()=>{"use strict";q();Vt();Rn();ws();Fm();Hm();aa();Vm();Sn();ah=120,Rs=2e5,AS=8,RS=3e6,TS=3e4,MS=5*6e4;Ts=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.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&oa()&&(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,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}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(fa(),pa)),Promise.resolve().then(()=>(ws(),sa))]);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 k,v,y,b;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(()=>(sn(),Nr)),Promise.resolve().then(()=>(et(),Or)),Promise.resolve().then(()=>(pn(),ha)),Promise.resolve().then(()=>(ya(),ba)),Promise.resolve().then(()=>(Ar(),Wi)),Promise.resolve().then(()=>(Ea(),ka))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(k=e.maskInputs)!=null?k:!0,maskSelectors:e.maskSelectors};this.redactPII=((v=e.replaySampling)==null?void 0:v.privacyLevel)==="strict"&&!l.maskAllText,this.reg=c,this.snapOpts=l,this.takeSnapshotFn=r;let u=r(document,c,l);this.keyframeId=`f_${$()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:ch(),href:lh(),tabId:ca(),viewId:da(),route:la(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new i(c,x=>{this.push(this.delta({events:x}))},{maskText:!!l.maskAllText}),f=new s(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l),m=new o(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))}),h=new a(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l,{onFrame:(x,S)=>p.observeFrame(x,S),onUnframe:x=>p.unobserveFrame(x),frameOrigins:(y=e.replayFrameOrigins)!=null?y:[]});if(((b=e.replayFrameOrigins)!=null?b:[]).length&&Promise.resolve().then(()=>(xa(),nh)).then(({installChildSatellite:x})=>{var S;this.childSatelliteStop=x((S=e.replayFrameOrigins)!=null?S:[],l)}),this.mutationRec=f,this.cssomRec=m,f.observe(document.documentElement),p.observe(),m.install(),h.start(),this.disconnectRecorder=()=>f.disconnect(),this.disconnectInteractions=()=>p.disconnect(),this.disconnectCssom=()=>m.disconnect(),this.disconnectIframes=()=>h.disconnect(),e.replayCanvas){let{CanvasRecorder:x}=await Promise.resolve().then(()=>(sh(),rh)),S=new x(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))},(...w)=>e.log(...w));S.start(),this.disconnectCanvas=()=>S.disconnect()}this.adaptive=new xs(e.egressPending);let{installCadence:g}=await Promise.resolve().then(()=>(oh(),ih));this.disconnectCadence=g({keyframeIntervalMs:TS,onCheckpoint:x=>this.checkpoint(x)})}disarm(){var e,t,r,s,i,o,a,c;(e=this.disconnectRecorder)==null||e.call(this),(t=this.disconnectInteractions)==null||t.call(this),(r=this.disconnectCssom)==null||r.call(this),(s=this.disconnectCanvas)==null||s.call(this),(i=this.disconnectIframes)==null||i.call(this),(o=this.childSatelliteStop)==null||o.call(this),(a=this.disconnectCadence)==null||a.call(this),(c=this.adaptive)==null||c.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_${$()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:ca(),viewId:da(),route:la(),masked:!0,timestamp:P()}}push(e){if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&Dm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let r=Bm(e,this.adaptive.level);if(!r){this.shed++;return}e=r}if(this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=dn(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=ah||this.streamChainBytes>=Rs)&&this.checkpoint(this.streamChainBytes>=Rs?"segment-bytes":"segment-frames"));return}let t=this.segBuf;t&&(e.frameType==="keyframe"?t.openSegment(e):t.append(e),!this.checkpointing&&e.frameType==="delta"&&(t.currentFrameCount>=ah||t.currentBytes>=Rs)&&this.checkpoint(t.currentBytes>=Rs?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")&&!(e==="time"&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<MS)){this.checkpointing=!0;try{(t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush();let s=this.takeSnapshotFn(document,this.reg,this.snapOpts),i=`f_${$()}`;this.keyframeId=i,this.streamChainBytes=0,this.streamChainFrames=0;let o={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:i,seq:this.nextSeq(),snapshot:s,viewport:ch(),href:lh(),masked:!0,trigger:e,timestamp:P()};this.push(o),this.compressInPlace(o,s),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=bc(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(St(this.segBuf.drainFrames()))}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;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),this.segBuf)for(let i of this.segBuf.drainFrames())this.ctx.emit(i);(r=this.segBuf)==null||r.clear(),this.streaming=!0,(s=this.replayStore)==null||s.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 ph={};_(ph,{decideSampling:()=>OS});function OS(n,e){let t={..._S,...n},r=Le(e,LS),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 LS,_S,fh=E(()=>{"use strict";Fe();LS="wzb-replay-v1",_S={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var hh={};_(hh,{installWebGLPreserve:()=>BS});function mh(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[Ca])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[Ca]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[Ca]}}function BS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=mh(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=mh(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var Ca,NS,gh=E(()=>{"use strict";Ca="__scalebunWebglPatched",NS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var kh={};_(kh,{armSoftAsk:()=>US});function xh(){try{let n=Number(localStorage.getItem(Sh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function qS(n){try{localStorage.setItem(Sh,String(Date.now()+n*864e5))}catch{}}function zS(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
|
|
589
589
|
<style>
|
|
590
590
|
:host{all:initial}
|
|
591
591
|
.c{width:min(340px,calc(100vw - 32px));box-sizing:border-box;padding:16px 18px;border-radius:14px;
|
|
@@ -611,7 +611,7 @@ self.onmessage = async (e) => {
|
|
|
611
611
|
<button class="no" type="button"></button>
|
|
612
612
|
<button class="yes" type="button"></button>
|
|
613
613
|
</div>
|
|
614
|
-
</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
|
|
614
|
+
</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 US(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||xh())return;let r={...$S,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||xh())return;if(!await zS(r)){qS(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 Sh,$S,Eh=E(()=>{"use strict";Sh="scalebun.push.softAsk.snoozedUntil",$S={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"}});function VS(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function WS(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var jS,Ps,Ih=E(()=>{"use strict";vo();q();jS=`
|
|
615
615
|
:host{all:initial}
|
|
616
616
|
*{box-sizing:border-box;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
|
|
617
617
|
.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}
|
|
@@ -630,6 +630,6 @@ button{font:inherit;cursor:pointer;border-radius:8px;border:none}
|
|
|
630
630
|
.back{background:#262131;color:#edeaf2;font-size:12px;font-weight:600;padding:7px 12px}
|
|
631
631
|
.next{background:#7c6cf0;color:#fff;font-size:12px;font-weight:600;padding:7px 14px}
|
|
632
632
|
.x{position:absolute;top:10px;right:12px;background:none;color:#9a95a6;font-size:17px;line-height:1;padding:2px}
|
|
633
|
-
@media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ps=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.root=this.host.attachShadow({mode:"open"}),Ne(this.root,US),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=$S(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=Zr({anchor:t,tooltip:r,boundary:zS(),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 Eh={};O(Eh,{CoachmarkFeature:()=>Aa});var kh,Aa,Ih=E(()=>{"use strict";es();Sh();wo();Jr();ns();kh="scalebun_coach_progress",Aa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ps;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new Dt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>ts(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 Fp())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(kh)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(kh,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function Ls(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 Ch,Ra=E(()=>{"use strict";Ch={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 Ta={};O(Ta,{notInitializedReport:()=>YS,runPushDiagnostics:()=>GS});function VS(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function WS(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 jS(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 KS(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 GS(n){var m,h,g,k,v,y,b,x,S;let e=[],t=w=>(e.push(w),w),r=(w,I,C)=>{t({id:w,status:"unknown",label:I,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&&VS(),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"),Ah(e);let c=null;try{let w=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=w.ok,t({id:"sw_reachable",status:w.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${w.status}`,fix:w.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=(k=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?k:(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 w=await KS(l);!w||typeof w.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/.`}):w.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${w.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${w.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let w=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),I=w.ok?await w.json():null;p=(I==null?void 0:I.enabled)===!1?null:(x=I==null?void 0:I.vapidPublicKey)!=null?x: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 w=l?await l.pushManager.getSubscription():null;if(!w)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 I=w.toJSON(),C=typeof I.expirationTime=="number"&&I.expirationTime<=Date.now(),M=null;if(p){let A=(S=w.options)==null?void 0:S.applicationServerKey;M=A?jS(new Uint8Array(A),WS(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":w.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 w=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"}),I=w.ok?await w.json():null;if(!I)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${w.status}`}),r("identified","User is identified","the server did not answer");else{let C=I.tokenStatus==="dead";t({id:"device_registered",status:I.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:I.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:I.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:I.identified?"pass":"warn",label:"User is identified",detail:I.identified?"Bound to a person":"Anonymous device",fix:I.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 Ah(e)}function YS(){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 Ah(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 Ma=E(()=>{"use strict"});var Th={};O(Th,{DEFAULT_SW_URL:()=>Pa,EXPECTED_SW_VERSION:()=>Rh,PUSH_STATE_COPY:()=>Ch,PushFeature:()=>La,resolvePushState:()=>Ls});function Os(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function XS(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 Rh,Pa,mn,La,Mh=E(()=>{"use strict";Ra();Ra();Rh=5,Pa="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=Pa;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||Pa;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:XS(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(()=>(Ma(),Ta));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:Rh})}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:Ls({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";La=mn});var _h=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ba(n){var e,t,r,s,i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,_,z,D,te,J,Q,fe,ce,xe,Se,le,H,V,K,de,me,se,Ue,Ve,G,ie,X,Y,ee,T,L,N,F,W,re,ge,he,Ie,Ce,Ae,Je,st,ke,gn,_a,Na;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");if(!n.apiBaseUrl)throw new Error("[scalebun] apiBaseUrl is required");return{clientKey:n.clientKey,apiBaseUrl:n.apiBaseUrl.replace(/\/$/,""),environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(e=n.flushIntervalMs)!=null?e: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:(t=n.replayCanvas)!=null?t:!1,signSessionLane:(r=n.signSessionLane)!=null?r:!1,replayFrameOrigins:(s=n.replayFrameOrigins)!=null?s:[],autocapture:(i=n.autocapture)!=null?i:!0,tracePropagation:(o=n.tracePropagation)!=null?o:!0,tracePropagationOrigins:(a=n.tracePropagationOrigins)!=null?a:[],maxBatchSize:(c=n.maxBatchSize)!=null?c:50,maxQueueSize:(l=n.maxQueueSize)!=null?l:1e3,debug:(u=n.debug)!=null?u:!1,features:{errors:(p=(d=n.features)==null?void 0:d.errors)!=null?p:!0,network:(m=(f=n.features)==null?void 0:f.network)!=null?m:!0,console:(g=(h=n.features)==null?void 0:h.console)!=null?g:!0,webVitals:(v=(k=n.features)==null?void 0:k.webVitals)!=null?v:!0,performance:(b=(y=n.features)==null?void 0:y.performance)!=null?b:!0,journey:(S=(x=n.features)==null?void 0:x.journey)!=null?S:!0,replay:(I=(w=n.features)==null?void 0:w.replay)!=null?I:!1,bugReport:(M=(C=n.features)==null?void 0:C.bugReport)!=null?M:!0,crash:(A=(R=n.features)==null?void 0:R.crash)!=null?A:!0,config:(z=(_=n.features)==null?void 0:_.config)!=null?z:!0,engage:(te=(D=n.features)==null?void 0:D.engage)!=null?te:!0,analytics:(Q=(J=n.features)==null?void 0:J.analytics)!=null?Q:!0,webPerf:(ce=(fe=n.features)==null?void 0:fe.webPerf)!=null?ce:!0,profiler:(Se=(xe=n.features)==null?void 0:xe.profiler)!=null?Se:!1,watchdog:(H=(le=n.features)==null?void 0:le.watchdog)!=null?H:!1,inbox:(K=(V=n.features)==null?void 0:V.inbox)!=null?K:!1,inapp2:(me=(de=n.features)==null?void 0:de.inapp2)!=null?me:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(Ue=(se=n.privacy)==null?void 0:se.captureNetworkBodies)!=null?Ue:!1,denylist:[..._h,...(G=(Ve=n.privacy)==null?void 0:Ve.denylist)!=null?G:[]].map(Lh=>Lh.toLowerCase()),maskSelectors:(X=(ie=n.privacy)==null?void 0:ie.maskSelectors)!=null?X:[],maskReplayText:(ee=(Y=n.privacy)==null?void 0:Y.maskReplayText)!=null?ee:!1,maskInputs:(F=(N=(T=n.privacy)==null?void 0:T.maskInputs)!=null?N:(L=n.privacy)==null?void 0:L.maskReplayText)!=null?F:!1,respectDnt:(re=(W=n.privacy)==null?void 0:W.respectDnt)!=null?re:!1,maskEventText:(he=(ge=n.privacy)==null?void 0:ge.maskEventText)!=null?he:!1},consent:{required:(Ie=n.requireConsent)!=null?Ie:!1,initial:(Ce=n.initialConsent)!=null?Ce:"unknown"},bugReport:{launcher:(Je=(Ae=n.bugReportOptions)==null?void 0:Ae.launcher)!=null?Je:!1,position:(ke=(st=n.bugReportOptions)==null?void 0:st.position)!=null?ke:"bottom-right",label:(_a=(gn=n.bugReportOptions)==null?void 0:gn.label)!=null?_a:"Report a bug"},...(Na=n.engageOptions)!=null&&Na.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}$();$();Sn();var kn=class{constructor(e){this.config=e;var r,s;let t=pc((r=e.sessionTimeoutMs)!=null?r:Ut,(s=e.sessionMaxDurationMs)!=null?s:Gs);this.sessionId=t.id,this.deviceId=Da()}client(){return za()}device(){return Ua(this.deviceId)}app(){return Va(this.config)}context(){return fc(),Wa()}};Sn();var In=class In{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(()=>(Qs(),Js));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c;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:Ut,startedAt:Date.now()})}async sendBatch(e,t){let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`;return this.post(r,e,t==null?void 0:t.keepalive)}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!1;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>In.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(yc(),bc)),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}catch{return!1}}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)})}};In.GZIP_MIN_BYTES=1024;var En=In;Vt();$();Cn();Rn();var ag=1,Tn=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new xt;this.flushing=!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;try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=An(s,o=>o.timestamp,P());this.droppedCount+=s.length-i.length,i.length&&(r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}),this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush()}}emit(e){if(!this.consentGranted){this.droppedCount++;return}this.queue.length>=this.config.maxQueueSize&&(this.queue.shift(),this.droppedCount++),this.queue.push(e)}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,St(e,t=>t.kind==="frame")])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){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.transport.sendBatch(this.buildEnvelope(t),e)?(this.backoff.reset(),this.inFlight=[]):(this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue())}catch{this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}}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=!1;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}r||this.buffer.save([e,t])}buildEnvelope(e){return{schemaVersion:ag,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}};function cg(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Mn=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:cg(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}};$();var xc={drop:!1,warnings:[]};function Sc(n,e,t){var o,a;if(!n||e.startsWith("$"))return xc;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`]}:xc;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 lg=/^[A-Za-z]{3}$/;function dg(n){return lg.test(n)?n.toUpperCase():n}function Pn(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:dg(t),props:d}}var ug=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],pg=new Set(["trial_started","trial_converted","started","plan_changed"]);function Ln(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function fg(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 kc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!ug.includes(t))return null;let r=n.plan;return pg.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:fg(r)}:{},...Ln(n.trialEndAt)?{trialEndAt:Ln(n.trialEndAt)}:{},...Ln(n.effectiveAt)?{effectiveAt:Ln(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var mg="wzb-analytics-v1",hg=new Set(["$identify","$group","$alias","purchase"]);function Ec(n,e,t){return t>=1||hg.has(n)?!0:t<=0?!1:Ee(`${e}:${mg}`)%1e4<t*1e4}Vt();Cn();Rn();var Dg=50,Hg=5e3,qg=2e3,Qe="scalebun_anonymous_id",ri="scalebun_user_id",Fn="scalebun_super_props",ti="scalebun_groups",Wc="scalebun_installation_id",jc="scalebun_first_open_done",si="scalebun_attribution_click_id",Kc="scalebun_attribution",Yc=/^[0-9a-f]{16,64}$/i,$g=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function zg(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(Kc);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 $g){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(Kc,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var Ug="pending-analytics";function Vg(){try{if(typeof localStorage!="undefined")return localStorage.getItem(ri)||void 0}catch{}}function ni(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(ri,n):localStorage.removeItem(ri)}catch{}}function ii(){return`anon_${q()}`}function Gc(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 jt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function Wg(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 oi(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 jg(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(Wc))!=null?r:"",e||(e=n||`web_${q()}`,localStorage.setItem(Wc,e)),t=(s=localStorage.getItem(si))!=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&&Yc.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(si,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 Kg(n){if(n){let t=Wg(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:ii();return t||localStorage.setItem(Qe,r),n&&oi(Qe,r,n),r}}catch{}let e=ii();return n&&oi(Qe,e,n),e}var Dn=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=Vg();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(Ug);this.persisted=!1;this.backoff=new xt;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=jg(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=zg();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Kg(this.cookieDomain),this.superProps=Gc(Fn),this.groups=Gc(ti),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(),Hg),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=vc(()=>{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=An(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(()=>(Vc(),Uc)).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(jc)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(jc,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!Yc.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(si,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: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:Bs}}}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=Sc(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},jt(Fn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,jt(Fn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},jt(ti,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,ni(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ni(void 0),this.anonymousId=ii();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&oi(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},jt(Fn,this.superProps),jt(ti,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Ec(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=Pn(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=kc(e);if(!t)return;let r=ne();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ni(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=Dg&&this.autoFlush()}trim(){let e=this.queue.length-qg;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(()=>(Qs(),Js)),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(St(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 Gg(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 Xc(n,e){let t=Gg(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 Yg(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=>Xc(n,c)),i=r.length===0||r.some(c=>Xc(n,c));return s&&i}function Kt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Yg(e,t))return t;return null}var Jc="scalebun_config",ai="scalebun_flag_overrides";function Hn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Qc(){let n=Hn();if(!n)return null;try{let e=n.getItem(Jc);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 Zc(n){let e=Hn();if(e)try{e.setItem(Jc,JSON.stringify(n))}catch{}}function el(){let n=Hn();if(!n)return{};try{let e=n.getItem(ai),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function qn(n){let e=Hn();if(e)try{Object.keys(n).length?e.setItem(ai,JSON.stringify(n)):e.removeItem(ai)}catch{}}var ci={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var Xg=5*60*1e3,tl=n=>{var e;return(e=n.salt)!=null?e:n.key},$n=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=ci;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:"",_e({deviceId:this.deviceId}),this.overrides=el(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:Qc())!=null?o:ci,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Xg&&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},Zc(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,qn(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],qn(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},qn(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=bt();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=Kt(t.targeting,bt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),tl(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(k=>k.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=Zs(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=Kt(r.targeting,bt());if(d)return typeof d.rollout=="number"?Le(i(),tl(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=Kt(t.targeting,bt());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=Kt(t.targeting,bt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=Zs(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 nl(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function rl(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 sl=16*1024;function il(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>sl&&(c=c.slice(0,sl)),c=nl(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}:{},...Jg(),...Qg(),screenName:Zg(),clientId:`err_${q()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=rl(r))!=null?f:{}}}function Jg(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function Qg(){let n=ne();return n?{replay:n}:{}}function Zg(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var zn=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 Et={tags:{},context:{}};function ol(n,e){Et.tags[n]=e}function al(n,e){Et.context[n]=e}function cl(n){Et.level=n}function ll(n){var i;let e={...Et.tags,...n==null?void 0:n.tags},t={...Et.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:Et.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var eb="wzb-errors-v1";function dl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,eb)<n*100:!0}$();var ab=()=>[];function cb(n){if(!n)return"";let e=n.split(`
|
|
634
|
-
`).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var xl=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Sl(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Un=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new zn;this.ignore=xl;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=[...xl,...(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=dl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(wl(),vl)).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(Sl(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Sl(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${cb(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:ab):void 0,o=il(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:ll(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 di;function lb(){return di||(di=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Vn(n){try{let e=lb();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function Wn(n){try{return n==null?void 0:typeof n=="string"?Vn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Vn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Gt(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 kl(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var k,v,y,b,x,S,w,I,C,M,R;let c=ub(o),l=pb(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((k=a==null?void 0:a.headers)!=null?k:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=fb(d==null?void 0:d.body),g=mb(o,d);try{let A=await s.call(this,o,d),_=null;try{_=typeof A.clone=="function"?A.clone():null}catch{_=null}return e({method:l,url:c,status:A.status,startedAt:f,duration:Math.round(lt()-m),requestSize:(y=Wn(d==null?void 0:d.body))!=null?y:Gt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Gt((x=(b=A.headers)==null?void 0:b.get)==null?void 0:x.call(b,"content-length")),reqBody:h,reqContentType:(w=(S=g==null?void 0:g.get)==null?void 0:S.call(g,"content-type"))!=null?w:void 0,resContentType:(M=(C=(I=A.headers)==null?void 0:I.get)==null?void 0:C.call(I,"content-type"))!=null?M:void 0,readResponseText:_?()=>db(_):void 0,traceId:u}),A}catch(A){let _=A,z=(_==null?void 0:_.name)==="AbortError",D=(_==null?void 0:_.name)==="TimeoutError";throw e({method:l,url:c,status:0,startedAt:f,duration:Math.round(lt()-m),error:(R=_==null?void 0:_.message)!=null?R:"network error",aborted:z,timedOut:D}),A}},()=>{n.fetch=s})}var jn=64*1024;async function db(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>jn?i.slice(0,jn):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>=jn){try{await t.cancel()}catch{}return s.slice(0,jn)}}return r&&(s+=r.decode()),s}catch{return null}}function ub(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function pb(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 fb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function mb(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 El(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=Wn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let k=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:gb(this),error:k?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:hb(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 hb(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 gb(n){var t;let e=Gt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Vn(n.responseText):void 0}catch{return}}$();function Il(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 bb(t)?"abort":yb(t)?"timeout":vb(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function Cl(n,e=2e3){return typeof n=="number"&&n>=e}function bb(n){return/\babort(ed)?\b/i.test(n)}function yb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function vb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var wb=/^(?:\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 xb(n){return n?!!(wb.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Al(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&&xb(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Rl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?Il({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=Cl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Al(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:Sb(),...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 Sb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Tl(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 kb(){let n=Tl(16),e=Tl(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Eb(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function Ml(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=Eb(t);return r&&e.has(r)?kb():null}}var Ib=new Set(["fetch","xmlhttprequest"]);function Cb(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 It=class It{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;Ib.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>It.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?Cb(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-It.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()}};It.TTL_MS=6e4,It.MAX_PER_URL=8;var Gn=It;Fe();function Pl(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 Yn=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 Lb(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Jn=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Gn;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 Yn(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=Ml((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(kl(window,o,i,a)),this.uninstalls.push(El(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(()=>(Fl(),Bl)).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=>Lb(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(()=>(jl(),Wl)).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=Rl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!Pl({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}};qs();function Kl(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function yi(){return{max:0,cur:0,first:0,last:0}}function Gl(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 Yl(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function vi(n){if(n)return n.replace(/[?#].*$/,"")}function Xl(){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 Jl(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 Ql(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 Ob={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function Zl(n,e){let t=Ob[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function wi(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(`#${ed(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${ed(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=_b(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function _b(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function ed(n){return n.replace(/([^\w-])/g,"\\$1")}function td(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 nd(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=wi(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=Xt(i)),o!==void 0&&(a.renderTime=Xt(o)),a}function xi(){return{largestValue:0,sources:[]}}function rd(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:wi(l),previousRect:td(c.previousRect),currentRect:td(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function sd(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function Si(){return{duration:0}}function id(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=Nb(t))}return n}function Nb(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=wi(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=Xt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Xt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Xt(Math.max(0,t+i-s))),o}function od(n){return n.duration>0?n.attribution:void 0}function Xt(n){return Math.round(n)}$();var Zn=class Zn{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=yi();this.inp=0;this.clsAcc=xi();this.inpAcc=Si();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=Kl(t);r&&(this.lcp=r,this.lcpAttr=(s=nd(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=vi(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{Gl(this.clsState,t),rd(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=Yl(this.inp,t),id(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>=Zn.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=vi(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=cd(ad()),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:Xl()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=Jl(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=od(this.inpAcc);if(t&&this.inpWindow){let r=Ql(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",sd(this.clsAcc)),this.lcp=this.inp=0,this.clsState=yi(),this.lcpAttr=void 0,this.clsAcc=xi(),this.inpAcc=Si(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=cd(ad());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:Zl(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}};Zn.LOAF_CAP=30;var Qn=Zn;function ad(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function cd(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}$();ki();$();var Bb=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Jt(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:Bb(),clientId:`perf_${q()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Qt=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 tr=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 ud(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 pd(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 Fb=new Set(["fetch","xmlhttprequest","beacon"]);function Db(n){return n.replace(/[?#].*$/,"")}function Zt(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ei="";function fd(n){Ei=(n!=null?n:"").replace(/\/$/,"")}function Hb(n){return!!Ei&&n.startsWith(Ei)}function md(n){if(Fb.has(n.initiatorType)||Hb(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:Db(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",Zt(n.domainLookupStart,n.domainLookupEnd)),r("tcp",Zt(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?Zt(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",Zt(n.requestStart,n.responseStart)),r("download",Zt(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 hd(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 qb="wzb-traces-v1";function gd(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${qb}`)%100<n.sampleRate*100}sr();var zb=1e3,Ub=3e3,Vb=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function Wb(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var ar=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Qt;this.resCap=new Qt({capCount:100,windowMs:1e4});this.traces=new tr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=Ub;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,fd(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(()=>(Ed(),kd)).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(hd(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}Wb()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,pd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,ud(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(Jt("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(Jt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;ld({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 rr;let t=new this.engine.Transaction(e,{clock:Vb,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")),!gd({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(Jt("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(),zb))}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(Jt(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 lr=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=cr(),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?jb(l):cr())};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=cr()){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 cr(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function jb(n){try{return new URL(n).pathname}catch{return cr()}}var dr=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}},ur=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=Id(),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&&Id()===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 Id(){try{return typeof location!="undefined"?location.href:""}catch{return""}}var pr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new dr((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new ur((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;let t=e,r=Date.now(),s=e.target;if(!s||!s.tagName)return;let i=Xb(s,this.maskText),o=Jb(s),a=Kb(t),c=Gb(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&&((d=this.signal)==null||d.call(this,"rage")),this.dead.onClick(r,()=>{var p;this.emit("USER_ACTION",{action:"click",...a,selector:o,...c,dead:!0},i),(p=this.signal)==null||p.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 Kb(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 Gb(n){var s;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=(s=n.closest("[data-scalebun-component]"))==null?void 0:s.getAttribute("data-scalebun-component");return r&&(t.component=r),t}var Yb=n=>n.replace(/\S/g,"*");function Xb(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Yb(r):r}`:t}function Jb(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 fr=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 lr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new pr((t,r,s)=>this.emit(t,r,s,Cd()),{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:Cd(),eventId:`evt_${q()}`,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 Cd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Ns();$();var Qb={maxDepth:4,maxBreadth:50,maxLength:8192};function Ci(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=>Ci(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=Ci(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 Ad(n,e){let t={...Qb,...e},r;try{r=n.map(s=>Ci(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 Rd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Ai(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var Zb=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Td(n,e,t=0){let r=Ai(n),s=j(Ad(e)),i={method:n},o=Zb();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Rd(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 mr=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 ey=["debug","info","log","warn","error"],ty=50,hr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new mr;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 ey){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]===_s)){this.capturing=!0;try{if(!this.throttle.accept(Ai(e)))return;let s=Td(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>ty&&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 gr=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(()=>(Pd(),Md));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve(null)})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};$();var Ld="scalebun:tab",Od="scalebun:live:";function Ti(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function oy(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Ri(){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 _d(){let n=oy();if(!n)return`mem-${Ri()}`;try{let e=n.getItem(Ld);if(e)return e;let t=Ri();return n.setItem(Ld,t),t}catch{return`mem-${Ri()}`}}var Mi=n=>`${Od}${n}`;function br(n){let e=Ti();if(!e)return null;try{let t=e.getItem(Mi(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 yr(n,e){let t=Ti();if(t)try{t.setItem(Mi(n),JSON.stringify(e))}catch{}}function vr(n,e){let t=br(n);t&&(t.ended=e,t.lastActive=Date.now(),yr(n,t))}function Nd(n){let e=br(n);e&&(e.lastActive=Date.now(),yr(n,e))}function Bd(n,e){let t=Ti();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Od)||i===Mi(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 ay=15e3,wr=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=_d();let t=br(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();yr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=Fd())!=null?s:"",ended:!1}),Bd(this.tabId,r),this.onHide=()=>vr(this.tabId,!0),this.onShow=()=>vr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Nd(this.tabId),ay)}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:Fd(),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&&vr(this.tabId,!0),this.active=!1}};function Fd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Vt();var cy=50,xr=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(-cy);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 ax=32,cx=3e4,Lf="scalebun_engage_sessions";function Of(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function lx(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var is=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 s;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(s=e.clientKey)!=null?s:"";if(!t||!e.apiBaseUrl)return;this.transport=new xr(e.apiBaseUrl,t),this.screen=Of(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(i=>this.onSignal(i)),this.onPop=()=>this.onScreenView(Of()),window.addEventListener("popstate",this.onPop);let r=this.bumpSessionCount();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(!lx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(_i(),zd)),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(()=>(Pf(),Mf));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: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(()=>(Hi(),Gd));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>ax&&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()-cx;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(Lf),i=s?JSON.parse(s):{};if(i.sessionId===r&&typeof i.count=="number")return i.count;let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(Lf,JSON.stringify({sessionId:r,count:o})),o}catch{return 1}}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}};$();var zf={unreadCount:0,total:0,syncStatus:"idle"},os=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=zf;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(()=>(Bo(),No)).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(()=>($f(),qf)),Promise.resolve().then(()=>(Do(),Bf))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var k;return(k=this.ctx)==null?void 0:k.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(()=>(zo(),Ff)),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(()=>(Bo(),No));(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=zf,this.active=!1}};$();Ko();function Cx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var as=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(()=>(Wf(),Vf));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:Cx(),...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}};$();function Ax(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var cs=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:Ax(),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}};var Nx={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},ps=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(()=>(im(),sm));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:Nx}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var ms=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(()=>(fm(),pm));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 vs=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(()=>(Lm(),Pm));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,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 mh=()=>Promise.resolve().then(()=>(ch(),ah)),Ms=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 o,a;if(typeof document=="undefined"||typeof MutationObserver=="undefined")return;let{decideSampling:t}=await Promise.resolve().then(()=>(dh(),lh)),r=t(e.replaySampling,(o=e.sessionId)!=null?o:"");if(e.log("[replay] sampling:",r.reason,"(bucket",r.bucket+")"),!r.record)return;if(e.respectDnt){let{userOptedOutOfTracking:c}=await Promise.resolve().then(()=>(aa(),Hm));if(c()){e.log("[replay] dnt: skip");return}}if(e.replayCanvas){let{installWebGLPreserve:c}=await Promise.resolve().then(()=>(fh(),ph));this.uninstallWebGL=c()}let s=c=>{c.catch(()=>{})};s(Promise.resolve().then(()=>(sn(),Nr))),s(Promise.resolve().then(()=>(et(),_r))),s(Promise.resolve().then(()=>(pn(),ha))),s(Promise.resolve().then(()=>(ya(),ba))),s(Promise.resolve().then(()=>(Ar(),Wi))),s(Promise.resolve().then(()=>(Ea(),ka))),s(Promise.resolve().then(()=>(fa(),pa))),s(Promise.resolve().then(()=>(ws(),sa)));let i;try{({createRecorder:i}=await mh())}catch(c){await new Promise(l=>setTimeout(l,400)),{createRecorder:i}=await mh(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((a=c==null?void 0:c.message)!=null?a:c).slice(0,300)})}this.controller=await i(e,r)}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;(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}};var hh=[new $n,new Dn,new Un,new Jn,new Qn,new as,new ar,new fr,new hr,new gr,new wr,new is,new os,new cs,new ps,new ms,new vs,new Ms],_S={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 gh(n){var e;return(e=_S[n])!=null?e:["dom"]}$();function NS(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 y,b,x,S;let r=Ba(e),s=qa(r.debug),i=new kn(r),o=new En(r),a=new Tn(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new Mn;nc(),ic(),typeof((y=r.errors)==null?void 0:y.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),Qa((b=r.errors)==null?void 0:b.beforeBreadcrumb);let l=w=>{var C,M;let I=NS(w.kind);I&&((M=(C=c.get("config"))==null?void 0:C.entitlement)==null?void 0:M.call(C,I))===!1||(tc(w),sc(w),a.emit(w))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var w,I;return(I=(w=c.get("analytics"))==null?void 0:w.identity)==null?void 0:I.userId},emit:l,emitFor:(w,I)=>a.emitFor(w,I),egressPending:()=>a.pendingCount,trackEvent:(w,I)=>l({kind:"event",name:w,props:I,timestamp:Date.now()}),getAppState:()=>qt("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(w,I)=>{for(let C of u)try{C(w,I)}catch{}},onSignal:w=>(u.add(w),()=>u.delete(w)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(x=r.flags)==null?void 0:x.bootstrap,flagsRealtime:(S=r.flags)==null?void 0:S.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 w of hh)p[w.name]!==!1&&gh(w.name).every(I=>qt(I))&&c.add(w)};f();let m=new bn(r.consent.initial),h=!1,g=async()=>{var I;if(h)return;h=!0,f(),await c.setupAll(d),t!=null&&t.edge||await a.start();let w=(I=c.get("analytics"))==null?void 0:I.identity;if(w!=null&&w.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:w.userId,anonymousId:w.anonymousId,timestamp:Date.now()}),w){_e(w.superProps);let C=w.groups;if(C)for(let M of Object.keys(C))_e({[`group_${M}`]:C[M]});w.userId&&_e({userId:w.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},v={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:w=>{m.set(w?"granted":"denied"),w?(a.setConsentGranted(!0),g()):(a.setConsentGranted(!1),h&&c.teardownAll(),h=!1,a.discard())},get consentStatus(){return m.value}};return!r.consent.required||m.granted?await g():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:m.value}),v}};$();function BS(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function bh(n,e=[]){var t;return{clientReportId:`bug_${q()}`,...n.title?{title:j(n.title)}:{},message:j((t=n.message)!=null?t:""),...n.email?{email:n.email}:{},url:BS(),...e.length?{console:e.slice(-20)}:{},timestamp:P()}}$();sr();var Oa=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:rr},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(()=>(Ma(),Ta))).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(wn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),lc()){let a=Vs();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.reportBug(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(()=>(xh(),wh)).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),_e(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),_e({[`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(),ac(),(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=Pn(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),_e({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;ec({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){ol(e,t)}setContext(e,t){al(e,t)}setErrorLevel(e){cl(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(()=>(to(),Su));return r(e,t)}async reportBug(e){var t,r,s,i;if(!this.rt)return null;if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),null;if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),null;if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),null;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:[],l=bh({message:e.message,title:e.title,email:e.email},c),u=await this.rt.transport.submitBugReport(this.rt.session.sessionId,l);return await this.rt.pipeline.flush(),(i=u==null?void 0:u.id)!=null?i:null}catch{return null}}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 t,r,s,i,o,a;let e=this.analyticsFeature();return{pending:((r=(t=this.rt)==null?void 0:t.pipeline.pendingCount)!=null?r:0)+((s=e==null?void 0:e.pending)!=null?s:0),dropped:((o=(i=this.rt)==null?void 0:i.pipeline.dropped)!=null?o:0)+((a=e==null?void 0:e.dropped)!=null?a:0)}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}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:JS}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Ih(),Eh)).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(()=>(Mh(),Th));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=()=>{},Xe=()=>Promise.resolve(),Ph={unreadCount:0,total:0,syncStatus:"idle"},JS={subscribe:n=>(n(Ph),rt),onUnreadChange:n=>(n(0),rt),getState:()=>Ph,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Xe,markUnread:Xe,markAllRead:Xe,archive:Xe,unarchive:Xe,pin:Xe,remove:Xe,refresh:Xe,ingest:Xe,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new Oa;$();function QS(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)&&(s!=null&&s.apiBaseUrl)){let i={clientKey:s.clientKey,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;wn(n==null?void 0:n.nonce),QS(window,n)}})();
|
|
633
|
+
@media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ps=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.root=this.host.attachShadow({mode:"open"}),Ne(this.root,jS),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=VS(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=Zr({anchor:t,tooltip:r,boundary:WS(),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 Ah={};_(Ah,{CoachmarkFeature:()=>Aa});var Ch,Aa,Rh=E(()=>{"use strict";es();Ih();wo();Jr();ns();Ch="scalebun_coach_progress",Aa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ps;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new Dt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>ts(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 $p())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(Ch)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(Ch,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function Ls(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 Th,Ra=E(()=>{"use strict";Th={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 Ta={};_(Ta,{notInitializedReport:()=>QS,runPushDiagnostics:()=>JS});function KS(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function GS(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 YS(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 XS(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 JS(n){var m,h,g,k,v,y,b,x,S;let e=[],t=w=>(e.push(w),w),r=(w,I,C)=>{t({id:w,status:"unknown",label:I,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&&KS(),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"),Mh(e);let c=null;try{let w=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=w.ok,t({id:"sw_reachable",status:w.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${w.status}`,fix:w.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=(k=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?k:(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 w=await XS(l);!w||typeof w.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/.`}):w.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${w.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${w.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let w=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),I=w.ok?await w.json():null;p=(I==null?void 0:I.enabled)===!1?null:(x=I==null?void 0:I.vapidPublicKey)!=null?x: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 w=l?await l.pushManager.getSubscription():null;if(!w)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 I=w.toJSON(),C=typeof I.expirationTime=="number"&&I.expirationTime<=Date.now(),M=null;if(p){let A=(S=w.options)==null?void 0:S.applicationServerKey;M=A?YS(new Uint8Array(A),GS(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":w.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 w=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"}),I=w.ok?await w.json():null;if(!I)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${w.status}`}),r("identified","User is identified","the server did not answer");else{let C=I.tokenStatus==="dead";t({id:"device_registered",status:I.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:I.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:I.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:I.identified?"pass":"warn",label:"User is identified",detail:I.identified?"Bound to a person":"Anonymous device",fix:I.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 Mh(e)}function QS(){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 Mh(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 Ma=E(()=>{"use strict"});var Lh={};_(Lh,{DEFAULT_SW_URL:()=>Pa,EXPECTED_SW_VERSION:()=>Ph,PUSH_STATE_COPY:()=>Th,PushFeature:()=>La,resolvePushState:()=>Ls});function _s(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function ZS(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 Ph,Pa,mn,La,_h=E(()=>{"use strict";Ra();Ra();Ph=5,Pa="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=Pa;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(!_s())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||Pa;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:ZS(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||(_s()?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||(_s()?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(()=>(Ma(),Ta));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:Ph})}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=_s(),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:Ls({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";La=mn});var Da="https://api.scalebun.com/api/v1";var Fh=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ha(n){var t,r,s,i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,H,V,K,de,me,se,Ue,Ve,G,ie,X,Y,ee,T,L,N,F,W,re,ge,he,Ie,Ce,Ae,Je,st,ke,gn,Oa,Na,Ba,Fa;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=((t=n.apiBaseUrl)!=null?t:Da).replace(/\/$/,"");return{clientKey:n.clientKey,apiBaseUrl:e,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(r=n.flushIntervalMs)!=null?r: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:(s=n.replayCanvas)!=null?s:!1,signSessionLane:(i=n.signSessionLane)!=null?i:!1,replayFrameOrigins:(o=n.replayFrameOrigins)!=null?o:[],autocapture:(a=n.autocapture)!=null?a:!0,tracePropagation:(c=n.tracePropagation)!=null?c:!0,tracePropagationOrigins:(l=n.tracePropagationOrigins)!=null?l:[],maxBatchSize:(u=n.maxBatchSize)!=null?u:50,maxQueueSize:(d=n.maxQueueSize)!=null?d:1e3,debug:(p=n.debug)!=null?p:!1,features:{errors:(m=(f=n.features)==null?void 0:f.errors)!=null?m:!0,network:(g=(h=n.features)==null?void 0:h.network)!=null?g:!0,console:(v=(k=n.features)==null?void 0:k.console)!=null?v:!0,webVitals:(b=(y=n.features)==null?void 0:y.webVitals)!=null?b:!0,performance:(S=(x=n.features)==null?void 0:x.performance)!=null?S:!0,journey:(I=(w=n.features)==null?void 0:w.journey)!=null?I:!0,replay:(M=(C=n.features)==null?void 0:C.replay)!=null?M:!1,bugReport:(A=(R=n.features)==null?void 0:R.bugReport)!=null?A:!0,crash:(z=(O=n.features)==null?void 0:O.crash)!=null?z:!0,config:(te=(D=n.features)==null?void 0:D.config)!=null?te:!0,engage:(Q=(J=n.features)==null?void 0:J.engage)!=null?Q:!0,analytics:(ce=(fe=n.features)==null?void 0:fe.analytics)!=null?ce:!0,webPerf:(Se=(xe=n.features)==null?void 0:xe.webPerf)!=null?Se:!0,profiler:(H=(le=n.features)==null?void 0:le.profiler)!=null?H:!1,watchdog:(K=(V=n.features)==null?void 0:V.watchdog)!=null?K:!1,inbox:(me=(de=n.features)==null?void 0:de.inbox)!=null?me:!1,inapp2:(Ue=(se=n.features)==null?void 0:se.inapp2)!=null?Ue:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(G=(Ve=n.privacy)==null?void 0:Ve.captureNetworkBodies)!=null?G:!1,denylist:[...Fh,...(X=(ie=n.privacy)==null?void 0:ie.denylist)!=null?X:[]].map(Nh=>Nh.toLowerCase()),maskSelectors:(ee=(Y=n.privacy)==null?void 0:Y.maskSelectors)!=null?ee:[],maskReplayText:(L=(T=n.privacy)==null?void 0:T.maskReplayText)!=null?L:!1,maskInputs:(re=(W=(N=n.privacy)==null?void 0:N.maskInputs)!=null?W:(F=n.privacy)==null?void 0:F.maskReplayText)!=null?re:!1,respectDnt:(he=(ge=n.privacy)==null?void 0:ge.respectDnt)!=null?he:!1,maskEventText:(Ce=(Ie=n.privacy)==null?void 0:Ie.maskEventText)!=null?Ce:!1},consent:{required:(Ae=n.requireConsent)!=null?Ae:!1,initial:(Je=n.initialConsent)!=null?Je:"unknown"},bugReport:{launcher:(ke=(st=n.bugReportOptions)==null?void 0:st.launcher)!=null?ke:!1,position:(Oa=(gn=n.bugReportOptions)==null?void 0:gn.position)!=null?Oa:"bottom-right",label:(Ba=(Na=n.bugReportOptions)==null?void 0:Na.label)!=null?Ba:"Report a bug"},...(Fa=n.engageOptions)!=null&&Fa.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}q();q();Sn();var kn=class{constructor(e){this.config=e;var r,s;let t=hc((r=e.sessionTimeoutMs)!=null?r:Ut,(s=e.sessionMaxDurationMs)!=null?s:Gs);this.sessionId=t.id,this.deviceId=qa()}client(){return Wa()}device(){return ja(this.deviceId)}app(){return Ka(this.config)}context(){return gc(),Ga()}};Sn();var In=class In{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(()=>(Qs(),Js));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c;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:Ut,startedAt:Date.now()})}async sendBatch(e,t){let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`;return this.post(r,e,t==null?void 0:t.keepalive)}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!1;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>In.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(xc(),wc)),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}catch{return!1}}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)})}};In.GZIP_MIN_BYTES=1024;var En=In;Vt();q();Cn();Rn();var dg=1,Tn=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new xt;this.flushing=!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;try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=An(s,o=>o.timestamp,P());this.droppedCount+=s.length-i.length,i.length&&(r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}),this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush()}}emit(e){if(!this.consentGranted){this.droppedCount++;return}this.queue.length>=this.config.maxQueueSize&&(this.queue.shift(),this.droppedCount++),this.queue.push(e)}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,St(e,t=>t.kind==="frame")])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){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.transport.sendBatch(this.buildEnvelope(t),e)?(this.backoff.reset(),this.inFlight=[]):(this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue())}catch{this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}}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=!1;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}r||this.buffer.save([e,t])}buildEnvelope(e){return{schemaVersion:dg,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}};function ug(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Mn=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:ug(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}};q();var Ec={drop:!1,warnings:[]};function Ic(n,e,t){var o,a;if(!n||e.startsWith("$"))return Ec;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`]}:Ec;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 pg=/^[A-Za-z]{3}$/;function fg(n){return pg.test(n)?n.toUpperCase():n}function Pn(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:fg(t),props:d}}var mg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],hg=new Set(["trial_started","trial_converted","started","plan_changed"]);function Ln(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 Cc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!mg.includes(t))return null;let r=n.plan;return hg.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)}:{},...Ln(n.trialEndAt)?{trialEndAt:Ln(n.trialEndAt)}:{},...Ln(n.effectiveAt)?{effectiveAt:Ln(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var bg="wzb-analytics-v1",yg=new Set(["$identify","$group","$alias","purchase"]);function Ac(n,e,t){return t>=1||yg.has(n)?!0:t<=0?!1:Ee(`${e}:${bg}`)%1e4<t*1e4}Vt();Cn();Rn();var qg=50,zg=5e3,Ug=2e3,Qe="scalebun_anonymous_id",ri="scalebun_user_id",Fn="scalebun_super_props",ti="scalebun_groups",Gc="scalebun_installation_id",Yc="scalebun_first_open_done",si="scalebun_attribution_click_id",Xc="scalebun_attribution",Qc=/^[0-9a-f]{16,64}$/i,Vg=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function Wg(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(Xc);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 Vg){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(Xc,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var jg="pending-analytics";function Kg(){try{if(typeof localStorage!="undefined")return localStorage.getItem(ri)||void 0}catch{}}function ni(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(ri,n):localStorage.removeItem(ri)}catch{}}function ii(){return`anon_${$()}`}function Jc(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 jt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function Gg(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 oi(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 Yg(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(Gc))!=null?r:"",e||(e=n||`web_${$()}`,localStorage.setItem(Gc,e)),t=(s=localStorage.getItem(si))!=null?s:void 0)}catch{}e||(e=n||`web_${$()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&Qc.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(si,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 Xg(n){if(n){let t=Gg(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:ii();return t||localStorage.setItem(Qe,r),n&&oi(Qe,r,n),r}}catch{}let e=ii();return n&&oi(Qe,e,n),e}var Dn=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=Kg();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(jg);this.persisted=!1;this.backoff=new xt;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=Yg(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=Wg();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Xg(this.cookieDomain),this.superProps=Jc(Fn),this.groups=Jc(ti),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(),zg),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Sc(()=>{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=An(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(()=>(Kc(),jc)).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(Yc)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(Yc,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!Qc.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(si,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:$(),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:Bs}}}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=Ic(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},jt(Fn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,jt(Fn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},jt(ti,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,ni(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ni(void 0),this.anonymousId=ii();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&oi(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},jt(Fn,this.superProps),jt(ti,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Ac(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=Pn(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=Cc(e);if(!t)return;let r=ne();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ni(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=qg&&this.autoFlush()}trim(){let e=this.queue.length-Ug;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(()=>(Qs(),Js)),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(St(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}};q();Fe();function Jg(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 Zc(n,e){let t=Jg(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 Qg(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=>Zc(n,c)),i=r.length===0||r.some(c=>Zc(n,c));return s&&i}function Kt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Qg(e,t))return t;return null}var el="scalebun_config",ai="scalebun_flag_overrides";function Hn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function tl(){let n=Hn();if(!n)return null;try{let e=n.getItem(el);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 nl(n){let e=Hn();if(e)try{e.setItem(el,JSON.stringify(n))}catch{}}function rl(){let n=Hn();if(!n)return{};try{let e=n.getItem(ai),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function $n(n){let e=Hn();if(e)try{Object.keys(n).length?e.setItem(ai,JSON.stringify(n)):e.removeItem(ai)}catch{}}var ci={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var Zg=5*60*1e3,sl=n=>{var e;return(e=n.salt)!=null?e:n.key},qn=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=ci;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=rl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:tl())!=null?o:ci,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Zg&&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},nl(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,$n(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],$n(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},$n(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=bt();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=Kt(t.targeting,bt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),sl(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(k=>k.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=Zs(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=Kt(r.targeting,bt());if(d)return typeof d.rollout=="number"?Le(i(),sl(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=Kt(t.targeting,bt());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=Kt(t.targeting,bt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=Zs(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}};q();q();function il(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function ol(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 al=16*1024;function cl(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>al&&(c=c.slice(0,al)),c=il(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}:{},...eb(),...tb(),screenName:nb(),clientId:`err_${$()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=ol(r))!=null?f:{}}}function eb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function tb(){let n=ne();return n?{replay:n}:{}}function nb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var zn=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 Et={tags:{},context:{}};function ll(n,e){Et.tags[n]=e}function dl(n,e){Et.context[n]=e}function ul(n){Et.level=n}function pl(n){var i;let e={...Et.tags,...n==null?void 0:n.tags},t={...Et.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:Et.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var rb="wzb-errors-v1";function fl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,rb)<n*100:!0}q();var db=()=>[];function ub(n){if(!n)return"";let e=n.split(`
|
|
634
|
+
`).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var El=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Il(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Un=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new zn;this.ignore=El;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=[...El,...(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=fl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(kl(),Sl)).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(Il(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Il(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:db):void 0,o=cl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:pl(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 di;function pb(){return di||(di=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Vn(n){try{let e=pb();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function Wn(n){try{return n==null?void 0:typeof n=="string"?Vn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Vn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Gt(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 Cl(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var k,v,y,b,x,S,w,I,C,M,R;let c=mb(o),l=hb(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((k=a==null?void 0:a.headers)!=null?k: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=bb(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=Wn(d==null?void 0:d.body))!=null?y:Gt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Gt((x=(b=A.headers)==null?void 0:b.get)==null?void 0:x.call(b,"content-length")),reqBody:h,reqContentType:(w=(S=g==null?void 0:g.get)==null?void 0:S.call(g,"content-type"))!=null?w:void 0,resContentType:(M=(C=(I=A.headers)==null?void 0:I.get)==null?void 0:C.call(I,"content-type"))!=null?M:void 0,readResponseText:O?()=>fb(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 jn=64*1024;async function fb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>jn?i.slice(0,jn):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>=jn){try{await t.cancel()}catch{}return s.slice(0,jn)}}return r&&(s+=r.decode()),s}catch{return null}}function mb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function hb(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 bb(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 Al(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=Wn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let k=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:vb(this),error:k?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 vb(n){var t;let e=Gt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Vn(n.responseText):void 0}catch{return}}q();function Rl(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 wb(t)?"abort":xb(t)?"timeout":Sb(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function Tl(n,e=2e3){return typeof n=="number"&&n>=e}function wb(n){return/\babort(ed)?\b/i.test(n)}function xb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function Sb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var kb=/^(?:\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 Eb(n){return n?!!(kb.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Ml(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&&Eb(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Pl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?Rl({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=Tl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Ml(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:Ib(),...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_${$()}`,timestamp:P()}}function Ib(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Ll(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 Cb(){let n=Ll(16),e=Ll(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Ab(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function _l(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=Ab(t);return r&&e.has(r)?Cb():null}}var Rb=new Set(["fetch","xmlhttprequest"]);function Tb(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 It=class It{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;Rb.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>It.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?Tb(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-It.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()}};It.TTL_MS=6e4,It.MAX_PER_URL=8;var Gn=It;Fe();function Ol(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 Yn=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 Nb(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Jn=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Gn;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 Yn(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=_l((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(Cl(window,o,i,a)),this.uninstalls.push(Al(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(()=>($l(),Hl)).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=>Nb(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(()=>(Yl(),Gl)).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=Pl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!Ol({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 Xl(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function yi(){return{max:0,cur:0,first:0,last:0}}function Jl(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 Ql(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function vi(n){if(n)return n.replace(/[?#].*$/,"")}function Zl(){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 ed(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 td(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 Bb={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function nd(n,e){let t=Bb[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function wi(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(`#${rd(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${rd(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=Fb(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function Fb(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function rd(n){return n.replace(/([^\w-])/g,"\\$1")}function sd(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 id(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=wi(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=Xt(i)),o!==void 0&&(a.renderTime=Xt(o)),a}function xi(){return{largestValue:0,sources:[]}}function od(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:wi(l),previousRect:sd(c.previousRect),currentRect:sd(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function ad(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function Si(){return{duration:0}}function cd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=Db(t))}return n}function Db(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=wi(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=Xt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Xt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Xt(Math.max(0,t+i-s))),o}function ld(n){return n.duration>0?n.attribution:void 0}function Xt(n){return Math.round(n)}q();var Zn=class Zn{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=yi();this.inp=0;this.clsAcc=xi();this.inpAcc=Si();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=Xl(t);r&&(this.lcp=r,this.lcpAttr=(s=id(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=vi(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{Jl(this.clsState,t),od(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=Ql(this.inp,t),cd(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>=Zn.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=vi(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=ud(dd()),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:Zl()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=ed(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=ld(this.inpAcc);if(t&&this.inpWindow){let r=td(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",ad(this.clsAcc)),this.lcp=this.inp=0,this.clsState=yi(),this.lcpAttr=void 0,this.clsAcc=xi(),this.inpAcc=Si(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=ud(dd());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_${$()}`,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:nd(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}};Zn.LOAF_CAP=30;var Qn=Zn;function dd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function ud(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}q();ki();q();var Hb=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Jt(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:Hb(),clientId:`perf_${$()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Qt=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 tr=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}};q();function md(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 hd(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 $b=new Set(["fetch","xmlhttprequest","beacon"]);function qb(n){return n.replace(/[?#].*$/,"")}function Zt(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ei="";function gd(n){Ei=(n!=null?n:"").replace(/\/$/,"")}function zb(n){return!!Ei&&n.startsWith(Ei)}function bd(n){if($b.has(n.initiatorType)||zb(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:qb(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",Zt(n.domainLookupStart,n.domainLookupEnd)),r("tcp",Zt(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?Zt(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",Zt(n.requestStart,n.responseStart)),r("download",Zt(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 yd(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 Ub="wzb-traces-v1";function vd(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${Ub}`)%100<n.sampleRate*100}sr();var Wb=1e3,jb=3e3,Kb=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function Gb(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var ar=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Qt;this.resCap=new Qt({capCount:100,windowMs:1e4});this.traces=new tr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=jb;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,gd(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(()=>(Ad(),Cd)).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(yd(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}Gb()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,hd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,md(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=bd(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(Jt("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(Jt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;pd({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 rr;let t=new this.engine.Transaction(e,{clock:Kb,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")),!vd({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(Jt("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(),Wb))}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(Jt(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}};q();var lr=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=cr(),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?Yb(l):cr())};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=cr()){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 cr(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Yb(n){try{return new URL(n).pathname}catch{return cr()}}var dr=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}},ur=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=Rd(),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&&Rd()===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 Rd(){try{return typeof location!="undefined"?location.href:""}catch{return""}}var pr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new dr((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new ur((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;let t=e,r=Date.now(),s=e.target;if(!s||!s.tagName)return;let i=Zb(s,this.maskText),o=ey(s),a=Xb(t),c=Jb(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&&((d=this.signal)==null||d.call(this,"rage")),this.dead.onClick(r,()=>{var p;this.emit("USER_ACTION",{action:"click",...a,selector:o,...c,dead:!0},i),(p=this.signal)==null||p.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 Xb(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 Jb(n){var s;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=(s=n.closest("[data-scalebun-component]"))==null?void 0:s.getAttribute("data-scalebun-component");return r&&(t.component=r),t}var Qb=n=>n.replace(/\S/g,"*");function Zb(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Qb(r):r}`:t}function ey(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 fr=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 lr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new pr((t,r,s)=>this.emit(t,r,s,Td()),{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:Td(),eventId:`evt_${$()}`,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 Td(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Ns();q();var ty={maxDepth:4,maxBreadth:50,maxLength:8192};function Ci(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=>Ci(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=Ci(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 Md(n,e){let t={...ty,...e},r;try{r=n.map(s=>Ci(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 Pd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Ai(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var ny=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Ld(n,e,t=0){let r=Ai(n),s=j(Md(e)),i={method:n},o=ny();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Pd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${$()}`,metadata:i,timestamp:P()}}var mr=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 ry=["debug","info","log","warn","error"],sy=50,hr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new mr;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 ry){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]===Os)){this.capturing=!0;try{if(!this.throttle.accept(Ai(e)))return;let s=Ld(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>sy&&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 gr=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(()=>(Od(),_d));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve(null)})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};q();var Nd="scalebun:tab",Bd="scalebun:live:";function Ti(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ly(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Ri(){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 Fd(){let n=ly();if(!n)return`mem-${Ri()}`;try{let e=n.getItem(Nd);if(e)return e;let t=Ri();return n.setItem(Nd,t),t}catch{return`mem-${Ri()}`}}var Mi=n=>`${Bd}${n}`;function br(n){let e=Ti();if(!e)return null;try{let t=e.getItem(Mi(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 yr(n,e){let t=Ti();if(t)try{t.setItem(Mi(n),JSON.stringify(e))}catch{}}function vr(n,e){let t=br(n);t&&(t.ended=e,t.lastActive=Date.now(),yr(n,t))}function Dd(n){let e=br(n);e&&(e.lastActive=Date.now(),yr(n,e))}function Hd(n,e){let t=Ti();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Bd)||i===Mi(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 dy=15e3,wr=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_${$()}`),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=Fd();let t=br(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();yr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=$d())!=null?s:"",ended:!1}),Hd(this.tabId,r),this.onHide=()=>vr(this.tabId,!0),this.onShow=()=>vr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Dd(this.tabId),dy)}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:$d(),clientId:`crash_${$()}`,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&&vr(this.tabId,!0),this.active=!1}};function $d(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}q();Vt();var uy=50,xr=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(-uy);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 dx=32,ux=3e4,Nf="scalebun_engage_sessions";function Bf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function px(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var is=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 s;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(s=e.clientKey)!=null?s:"";if(!t||!e.apiBaseUrl)return;this.transport=new xr(e.apiBaseUrl,t),this.screen=Bf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(i=>this.onSignal(i)),this.onPop=()=>this.onScreenView(Bf()),window.addEventListener("popstate",this.onPop);let r=this.bumpSessionCount();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(!px(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Oi(),Wd)),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(()=>(Of(),_f));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:$,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(()=>(Hi(),Jd));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>dx&&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()-ux;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(Nf),i=s?JSON.parse(s):{};if(i.sessionId===r&&typeof i.count=="number")return i.count;let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(Nf,JSON.stringify({sessionId:r,count:o})),o}catch{return 1}}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}};q();var Wf={unreadCount:0,total:0,syncStatus:"idle"},os=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=Wf;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(()=>(Bo(),No)).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(()=>(Vf(),Uf)),Promise.resolve().then(()=>(Do(),Hf))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var k;return(k=this.ctx)==null?void 0:k.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(()=>(zo(),$f)),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(()=>(Bo(),No));(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=Wf,this.active=!1}};q();Ko();function Tx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var as=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(()=>(Gf(),Kf));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:Tx(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${$()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};q();function Mx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var cs=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:Mx(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${$()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}};var Dx={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},ps=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(()=>(cm(),am));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:Dx}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var ms=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(()=>(gm(),hm));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 vs=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(()=>(Nm(),Om));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,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 bh=()=>Promise.resolve().then(()=>(uh(),dh)),Ms=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 o,a;if(typeof document=="undefined"||typeof MutationObserver=="undefined")return;let{decideSampling:t}=await Promise.resolve().then(()=>(fh(),ph)),r=t(e.replaySampling,(o=e.sessionId)!=null?o:"");if(e.log("[replay] sampling:",r.reason,"(bucket",r.bucket+")"),!r.record)return;if(e.respectDnt){let{userOptedOutOfTracking:c}=await Promise.resolve().then(()=>(aa(),zm));if(c()){e.log("[replay] dnt: skip");return}}if(e.replayCanvas){let{installWebGLPreserve:c}=await Promise.resolve().then(()=>(gh(),hh));this.uninstallWebGL=c()}let s=c=>{c.catch(()=>{})};s(Promise.resolve().then(()=>(sn(),Nr))),s(Promise.resolve().then(()=>(et(),Or))),s(Promise.resolve().then(()=>(pn(),ha))),s(Promise.resolve().then(()=>(ya(),ba))),s(Promise.resolve().then(()=>(Ar(),Wi))),s(Promise.resolve().then(()=>(Ea(),ka))),s(Promise.resolve().then(()=>(fa(),pa))),s(Promise.resolve().then(()=>(ws(),sa)));let i;try{({createRecorder:i}=await bh())}catch(c){await new Promise(l=>setTimeout(l,400)),{createRecorder:i}=await bh(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((a=c==null?void 0:c.message)!=null?a:c).slice(0,300)})}this.controller=await i(e,r)}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;(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}};var yh=[new qn,new Dn,new Un,new Jn,new Qn,new as,new ar,new fr,new hr,new gr,new wr,new is,new os,new cs,new ps,new ms,new vs,new Ms],FS={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 vh(n){var e;return(e=FS[n])!=null?e:["dom"]}q();function DS(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 y,b,x,S;let r=Ha(e),s=Ua(r.debug),i=new kn(r),o=new En(r),a=new Tn(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new Mn;ic(),cc(),typeof((y=r.errors)==null?void 0:y.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),tc((b=r.errors)==null?void 0:b.beforeBreadcrumb);let l=w=>{var C,M;let I=DS(w.kind);I&&((M=(C=c.get("config"))==null?void 0:C.entitlement)==null?void 0:M.call(C,I))===!1||(sc(w),ac(w),a.emit(w))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var w,I;return(I=(w=c.get("analytics"))==null?void 0:w.identity)==null?void 0:I.userId},emit:l,emitFor:(w,I)=>a.emitFor(w,I),egressPending:()=>a.pendingCount,trackEvent:(w,I)=>l({kind:"event",name:w,props:I,timestamp:Date.now()}),getAppState:()=>$t("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(w,I)=>{for(let C of u)try{C(w,I)}catch{}},onSignal:w=>(u.add(w),()=>u.delete(w)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(x=r.flags)==null?void 0:x.bootstrap,flagsRealtime:(S=r.flags)==null?void 0:S.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 w of yh)p[w.name]!==!1&&vh(w.name).every(I=>$t(I))&&c.add(w)};f();let m=new bn(r.consent.initial),h=!1,g=async()=>{var I;if(h)return;h=!0,f(),await c.setupAll(d),t!=null&&t.edge||await a.start();let w=(I=c.get("analytics"))==null?void 0:I.identity;if(w!=null&&w.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:w.userId,anonymousId:w.anonymousId,timestamp:Date.now()}),w){Oe(w.superProps);let C=w.groups;if(C)for(let M of Object.keys(C))Oe({[`group_${M}`]:C[M]});w.userId&&Oe({userId:w.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},v={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:w=>{m.set(w?"granted":"denied"),w?(a.setConsentGranted(!0),g()):(a.setConsentGranted(!1),h&&c.teardownAll(),h=!1,a.discard())},get consentStatus(){return m.value}};return!r.consent.required||m.granted?await g():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:m.value}),v}};q();function HS(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function wh(n,e=[]){var t;return{clientReportId:`bug_${$()}`,...n.title?{title:j(n.title)}:{},message:j((t=n.message)!=null?t:""),...n.email?{email:n.email}:{},url:HS(),...e.length?{console:e.slice(-20)}:{},timestamp:P()}}q();sr();var _a=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:rr},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(()=>(Ma(),Ta))).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(wn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),pc()){let a=Vs();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.reportBug(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(()=>(Eh(),kh)).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(),dc(),(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=Pn(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;rc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){ll(e,t)}setContext(e,t){dl(e,t)}setErrorLevel(e){ul(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_${$()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(to(),Iu));return r(e,t)}async reportBug(e){var t,r,s,i;if(!this.rt)return null;if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),null;if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),null;if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),null;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:[],l=wh({message:e.message,title:e.title,email:e.email},c),u=await this.rt.transport.submitBugReport(this.rt.session.sessionId,l);return await this.rt.pipeline.flush(),(i=u==null?void 0:u.id)!=null?i:null}catch{return null}}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 t,r,s,i,o,a;let e=this.analyticsFeature();return{pending:((r=(t=this.rt)==null?void 0:t.pipeline.pendingCount)!=null?r:0)+((s=e==null?void 0:e.pending)!=null?s:0),dropped:((o=(i=this.rt)==null?void 0:i.pipeline.dropped)!=null?o:0)+((a=e==null?void 0:e.dropped)!=null?a:0)}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}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:ek}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Rh(),Ah)).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(()=>(_h(),Lh));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=()=>{},Xe=()=>Promise.resolve(),Oh={unreadCount:0,total:0,syncStatus:"idle"},ek={subscribe:n=>(n(Oh),rt),onUnreadChange:n=>(n(0),rt),getState:()=>Oh,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Xe,markUnread:Xe,markAllRead:Xe,archive:Xe,unarchive:Xe,pin:Xe,remove:Xe,refresh:Xe,ingest:Xe,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new _a;q();function tk(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;wn(n==null?void 0:n.nonce),tk(window,n)}})();
|
|
635
635
|
//# sourceMappingURL=scalebun.min.js.map
|