@stacksjs/mobile 0.75.285 → 0.75.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -537,3 +537,25 @@ planned ID whose sensor never started does not authorize adopting another
537
537
  native recording. Native start refuses active, archived, or acknowledged
538
538
  ID reuse. The ordinary no-ID API remains available for legacy callers;
539
539
  owned workout recovery requires the registered-ID protocol.
540
+
541
+ ### Voice recordings
542
+
543
+ `createVoiceRecorder({ maxSeconds: 300, maxBytes: 12 * 1024 * 1024 })` creates an
544
+ owned microphone session for a browser or a native screen. Subscribe to its
545
+ `idle`, `requesting`, `recording`, `ready` and `error` snapshots, call `start()`
546
+ from a user gesture, then `stop()`. A ready snapshot contains a browser `Blob`
547
+ or a native file descriptor. `voiceRecordingFormData(audio, { client_key })`
548
+ builds a multipart body through the current host, preserving a native file
549
+ descriptor instead of coercing it to a browser Blob. The helper rejects a
550
+ native descriptor if the upload host would turn it into text.
551
+ Call `cancel()` after the upload or when switching accounts, and `dispose()`
552
+ when the screen ends. Both release the microphone and discard the retained
553
+ recording; late permission answers cannot start an abandoned session.
554
+
555
+ Native builds require `capabilities.audioRecording: true`, Craft >= 0.0.324 and
556
+ STX >= 0.2.678. The builders declare microphone permission; recording still
557
+ requires the person's permission. Native recordings use a private temporary
558
+ file and stop when the app backgrounds. iOS additionally binds pending capture
559
+ to the native screen lifetime. The helper never uploads automatically: let the
560
+ person review a transcript before sending feedback. Decode and enforce limits
561
+ again on the server with `@stacksjs/audio` `prepareSpeechAudio`.
package/dist/index.d.ts CHANGED
@@ -2037,20 +2037,25 @@ declare const storage: StorageApi;
2037
2037
  declare const crypto: CryptoApi;
2038
2038
 
2039
2039
  // From: src/voice-recorder.ts
2040
- declare function createVoiceRecorder(options?: VoiceRecorderOptions): {
2041
- start: unknown;
2042
- cancel: unknown;
2043
- dispose: () => void;
2044
- stop: () => void;
2045
- supported: () => boolean;
2046
- snapshot: () => unknown;
2047
- subscribe: (listener: (value: VoiceRecorderSnapshot) => void) => () => void
2048
- };
2040
+ declare function createVoiceRecorder(options?: VoiceRecorderOptions): VoiceRecorder;
2041
+ /** Build an upload using the host's real FormData; native recordings remain file descriptors. */
2042
+ declare function voiceRecordingFormData(audio: Blob | NativeVoiceFile, fields?: Record<string, string>, name?: string): FormData;
2049
2043
  /** A bounded, disposable microphone session. Audio is never persisted by this helper. */
2050
2044
  declare interface VoiceRecorderOptions { maxSeconds?: number, maxBytes?: number }
2051
- declare interface VoiceRecorderSnapshot { status: VoiceRecorderStatus, audio: Blob | null, error: string | null }
2045
+ declare interface NativeVoiceFile { path: string, name: string, type: string, size: number, durationSeconds: number }
2046
+ declare interface VoiceRecorderSnapshot { status: VoiceRecorderStatus, audio: Blob | NativeVoiceFile | null, error: string | null }
2047
+ /** Stable public contract shared by browser and native recording hosts. */
2048
+ declare interface VoiceRecorder {
2049
+ start: () => Promise<void>
2050
+ stop: () => Promise<void>
2051
+ cancel: () => void
2052
+ dispose: () => void
2053
+ supported: () => boolean
2054
+ snapshot: () => VoiceRecorderSnapshot
2055
+ subscribe: (listener: (value: VoiceRecorderSnapshot) => void) => () => void
2056
+ }
2052
2057
  type VoiceRecorderStatus = 'idle' | 'requesting' | 'recording' | 'ready' | 'error';
2053
2058
 
2054
- export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, VoiceRecorderOptions, VoiceRecorderSnapshot, VoiceRecorderStatus, createVoiceRecorder, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, presentChoice, presentAlert, presentConfirm, presentActionSheet, placeMenu, presentContextMenu, applyAppearance, pageBackground, pageIsDark, installNativeChrome, NativeChromeOptions, readSpotlightKinds, spotlightKind, spotlightAction, spotlightSlot, spotlightActions, spotlightActivityTypes, spotlightTitle, placeSpotlightItem, removeSpotlightItem, spotlightRoute, readSpotlightEntries, spotlightBridge, createSpotlightIndex, onSpotlightTap, MAX_SPOTLIGHT_SLOTS_PER_KIND, SpotlightKind, SpotlightKindInput, SpotlightItem, SpotlightEntry, SpotlightKindsResult, SpotlightPlacement, SpotlightBridge, SpotlightIndexOptions, SpotlightIndex, readTabLinks, nativeTabs, routerHandlesTabs, handleTabReselect, coverTabBar, mirrorTabBar, tabBar, TAB_BAR_COVER_EVENT, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, RecordingStartOptions, LocationRecordingOptions, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, StorageApi, CryptoApi, SecureStorageApi, RecordingOwnershipOptions, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthQuantitySample, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthSampleType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod, storage, crypto };
2059
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, NativeVoiceFile, VoiceRecorder, VoiceRecorderOptions, VoiceRecorderSnapshot, VoiceRecorderStatus, createVoiceRecorder, voiceRecordingFormData, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, presentChoice, presentAlert, presentConfirm, presentActionSheet, placeMenu, presentContextMenu, applyAppearance, pageBackground, pageIsDark, installNativeChrome, NativeChromeOptions, readSpotlightKinds, spotlightKind, spotlightAction, spotlightSlot, spotlightActions, spotlightActivityTypes, spotlightTitle, placeSpotlightItem, removeSpotlightItem, spotlightRoute, readSpotlightEntries, spotlightBridge, createSpotlightIndex, onSpotlightTap, MAX_SPOTLIGHT_SLOTS_PER_KIND, SpotlightKind, SpotlightKindInput, SpotlightItem, SpotlightEntry, SpotlightKindsResult, SpotlightPlacement, SpotlightBridge, SpotlightIndexOptions, SpotlightIndex, readTabLinks, nativeTabs, routerHandlesTabs, handleTabReselect, coverTabBar, mirrorTabBar, tabBar, TAB_BAR_COVER_EVENT, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, RecordingStartOptions, LocationRecordingOptions, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, StorageApi, CryptoApi, SecureStorageApi, RecordingOwnershipOptions, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthQuantitySample, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthSampleType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod, storage, crypto };
2055
2060
  export { NativeTab } from 'craft-native/mobile';
2056
2061
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as Jn,biometrics as De,brightness as be,camera as ve,deepLinks as Mt,device as Q,haptics as ye,health as se,heartRate as k,keepAwake as Nt,lifecycle as Zn,liveActivities as _e,location as H,music as F,network as Ht,notifications as Se,permissions as le,pushNotifications as Be,secureStorage as we,share as Dt,speech as Fe,snapshots as xe,splash as er,watchConnectivity as ce}from"craft-native/mobile";var kr=2500;function R(){if(typeof window>"u")return;return window}function V(){let e=R()?.craft;return e&&typeof e==="object"?e:void 0}function $t(){return typeof navigator>"u"?"":navigator.userAgent||""}function ee(){let e=R();if(!e)return!1;if(e.CraftAndroid)return!0;let t=V()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test($t())}function ue(){let e=R();if(!e||e.craft)return!1;return ee()||Boolean(e.webkit?.messageHandlers?.craft)}function X(e=15000){let t=R();if(t?.craft)return Promise.resolve(!0);if(!t||!ue())return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(Boolean(t.craft))},o=setTimeout(r,e);t.addEventListener("craftReady",r)})}function Kt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function M(e){return Kt(V(),e)}async function jt(e,t=2500){let n=M(e);if(n||!ue())return n;return await X(t),M(e)}async function v(e,t,n,r={}){let o=await jt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function p(e,t=2500){if(ue())await X(t);return e()}function Y(e,t=2500){let n,r=!1;if(!ue())n=e();else X(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function _(e,t){let n=R();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var Ue="native-dialog-styles",qt=`
1
+ import{appReview as Zn,biometrics as De,brightness as be,camera as ve,deepLinks as Mt,device as Q,haptics as ye,health as se,heartRate as T,keepAwake as Nt,lifecycle as er,liveActivities as _e,location as D,music as U,network as Ht,notifications as Se,permissions as le,pushNotifications as Be,secureStorage as we,share as Dt,speech as Fe,snapshots as xe,splash as tr,watchConnectivity as ce}from"craft-native/mobile";var Er=2500;function E(){if(typeof window>"u")return;return window}function G(){let e=E()?.craft;return e&&typeof e==="object"?e:void 0}function $t(){return typeof navigator>"u"?"":navigator.userAgent||""}function ee(){let e=E();if(!e)return!1;if(e.CraftAndroid)return!0;let t=G()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test($t())}function ue(){let e=E();if(!e||e.craft)return!1;return ee()||Boolean(e.webkit?.messageHandlers?.craft)}function X(e=15000){let t=E();if(t?.craft)return Promise.resolve(!0);if(!t||!ue())return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(Boolean(t.craft))},o=setTimeout(r,e);t.addEventListener("craftReady",r)})}function Kt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function I(e){return Kt(G(),e)}async function jt(e,t=2500){let n=I(e);if(n||!ue())return n;return await X(t),I(e)}async function v(e,t,n,r={}){let o=await jt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function p(e,t=2500){if(ue())await X(t);return e()}function Y(e,t=2500){let n,r=!1;if(!ue())n=e();else X(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function F(e,t){let n=E();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var Ue="native-dialog-styles",zt=`
2
2
  .native-dialog { position: fixed; inset: 0; z-index: 2147483000; font-size: var(--native-font-size, 17px); font-family: var(--native-font-family, -apple-system, system-ui, sans-serif); -webkit-tap-highlight-color: transparent; }
3
3
  .native-dialog-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.3); opacity: 0; transition: opacity 220ms ease; }
4
4
  .native-dialog--menu .native-dialog-backdrop { background: rgb(0 0 0 / 0.12); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
@@ -52,4 +52,4 @@ import{appReview as Jn,biometrics as De,brightness as be,camera as ve,deepLinks
52
52
  .native-dialog-group, .native-menu { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--native-dialog-solid, rgb(242 242 247)); }
53
53
  .dark .native-dialog-group, .dark .native-menu { background: var(--native-dialog-solid-dark, rgb(44 44 46)); }
54
54
  }
55
- `;function Ke(){return R()?.document}function zt(e){if(e.getElementById(Ue))return;let t=e.createElement("style");t.id=Ue,t.textContent=qt,(e.head??e.documentElement).appendChild(t)}var Gt=0;function I(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function $e(){return R()?.stx?.overlays}var Vt=0;function je(e,t,n,r){zt(e);let o=R(),i=`native-dialog-layer-${++Vt}`,a=I(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(I(e,"div","native-dialog-backdrop")),new Promise((s)=>{let c=!1,m=(l)=>{if(c)return;c=!0,a.classList.remove("is-open"),$e()?.close(i),setTimeout(()=>a.remove(),260),s(l)},f=n({root:a,settle:m});a.appendChild(f),e.body.appendChild(a),$e()?.open(i,{panel:f,root:a,onEscape:()=>m(r())});let u=o;(typeof u?.requestAnimationFrame==="function"?(l)=>u.requestAnimationFrame(()=>u.requestAnimationFrame(l)):(l)=>setTimeout(l,16))(()=>{if(!c)a.classList.add("is-open")})})}function ke(e){let t=Ke();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Gt}`,r=e.actions.find((a)=>a.style==="cancel"),o=e.variant==="sheet"?e.actions.filter((a)=>a.style!=="cancel"):e.actions,i=e.variant==="sheet"?r??{id:"__cancel",title:e.cancelLabel||"Cancel",style:"cancel"}:void 0;return je(t,e.variant,({root:a,settle:s})=>{let c=(l)=>l.style==="cancel"?null:l.id,m=I(t,"div","native-dialog-panel");m.setAttribute("role","alertdialog"),m.setAttribute("aria-modal","true"),m.tabIndex=-1;let f=I(t,"div","native-dialog-group");if(e.title||e.message){let l=I(t,"div","native-dialog-header");if(e.title){let d=I(t,"p","native-dialog-title",e.title);d.id=`${n}-title`,l.appendChild(d),m.setAttribute("aria-labelledby",d.id)}if(e.message){let d=I(t,"p","native-dialog-message",e.message);d.id=`${n}-message`,l.appendChild(d),m.setAttribute("aria-describedby",d.id)}f.appendChild(l)}let u=I(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)u.classList.add("is-row");for(let l of o){let d=I(t,"button",`native-dialog-action${l.style==="destructive"?" is-destructive":""}${l.style==="cancel"?" is-cancel":""}`,l.title);d.type="button",d.setAttribute("data-action-id",l.id),d.addEventListener("click",()=>s(c(l))),u.appendChild(d)}if(f.appendChild(u),m.appendChild(f),i){let l=I(t,"div","native-dialog-group"),d=I(t,"button","native-dialog-action is-cancel",i.title);d.type="button",d.setAttribute("data-action-id",i.id),d.addEventListener("click",()=>s(null)),l.appendChild(d),m.appendChild(l)}let g=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")g?.addEventListener("click",()=>s(null));return m},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function qe(e){await ke({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function ze(e){return await ke({variant:"alert",title:e.title,message:e.message,actions:[{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"},{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"}]})==="confirm"}function Ge(e){return ke({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Yt(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,c=e.y-8-t.height,m=s||c<12?Math.max(12,Math.min(a,n.height-t.height-12)):c,f=e.x+e.width/2>n.width/2?"right":"left";return{top:m,left:i,origin:`${s||c<12?"top":"bottom"} ${f}`}}function Ve(e){let t=Ke();if(!t?.body)return Promise.resolve(null);let n=R();return je(t,"menu",({root:r,settle:o})=>{let i=I(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(I(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=I(t,"button",`native-menu-item${a.destructive?" is-destructive":""}`);if(s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-action-id",a.id),a.disabled)s.disabled=!0;if(s.appendChild(I(t,"span","native-menu-label",a.title)),a.icon){let c=I(t,"i",`native-menu-icon ${a.icon}`);c.setAttribute("aria-hidden","true"),s.appendChild(c)}s.addEventListener("click",()=>o(a.id)),i.appendChild(s)}return r.querySelector(".native-dialog-backdrop")?.addEventListener("click",()=>o(null)),queueMicrotask(()=>{let a=i.getBoundingClientRect?.(),s=Yt(e.anchor,{width:a?.width||248,height:a?.height||e.items.length*44},{width:n?.innerWidth||390,height:n?.innerHeight||844});i.style.top=`${s.top}px`,i.style.left=`${s.left}px`,i.style.setProperty("--native-menu-origin",s.origin)}),i},()=>null)}var Je=()=>!0,L=()=>!1,B=()=>null;function Ye(){return R()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Oe(e){return{x:Math.round(e.x??e.left??0),y:Math.round(e.y??e.top??0),width:Math.round(e.width),height:Math.round(e.height)}}var te={alert:(e)=>v("dialog.alert",[e],()=>qe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>v("dialog.confirm",[e],()=>ze(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Oe(e.anchor):void 0},n=await v("dialog.actionSheet",[t],()=>Ge(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Lr(){return(e)=>te.actionSheet(e)}async function Cr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return te.confirm(e);return await te.actionSheet({title:e.title,message:e.message,anchor:e.anchor,actions:[{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"},{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"}]})==="confirm"}var Pe={show:async(e)=>{let t={title:e.title,anchor:Oe(e.anchor),items:e.items.map(({id:r,title:o,symbol:i,destructive:a,disabled:s})=>({id:r,title:o,symbol:i,destructive:a,disabled:s}))},n=await v("contextMenu.show",[t],()=>Ve(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Mr(e,t){return Pe.show({...t,anchor:Oe(e.getBoundingClientRect())})}function Qt(e,t){let n=R();if(!n)return{cancelled:!0};if(typeof n.craft?.openURL==="function")return Promise.resolve(n.craft.openURL(e)).catch(()=>{}),{cancelled:!1};if(t.mode==="auth")return n.location?.assign(e),{cancelled:!1};if(!(typeof n.open==="function"?n.open(e,"_blank","noopener"):null))n.location?.assign(e);return{cancelled:!1}}var Ze={open:async(e,t={})=>{let n=await v("browser.open",[e,t],()=>Qt(e,t),{fallbackOnError:!0});if(!n||typeof n!=="object")return{cancelled:!1};let{url:r,cancelled:o}=n;return typeof r==="string"?{url:r,cancelled:Boolean(o)}:{cancelled:Boolean(o)}}},Ee=new Map,Te=new Map;function Qe(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var et={isAvailable:()=>M("symbols.image")!==null,image:(e,t={})=>{let n=Qe(e,t),r=Ee.get(n);if(r)return r;let o=v("symbols.image",[e,t],B).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,B).then((i)=>(Te.set(n,i),i));return Ee.set(n,o),o},cached:(e,t={})=>Te.get(Qe(e,t)),clearCache:()=>{Ee.clear(),Te.clear()}},de={setStyle:(e)=>v("statusBar.setStyle",[e],L,{fallbackOnError:!0}).then((t)=>t!==!1)},ne={setUnderPageColor:(e)=>v("chrome.setUnderPageColor",[e],L,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>v("chrome.setKeyboardAccessory",[e],L,{fallbackOnError:!0}).then((t)=>t!==!1)},j={isAvailable:()=>M("refresh.enable")!==null,enable:(e)=>v("refresh.enable",[e??{}],L,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>v("refresh.disable",[],L,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>v("refresh.end",[],L,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>_("craftRefresh",()=>e())},re={complete:(e)=>v("background.complete",[e],L,{fallbackOnError:!0}).then((t)=>t!==!1)},tt={write:(e)=>v("clipboard.write",[e],async()=>{let t=Ye()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(Je,L)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>v("clipboard.read",[],async()=>{let e=Ye()?.clipboard;if(!e?.readText)return null;return e.readText().catch(B)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},nt={isAvailable:()=>M("db.query")!==null,query:(e,t=[])=>v("db.query",[e,t],B).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>v("db.execute",[e,t],B).then((n)=>{if(!n||typeof n!=="object")return null;let{rowsAffected:r,lastInsertId:o}=n;return{rowsAffected:Number(r)||0,lastInsertId:Number(o)||0}})};function Ie(e,t){let n=R()?.document;if(!n?.body)return null;let r=n.createElement("a");return r.href=e,r.download=t,r.rel="noopener",r.style.display="none",n.body.appendChild(r),r.click(),r.remove(),t}function Xt(e){let t=R()?.document;if(!t?.body)return Promise.resolve(null);return new Promise((n)=>{let r=t.createElement("input");if(r.type="file",r.style.display="none",e.length)r.accept=e.map((i)=>i.includes("/")||i.startsWith(".")?i:`.${i}`).join(",");let o=(i)=>{r.remove(),n(i)};r.addEventListener("cancel",()=>o(null)),r.addEventListener("change",()=>{let i=r.files?.[0];if(!i)return o(null);let a=new FileReader;a.onload=()=>o({name:i.name,mimeType:i.type||void 0,data:typeof a.result==="string"?a.result:void 0}),a.onerror=()=>o({name:i.name,mimeType:i.type||void 0}),a.readAsDataURL(i)}),t.body.appendChild(r),r.click()})}var rt={openPDF:(e,t=0)=>v("openPDF",[e,t],()=>{let n=R();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>v("takeScreenshot",[],B,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>v("scanQRCode",[],B).then((e)=>{if(!e||typeof e!=="object")return null;let{type:t,data:n}=e;return typeof n==="string"?{type:String(t??""),data:n}:null},B),pickFile:(e=[])=>v("pickFile",[e],()=>Xt(e)).then((t)=>{if(!t||typeof t!=="object")return null;let n=t;if(typeof n.name!=="string")return null;return{name:n.name,path:typeof n.path==="string"?n.path:void 0,data:typeof n.data==="string"?n.data:void 0,mimeType:typeof n.mimeType==="string"?n.mimeType:void 0}},B),saveFile:(e,t,n)=>v("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ie(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ie(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>v("downloadFile",[e,t],()=>Ie(e,t)).then((n)=>typeof n==="string"?n:null)},ot={set:(e)=>v("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],L).then((t)=>t!==!1),clear:()=>v("shortcuts.clear",[],L).then((e)=>e!==!1),onShortcut:(e)=>_("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},it={update:(e)=>v("widget.update",[e],L).then((t)=>t!==!1),reload:()=>v("widget.reload",[],L).then((e)=>e!==!1)},Jt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function Xe(){return R()?.screen?.orientation}var at={lock:(e)=>v("lockOrientation",[e],()=>{let t=Xe();return t?.lock?t.lock(Jt[e]).then(Je,L):!1}).then((t)=>t!==!1),unlock:()=>v("unlockOrientation",[],()=>(Xe()?.unlock?.(),!0)).then((e)=>e!==!1)},st={signInWithApple:(e={})=>v("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],B).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},lt={isAvailable:()=>M("iap.purchase")!==null,products:(e)=>v("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>v("iap.purchase",[e],B).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>v("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as K}from"craft-native/mobile";function ct(){return V()?.capabilities?.storageCompareAndSet===!0&&K.supportsCompareAndSet?.()===!0}function ut(){return V()?.capabilities?.storageSetIfAbsent===!0&&K.supportsSetIfAbsent?.()===!0}var dt={supportsCompareAndSet:ct,supportsSetIfAbsent:ut,get:(e)=>p(()=>K.get(e)),set:(e,t)=>p(()=>K.set(e,t)),remove:(e)=>p(()=>K.remove(e)),clear:()=>p(()=>K.clear()),keys:()=>p(()=>K.keys()),setIfAbsent:(e,t)=>p(()=>{if(!ut())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return K.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>p(()=>{if(!ct())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return K.compareAndSet(e,t,n)})};import{crypto as Zt}from"craft-native/mobile";var pt={randomUUID:()=>p(()=>Zt.randomUUID())};var en=["authorized","denied","notDetermined","restricted","unsupported"];function pe(){let e=V(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function tn(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function ft(e){return en.includes(e)?e:"unsupported"}function nn(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function J(e,t,...n){return p(async()=>{let r=pe();if(typeof r?.[e]!=="function")throw tn();return t(await r[e](...n))})}var mt={isAvailable:()=>typeof pe()?.isSupported==="function",supports:(e)=>typeof pe()?.[e]==="function",isSupported:()=>p(async()=>{let e=pe();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>J("authorization",ft),requestAuthorization:()=>J("requestAuthorization",ft),list:()=>J("list",(e)=>Array.isArray(e)?e.map(nn).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return J("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>J("remove",(t)=>t===!0,e),removeAll:()=>J("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function jr(e,t){let n=t.delay??500,r=t.tolerance??10,o=null,i=null,a=!1,s=()=>{if(o)clearTimeout(o);if(o=null,i&&!a)t.onPressEnd?.();i=null},c=(g)=>{let l=g;if(l.button!==void 0&&l.button!==0)return;a=!1,i={x:l.clientX,y:l.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},m=(g)=>{if(!i)return;let l=g;if(Math.hypot(l.clientX-i.x,l.clientY-i.y)>r)s()},f=(g)=>{if(!a)return;a=!1,g.preventDefault(),g.stopPropagation()},u=(g)=>g.preventDefault();return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",m),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",f,!0),e.addEventListener("contextmenu",u),()=>{s(),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",m),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",f,!0),e.removeEventListener("contextmenu",u)}}function rn(e,t,n){if(n<=1||t.width<=0)return 0;let r=Math.floor((e-t.left)/t.width*n);return Math.max(0,Math.min(n-1,r))}function qr(e,t){let n=null,r=null,o=!1,i=0,a=(l)=>{let d=e.getBoundingClientRect();return rn(l,{left:d.left+2,width:d.width-4},t.count())},s=(l)=>{let d=l;if(d.button!==void 0&&d.button!==0)return;let y=a(d.clientX);if(y!==t.selected())return;n=y,i=y,o=!1,r=d.pointerId;try{e.setPointerCapture?.(d.pointerId)}catch{}t.onPress?.(!0)},c=(l)=>{if(n===null)return;let d=a(l.clientX);if(d===i)return;o=!0,i=d,t.onScrub(d)},m=(l)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),l&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},f=(l)=>{if(!o)return;o=!1,l.preventDefault(),l.stopPropagation()},u=()=>m(!0),g=()=>m(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",c),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",g),e.addEventListener("click",f,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",g),e.removeEventListener("click",f,!0)}}function zr(e,t,n){if(n<=0)return null;switch(e){case"ArrowRight":case"ArrowDown":return(t+1)%n;case"ArrowLeft":case"ArrowUp":return(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}function Gr(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function Vr(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=M("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as on}from"@bughq/sdk";import{crashReporter as Z}from"craft-native/mobile";var N=null;function an(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function gt(){return Z.isAvailable()}function sn(e){return async(t)=>{if(!gt())return!e;return Z.capture(t)}}var Zr={start(e={}){if(N)return N;let t=ee()||gt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return N=new on({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?sn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!an(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)Z.addBreadcrumb(i);return i}}),N},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);N?.setUser(t===null?null:{id:t}),await Z.setUser(t)},capture(e,t){N?.captureException(e,t)},addBreadcrumb(e){if(N)N.addBreadcrumb(e);else Z.addBreadcrumb(e)},async flush(){await Promise.all([N?.flush(),Z.flush()])},client(){return N},stop(){N?.close(),N=null}};function Le(e){let t=R();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function ht(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function bt(){let e=R()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:ht(e?.getAttribute("data-craft-reduce-motion"))||Le("(prefers-reduced-motion: reduce)"),reduceTransparency:ht(e?.getAttribute("data-craft-reduce-transparency"))||Le("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||Le("(prefers-color-scheme: dark)")?"dark":"light"}}function ln(e){let t=bt(),n=Number(e?.fontScale);return{contentSizeCategory:typeof e?.contentSizeCategory==="string"?e.contentSizeCategory:void 0,fontScale:Number.isFinite(n)&&n>0?n:t.fontScale,reduceMotion:typeof e?.reduceMotion==="boolean"?e.reduceMotion:t.reduceMotion,reduceTransparency:typeof e?.reduceTransparency==="boolean"?e.reduceTransparency:t.reduceTransparency,colorScheme:e?.colorScheme==="dark"||e?.colorScheme==="light"?e.colorScheme:t.colorScheme}}function vt(e,t={}){if(t.immediate!==!1)e(bt());return _("craftAppearance",(n)=>e(ln(n)))}function ro(e){return _("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function oo(e){return _("craftMemoryWarning",()=>e())}function yt(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>re.complete(!0),()=>re.complete(!1))}}function io(e){let t=yt(e);return _("craftSilentPush",(n)=>t(n.payload??{}))}function ao(e){let t=yt(()=>e());return _("craftBackgroundRefresh",()=>t(void 0))}import{haptics as cn}from"craft-native/mobile";function Ce(){if(typeof window>"u")return;return window}function oe(e=Ce()){if(!e)return 0;if(typeof e.scrollY==="number")return e.scrollY;if(typeof e.scrollTop==="number")return e.scrollTop;return e.document?.scrollingElement?.scrollTop??0}function un(e,t=Ce()){if(!t)return()=>{};let n=!1,r=typeof requestAnimationFrame==="function"?requestAnimationFrame:(i)=>setTimeout(i,16),o=()=>{if(n)return;n=!0,r(()=>{n=!1,e(oe(t))})};return e(oe(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function dn(e,t){let n=Math.max(0,-e),r=e<=0?Math.max(0,t)*0.5:0;return Math.round(Math.max(n,r))}function co(e){let t=e.host??Ce();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(y)=>setTimeout(y,16),s=null,c=(y)=>{s=null,e.onPull?.(y,o,{bounce:Math.min(y,Math.max(0,-oe(t)))})},m=(y)=>{let w=s!==null;if(s=y,w)return;a(()=>{if(s!==null)c(s)})},f=(y)=>{let w=y.touches?.[0];return w?w.clientY:null},u=(y)=>{if(i||oe(t)>0)return;r=f(y),o=!1},g=(y)=>{if(r===null)return;let w=f(y);if(w===null)return;let P=dn(oe(t),w-r);if(!o&&P>=n)o=!0,Promise.resolve(cn.impact("medium")).catch(()=>{});else if(o&&P<n*0.8)o=!1;m(P)},l=async()=>{if(r===null)return;if(r=null,!o){c(0);return}o=!1,i=!0,c(n);try{await e.onRefresh()}finally{i=!1,c(0)}},d=()=>{if(r===null)return;r=null,o=!1,c(0)};return t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchmove",g,{passive:!0}),t.addEventListener("touchend",l),t.addEventListener("touchcancel",d),()=>{s=null,t.removeEventListener("touchstart",u),t.removeEventListener("touchmove",g),t.removeEventListener("touchend",l),t.removeEventListener("touchcancel",d)}}function pn(e,t=52){let n=Math.max(1,t),r=Math.min(1,Math.max(0,e/n)),o=e<0?1+Math.min(0.1,-e/600):1;return{progress:Math.round(r*1000)/1000,stretch:Math.round(o*1000)/1000}}function uo(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return un((o)=>{let i=pn(o,r()),a=`${i.progress}|${i.stretch}`;if(a===n)return;n=a,e.style.setProperty("--native-nav-progress",String(i.progress)),e.style.setProperty("--native-nav-stretch",String(i.stretch)),t.onChange?.(i)},t.host)}function po(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function xt(){if(typeof window>"u")return;return window}var St="__stxPushed",fn="__stxScroll";function mn(e=xt()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(St in n)return n[St]===!0;return!(fn in n)}function mo(e=xt()){if(!mn(e))return!1;return e.history.back(),!0}function go(e,t,n=50){let r=e[e.length-1];if(e.length>=2&&e[e.length-2].path===t)e.pop();else if(!r||r.path!==t)e.push({path:t,title:""});if(e.length>n)e.splice(0,e.length-n);return{current:e[e.length-1],previous:e[e.length-2]??null}}function ho(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function bo(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function gn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function vo(){if(typeof window>"u")return;let e=window.stxRouter;if(typeof e?.screens!=="function")return;let t=e.screens(),n=t.find((o)=>o.active);if(!n)return;let r=t.filter((o)=>o.tab===n.tab&&o.depth<n.depth);if(!r.length)return null;return gn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function yo(e=typeof window>"u"?void 0:window){let t=e?.stxRouter;if(typeof t?.screens!=="function"||typeof e?.history?.go!=="function")return!1;let n=t.screens(),r=n.find((a)=>a.active);if(!r)return!1;let o=n.filter((a)=>a.tab===r.tab&&a.depth<r.depth);if(!o.length)return!1;let i=o.reduce((a,s)=>s.depth<a.depth?s:a);return e.history.go(i.depth-r.depth),!0}function So(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function hn(e,t=bn()){let n;try{n=new URL(e)}catch{return null}let r=`${n.search}${n.hash}`;if(n.protocol==="http:"||n.protocol==="https:"){if(!t||n.origin!==t)return null;return`${n.pathname||"/"}${r}`}return`${`/${[n.host,n.pathname.replace(/^\/+/,"")].filter(Boolean).join("/")}`}${r}`}function bn(){if(typeof window>"u")return;return window.location?.origin}var wt="stacks-mobile-deep-link";function wo(e,t){let n=(r)=>{let o=hn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(wt)===r)return;sessionStorage.setItem(wt,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Ao=5000;function vn(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let f=i+a>>1;if(r[f].timestamp<o.timestamp)i=f+1;else a=f}let s=r[i],c=r[i-1],m=!s?c:!c?s:o.timestamp-c.timestamp<=s.timestamp-o.timestamp?c:s;if(!m||Math.abs(m.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(m.bpm)}})}var yn=6371008.8,Sn=30,wn=Sn;function xn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*yn*Math.asin(Math.min(1,Math.sqrt(i)))}function An(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&Math.abs(r.latitude)<=90&&Math.abs(r.longitude)<=180&&Number.isFinite(r.accuracy)&&r.accuracy>=0&&r.accuracy<=t).sort((r,o)=>r.timestamp-o.timestamp).filter((r)=>{if(n.has(r.timestamp))return!1;return n.add(r.timestamp),!0})}function Me(e,t={}){let n=An(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let u of n){let g=o[o.length-1],l=s?(u.timestamp-s.timestamp)/1000:0;if(s=u,!g){o.push({fix:u,cumM:0});continue}if(l>wn){o.push({fix:u,cumM:i});continue}let d=(u.timestamp-g.fix.timestamp)/1000,y=xn(g.fix,u),w=Math.min(10,Math.max(3,g.fix.accuracy,u.accuracy));if(y<w)continue;if(i+=y,d>0&&y/d>=0.5)a+=d;o.push({fix:u,cumM:i})}let c=o[o.length-1],m=null,f=null;if(c&&n.at(-1).timestamp-c.fix.timestamp<=r*1000){let u=c.fix.timestamp-r*1000,g=o.find((y)=>y.fix.timestamp>=u)??c,l=c.cumM-g.cumM,d=(c.fix.timestamp-g.fix.timestamp)/1000;if(l>=20&&d>0)f=l/d,m=d/(l/1000)}return{distanceM:i,movingS:a,paceSPerKm:m,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:f,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function Ro(e){if(e==null||e<=0||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function ko(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var At={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function Eo(e){let t=e.location,n=e.intervalMs??3000,r=At,o=null,i=e.heartRate,a=!1,s=null,c=[],m=()=>typeof document<"u"&&document.visibilityState==="hidden",f=0,u=null,g=Promise.resolve(),l=null,d=!1,y=null;function w(){if(d)throw Object.assign(Error("The recording screen is no longer active"),{code:"RECORDING_CONFLICT"});if(t.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect native recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"})}function P(){if(w(),!y)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return y}function W(h){let S=g.then(h);return g=S.then(()=>{},()=>{}),S}function U(){if(u)return u;let h=f,S=y,T=(async()=>{if(w(),!S)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let O=await t.readRecording({expectedId:S}),C=Me(O,e);if(h===f&&!d)r=C,e.onUpdate?.(r);return C})().finally(()=>{if(u===T)u=null});return u=T,T}function b(){if(x(),d)return;o=setInterval(()=>{if(!m())U().catch(()=>{})},n)}function x(){if(o)clearInterval(o);o=null}function A(h,S,T){if(x(),f++,u=null,y=h,s=S,a=S!==null,c=[],r=T,!d)e.onUpdate?.(r)}async function E(h){if(!i||!a||!s||d||i.supportsRecordingOwnership?.()!==!0)return;await h(i,s).catch(()=>{})}return{get stats(){return r},get recordingId(){return y},get heartRateRecordingId(){return s},get heartRate(){return c},start(h){return l=null,W(async()=>{if(w(),h&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(h&&(typeof h.recordingId!=="string"||!h.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let S=await t.startRecording({enableHighAccuracy:!0,...e.locationOptions,...h?{recordingId:h.recordingId}:{}});if(!S?.active||typeof S.id!=="string"||!S.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(h&&S.id!==h.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let T=null;if(!d&&i?.isAvailable()&&i.supportsRecordingOwnership?.()===!0&&(!h||h.heartRateRecordingId&&i.supportsRecordingIntentIdentity?.()===!0))try{let O=await i.startRecording(h?{recordingId:h.heartRateRecordingId}:void 0);if(h&&O.id!==h.heartRateRecordingId)throw Object.assign(Error("The native heart rate did not start with its registered ID"),{code:"RECORDING_CONFLICT"});if(O.active&&typeof O.id==="string"&&O.id.trim())T=O.id}catch{}return A(S.id,T,{...At}),b(),r})},attach(h){return l=null,W(async()=>{if(typeof h?.expectedId!=="string"||!h.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});w();let S=await t.getRecordingState({expectedId:h.expectedId});if(w(),!S?.id)return null;if(S.id!==h.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let T=null;if(h.expectedHeartRateId!==void 0){let C=h.expectedHeartRateId;if(typeof C!=="string"||!C.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!i?.isAvailable()||i.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let Ut=await i.getRecordingState({expectedId:C});if(w(),Ut.id!==C)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await i.readRecording({expectedId:C,since:Date.now()}),w(),T=C}let O=await t.readRecording({expectedId:h.expectedId});if(w(),A(h.expectedId,T,Me(O,e)),S.active&&!S.paused)b();return S})},pause(){return W(async()=>{await t.pauseRecording({expectedId:P()}),await E((h,S)=>h.pauseRecording({expectedId:S})),x(),await U().catch(()=>{})})},resume(){return W(async()=>{await t.resumeRecording({expectedId:P()}),await E((h,S)=>h.resumeRecording({expectedId:S})),b()})},stop(){if(l)return l;let h=W(async()=>{x(),f++;let S=P(),T=await t.stopRecording({expectedId:S});if(T.id!==S)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let O=T?.locations??[];if(!d&&i&&a&&s&&i.supportsRecordingOwnership?.()===!0){let C=await i.stopRecording({expectedId:s}).catch(()=>null);a=!1,c=C?.id===s?C.samples:[],O=vn(O,c)}if(r=Me(O,e),!d)e.onUpdate?.(r);return O}).catch((S)=>{if(l===h)l=null;throw S});return l=h,h},dispose(){d=!0,f++,u=null,x()},refresh:U}}function Io(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Oo(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Po(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Lo(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var Mo=150;function Rn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(i)))}function fe(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function No(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)&&Math.abs(a.latitude)<=90&&Math.abs(a.longitude)<=180),r=n.filter((a)=>a.accuracy!=null).map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?fe(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:fe(n.map((s)=>s.latitude),0.5),longitude:fe(n.map((s)=>s.longitude),0.5)};i=fe(n.map((s)=>Rn(a,s)),0.8)}if(n.length>=10&&i>150&&o<=15)return"outside";if(t<150)return"unsure";if(n.length<3||o>30||i<25)return"indoors";if(i<50&&o>10)return"indoors";return"unsure"}function Ho(e,t={}){let r=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d*)?|\.\d+)\s*(km|k|m|mi)?$/);if(!r)return null;let o=Number(r[1]),i=r[2]||t.defaultUnit||(o>100?"m":"km"),a=i==="m"?o/1000:i==="mi"?o*1.609344:o;return Number.isFinite(a)&&a>=0&&a<=2000?Math.round(a*1000)/1000:null}var he=new Set,Rt=!1,me=null;function kn(e){return e.isConnected&&e.getClientRects().length>0}function kt(){return[...he].find((e)=>kn(e.element))}function ge(){let e=kt(),t=Boolean(e);if(t===Rt)return;if(Rt=t,t)j.enable(e?.tintColor?{tintColor:e.tintColor}:{});else j.disable()}function En(){let e=kt();if(!e){j.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>j.end())}function Bo(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};he.add(n);let r=e.ownerDocument?.defaultView;if(!me){let o=j.onRefresh(En),i=()=>ge();r?.addEventListener("stx:load",i),me=()=>{o(),r?.removeEventListener("stx:load",i)}}return ge(),r?.requestAnimationFrame?.(()=>ge()),()=>{if(he.delete(n),he.size===0)me?.(),me=null;ge()}}var Wo=0.5;function Tn(e,t,n){let r=[];if(n.includes("large")||n.length===0)r.push({name:"large",y:0});if(n.includes("medium"))r.push({name:"medium",y:Math.max(0,Math.round(e-t*0.5))});return r.push({name:"dismiss",y:Math.max(1,e)}),r.sort((o,i)=>o.y-i.y)}function In(e){let{y:t,velocity:n,stops:r}=e,o=r.filter((s)=>s.name!=="dismiss"),i=r.find((s)=>s.name==="dismiss");if(o.length===0)return"dismiss";if(n>0.5)return(r.filter((c)=>c.y>t+1)[0]??i).name;if(n<-0.5){let s=o.filter((c)=>c.y<t-1);return(s[s.length-1]??o[0]).name}let a=o[o.length-1];if(t>a.y+(i.y-a.y)*0.5)return"dismiss";return o.reduce((s,c)=>Math.abs(c.y-t)<Math.abs(s.y-t)?c:s).name}function On(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function Uo(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Tn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(f)=>{let u=f;if(u.button!==void 0&&u.button!==0)return;if(u.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let g=a().find((l)=>l.name===e.detent())?.y??0;n={y:u.clientY,base:g,pointerId:u.pointerId},o=g,r=[{y:g,t:u.timeStamp}],t.classList.add("is-dragging");try{f.currentTarget?.setPointerCapture?.(u.pointerId)}catch{}},c=(f)=>{if(!n)return;let u=f,g=n.base+u.clientY-n.y;o=g<0?-On(-g):g,r.push({y:o,t:u.timeStamp});while(r.length>2&&u.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let l=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/l))))},m=(f)=>{if(!n)return;let u=f;n=null;let g=r[0],l=Math.max(1,u.timeStamp-g.t),d=(o-g.y)/l;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(In({y:o,velocity:d,stops:a()}))};for(let f of e.handles)f.addEventListener("pointerdown",s),f.addEventListener("pointermove",c),f.addEventListener("pointerup",m),f.addEventListener("pointercancel",m);return()=>{for(let f of e.handles)f.removeEventListener("pointerdown",s),f.removeEventListener("pointermove",c),f.removeEventListener("pointerup",m),f.removeEventListener("pointercancel",m)}}function $o(e){let t=e.ownerDocument;if(e.parentElement===t.body)return()=>{};let n=t.createComment("native-sheet");return e.parentNode?.insertBefore(n,e),t.body.appendChild(e),()=>{if(n.parentNode)n.parentNode.insertBefore(e,n);else e.remove();n.remove()}}var Ne=new WeakMap;function Ko(e,t){let n=e.documentElement,r=Ne.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Ne.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Ne.set(e,r+1),r>0)return;let o=e.defaultView,i=(o?.scrollY??0)+(o?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(i)}px`),n.setAttribute("data-native-sheet-card","")}function Pn(e,t){e.style.setProperty("--native-font-scale",String(t.fontScale)),e.toggleAttribute("data-native-reduce-motion",t.reduceMotion),e.toggleAttribute("data-native-reduce-transparency",t.reduceTransparency)}function Ln(e){let t=e.replace(/\s+/g,"").toLowerCase();return!t||t==="transparent"||/^rgba\(\d+,\d+,\d+,0(\.0+)?\)$/.test(t)||/\/0(\.0+)?\)$/.test(t)}function Cn(e){let t=e.defaultView;if(!t?.getComputedStyle)return null;for(let n of[e.body,e.documentElement]){if(!n)continue;let r=t.getComputedStyle(n).backgroundColor;if(r&&!Ln(r))return r}return null}function Mn(e){if(e.documentElement.classList.contains("dark"))return!0;if(e.documentElement.classList.contains("light"))return!1;return Boolean(e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches)}function Go(e,t={}){let n=t.root??e.documentElement;ne.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let f=Cn(e);if(f&&f!==r)r=f,ne.setUnderPageColor(f);let u=Mn(e)?"light":"dark";if(u!==o)o=u,de.setStyle(u)},a=vt((f)=>{Pn(n,f),i()}),s=e.defaultView,c=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;c?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let m=s?.matchMedia?.("(prefers-color-scheme: dark)");return m?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),c?.disconnect(),m?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var Yo=64;var Nn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Hn=/^(?:0|[1-9]\d*)$/;function Tt(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:c}=a,m=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Nn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof c!=="string"||!c.startsWith("/")||!c.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(c)}`);continue}t.push({name:o,slots:s,route:c,noun:m})}return{kinds:t,problems:n}}function ae(e,t){return e.find((n)=>n.name===t)??null}function ie(e,t,n){let r=ae(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function Dn(e,t){if(typeof t!=="string")return null;let n=t.lastIndexOf("-slot-");if(n<=0)return null;let r=t.slice(0,n),o=t.slice(n+6);if(!Hn.test(o))return null;let i=Number(o);return ie(e,r,i)===t?{kind:r,slot:i}:null}function It(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function Qo(e,t){let n=e&&typeof e==="object"?e:{};if(n.enabled===!1)return[];let o=[...(Array.isArray(n.activityTypes)?n.activityTypes.filter((i)=>typeof i==="string"&&i.trim().length>0):[]).map((i)=>i.trim()),...It(Tt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Ot(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ae(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function _n(e,t,n,r,o=Date.now()){let i=ae(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((d)=>d.kind===n),s=Ot(e,n,r),c=a.find((d)=>d.itemId===r.id)??null,m=c?null:Un(a,i.slots),f=c||m!==null?null:$n(a),u=c?.slot??m??f?.slot;if(u===void 0||u===null)return null;let g={kind:n,slot:u,itemId:r.id,title:s,donatedAt:o},l=t.filter((d)=>d.kind!==n||d.slot!==u&&d.itemId!==r.id);return{entries:Pt(e,[...l,g]),entry:g,evicted:f,changed:!c||c.title!==s}}function Bn(e,t,n){let r=e.find((o)=>o.kind===t&&o.itemId===n)??null;return{entries:r?e.filter((o)=>o!==r):[...e],removed:r}}function Fn(e,t,n){let r=Dn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ae(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Wn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:c,title:m,donatedAt:f}=i;if(typeof a!=="string"||typeof s!=="number"||ie(e,a,s)===null)continue;if(typeof c!=="number"||!Number.isInteger(c)||c<=0)continue;let u=`${a}-slot-${s}`,g=`${a}#${c}`;if(n.has(u)||r.has(g))continue;n.set(u,{kind:a,slot:s,itemId:c,title:typeof m==="string"&&m.trim()?m:Ot(e,a,{id:c}),donatedAt:typeof f==="number"&&Number.isFinite(f)&&f>0?f:0}),r.add(g)}return Pt(e,[...n.values()])}function Pt(e,t){let n=new Map(e.map((r,o)=>[r.name,o]));return[...t].sort((r,o)=>(n.get(r.kind)??0)-(n.get(o.kind)??0)||r.slot-o.slot)}function Un(e,t){let n=new Set(e.map((r)=>r.slot));for(let r=0;r<t;r++)if(!n.has(r))return r;return null}function $n(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Kn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var jn="stacks_spotlight_index",qn=3000;function Xo(e){let t=e.onProblem??((b)=>console.warn(`[spotlight] ${b}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Tt(e.kinds);for(let b of n.problems)t(b);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??jn,i=e.legacyStorageKeys??[],a=e.timeoutMs??qn,s=e.now??(()=>Date.now()),c=e.bridge??Kn,m=null;function f(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function u(){if(m)return m;m=[];let b=f();if(!b)return m;try{let x=[o,...i].map((A)=>b.getItem(A)).find((A)=>A);m=x?Wn(r,JSON.parse(x)):[]}catch{m=[]}return m}function g(b){m=b;let x=f();if(!x)return;try{x.setItem(o,JSON.stringify(b));for(let A of i)x.removeItem(A)}catch{}}async function l(b){if(!b)return null;let x;try{return await Promise.race([b,new Promise((A)=>{x=setTimeout(()=>A(null),a)})])}catch{return null}finally{if(x!==void 0)clearTimeout(x)}}let d=Promise.resolve();function y(b){let x=d.then(b,b);return d=x.catch(()=>{return}),x}async function w(b,x){let A=c()?.register;if(!A||r.length===0)return!1;return y(async()=>{let E=_n(r,u(),b,x,s()),h=E&&ie(r,b,E.entry.slot);if(!E||!h)return!1;if(!E.changed)return g(E.entries),!0;let S=await l(A(E.entry.title,h))!==null;if(S)g(E.entries);return S})}async function P(b,x){let A=c()?.remove;if(!A)return!1;return y(async()=>{let{entries:E,removed:h}=Bn(u(),b,x);if(!h)return!1;let S=ie(r,b,h.slot),T=S?await l(A(S))!==null:!1;return g(E),T})}async function W(b,x){let A=ae(r,b)?.slots;if(!A||!c()?.register)return 0;let E=0;for(let h of[...x].slice(0,A).reverse())if(await w(b,h))E++;return E}async function U(){let b=c()?.remove;if(!b)return g([]),0;return y(async()=>{let x=0;for(let A of u()){let E=ie(r,A.kind,A.slot);if(E&&await l(b(E))!==null)x++}return g([]),x})}return{kinds:r,index:w,sync:W,remove:P,clear:U,routeFor:(b)=>Fn(r,u(),b),entries:()=>u(),activityTypes:(b)=>It(r).map((x)=>`${b}.${x}`),reset:()=>{m=null}}}var Et=["craftShortcut","craftSiriShortcut"];function Jo(e,t){let n=(r)=>{let o=r.detail,i=typeof o==="string"?o:o&&typeof o==="object"?o.action??o.type:null,a=typeof i==="string"?e.routeFor(i):null;if(a)t(a)};if(typeof globalThis.addEventListener!=="function")return()=>{};for(let r of Et)globalThis.addEventListener(r,n);return()=>{for(let r of Et)globalThis.removeEventListener(r,n)}}import{tabBar as zn}from"craft-native/mobile";var Gn=zn;function Vn(e){return Array.from(e.querySelectorAll("a[data-native-tab]")).map((t)=>({id:t.getAttribute("href")||"",title:t.getAttribute("data-native-tab")||t.getAttribute("aria-label")||"",symbol:t.getAttribute("data-native-tab-symbol")||"circle",badge:(t.querySelector(".native-tab-badge")?.textContent||"").trim(),current:t.hasAttribute("data-stx-nav-current")||t.classList.contains("is-active")})).filter((t)=>t.id&&t.title)}function Yn(e){return{tabs:e.map(({id:n,title:r,symbol:o,badge:i})=>i?{id:n,title:r,symbol:o,badge:i}:{id:n,title:r,symbol:o}),selected:e.find((n)=>n.current)?.id}}function Ct(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function Qn(){return typeof Ct()?.selectTab==="function"}function ti(e,t={}){let n=(r)=>{if(Qn()||r.defaultPrevented)return;let o=r.target?.closest?.("a[data-native-tab]");if(!o||!e.contains(o))return;if(!o.hasAttribute("data-stx-nav-current")&&!o.classList.contains("is-active")&&o.getAttribute("aria-current")!=="page")return;r.preventDefault();let i=e.ownerDocument.defaultView;if(t.scrollToTop)t.scrollToTop();else i?.scrollTo?.({top:0,behavior:i.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"});i?.dispatchEvent(new CustomEvent("stx:tabreselect",{detail:{href:o.getAttribute("href")||""}}))};return e.addEventListener("click",n),()=>e.removeEventListener("click",n)}function Lt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var He="stacks:tab-bar-cover";function ni(e,t){if(t)e.setAttribute("data-native-covers-tab-bar","");else e.removeAttribute("data-native-covers-tab-bar");e.ownerDocument?.defaultView?.dispatchEvent(new Event(He))}function ri(e,t={}){let n=t.api??Gn;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar], [data-native-covers-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=Lt(o?.getPropertyValue("--native-tab-active")||""),a=Lt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",c=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:g,selected:l}=Yn(Vn(e)),d=JSON.stringify({tabs:g,selected:l});if(d===s)return;let y=s&&s!=="hidden"?JSON.parse(s):null;if(y&&l&&JSON.stringify(y.tabs)===JSON.stringify(g))n.select(l);else n.set(g,{selected:l,tint:i,tintDark:a});s=d},m=typeof MutationObserver==="function"?new MutationObserver(c):null;m?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let f=n.onSelect((g)=>{let l=Ct();if(l?.selectTab){l.selectTab(g);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((y)=>y.getAttribute("href")===g)?.click()}),u=()=>c();if(typeof window<"u")window.addEventListener("stx:load",u),window.addEventListener("stx:screen-shown",u),window.addEventListener(He,u);return c(),()=>{if(m?.disconnect(),f(),typeof window<"u")window.removeEventListener("stx:load",u),window.removeEventListener("stx:screen-shown",u),window.removeEventListener(He,u);n.hide()}}function Xn(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((l)=>Number.isSafeInteger(l)&&l>0)||t>300)throw TypeError("Invalid voice recording limits");let r={status:"idle",audio:null,error:null},o=new Set,i={},a=null,s=null,c,m=(l)=>{r=l;for(let d of o)d({...l})},f=()=>{clearTimeout(c),s?.getTracks().forEach((l)=>l.stop()),s=null};function u(){i={};let l=a;if(a=null,l&&l.state!=="inactive")l.stop();f(),m({status:"idle",audio:null,error:null})}async function g(){u();let l=i;m({status:"requesting",audio:null,error:null});try{if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>"u")throw Error("Microphone recording is unavailable. Upload an audio recording instead.");let d=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==l){d.getTracks().forEach((b)=>b.stop());return}s=d;let y=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((b)=>MediaRecorder.isTypeSupported(b)),w=new MediaRecorder(d,{...y?{mimeType:y}:{},audioBitsPerSecond:32000});a=w;let P=[],W=0,U=!1;w.ondataavailable=(b)=>{if(i!==l||!b.data.size)return;if(W+=b.data.size,W>n){if(U=!0,P.length=0,w.state!=="inactive")w.stop();f();return}if(!U)P.push(b.data)},w.onerror=()=>{if(i!==l)return;u(),m({status:"error",audio:null,error:"Recording failed. Please try again."})},w.onstop=()=>{if(i!==l)return;a=null,f();let b=new Blob(P,{type:w.mimeType||y||"audio/webm"});m(U||!b.size?{status:"error",audio:null,error:U?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:b,error:null})},w.start(1000),c=setTimeout(()=>{if(i===l&&w.state!=="inactive")w.stop()},t*1000),m({status:"recording",audio:null,error:null})}catch(d){if(i!==l)return;f(),m({status:"error",audio:null,error:d instanceof Error?d.message:"Microphone permission was refused."})}}return{start:g,cancel:u,dispose(){u(),o.clear()},stop(){if(a&&a.state!=="inactive")a.stop()},supported:()=>typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(l){return o.add(l),l({...r}),()=>{o.delete(l)}}}}var tr={isAvailable:()=>p(()=>De.isAvailable()),getBiometricType:()=>p(()=>De.getBiometricType()),authenticate:(e)=>p(()=>De.authenticate(e))},nr={takePicture:(e)=>p(()=>ve.takePicture(e)),pickImage:()=>p(()=>ve.pickImage()),pickMultiple:(e)=>p(()=>ve.pickMultiple(e)),isAvailable:()=>p(()=>ve.isAvailable())},rr={getInfo:()=>p(()=>Q.getInfo()),getCapabilities:()=>p(()=>Q.getCapabilities()),isMobile:()=>Q.isMobile(),isIOS:()=>Q.isIOS(),isAndroid:()=>Q.isAndroid(),getLocale:()=>Q.getLocale(),getTimezone:()=>Q.getTimezone()},or=Zn;function q(){return G()?.capabilities.locationRecordingOwnership===!0&&H.supportsRecordingOwnership?.()===!0}function z(){return G()?.capabilities.heartRateRecordingOwnership===!0&&k.supportsRecordingOwnership?.()===!0}function _t(){return q()&&G()?.capabilities.locationRecordingIntentIdentity===!0&&H.supportsRecordingIntentIdentity?.()===!0}function Bt(){return z()&&G()?.capabilities.heartRateRecordingIntentIdentity===!0&&k.supportsRecordingIntentIdentity?.()===!0}function Wt(e,t,n){return p(async()=>{let r=e&&Object.hasOwn(e,"recordingId");if(r){if(!t())throw Object.assign(Error("This host or adapter cannot start a registered recording identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(typeof e.recordingId!=="string"||!e.recordingId.trim())throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"})}let o=await n();if(r&&o.id!==e.recordingId)throw Object.assign(Error("The native recording identity changed at start"),{code:"RECORDING_CONFLICT"});return o})}function D(e,t,n){return p(()=>{if(e&&Object.hasOwn(e,"expectedId")){if(!t())throw Object.assign(Error("This host or adapter cannot protect recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});if(typeof e.expectedId!=="string"||!e.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"})}return n()})}var ir={supportsRecordingOwnership:q,supportsRecordingIntentIdentity:_t,acknowledgeRecording:(e)=>D({expectedId:e?.expectedId},q,()=>H.acknowledgeRecording(e)),getCurrentPosition:(e)=>p(()=>H.getCurrentPosition(e)),watchPosition:(e,t)=>H.watchPosition(e,t),clearWatch:(e)=>H.clearWatch(e),startRecording:(e)=>Wt(e,_t,()=>H.startRecording(e)),pauseRecording:(e)=>D(e,q,()=>H.pauseRecording(e)),resumeRecording:(e)=>D(e,q,()=>H.resumeRecording(e)),stopRecording:(e)=>D(e,q,()=>H.stopRecording(e)),getRecordingState:(e)=>D(e,q,()=>H.getRecordingState(e)),readRecording:(e)=>D(e,q,()=>H.readRecording(e))},ar={show:(e)=>p(()=>Se.show(e)),schedule:(e)=>p(()=>Se.schedule(e)),cancelAll:()=>p(()=>Se.cancelAll()),setBadge:(e)=>p(()=>Se.setBadge(e))},sr={check:(e)=>p(()=>le.check(e)),request:(e)=>p(()=>le.request(e)),checkMultiple:(e)=>p(()=>le.checkMultiple(e)),requestMultiple:(e)=>p(()=>le.requestMultiple(e)),openSettings:()=>p(()=>le.openSettings())},lr={set:(e,t)=>p(()=>we.set(e,t)),get:(e)=>p(()=>we.get(e)),delete:(e)=>p(()=>we.delete(e)),clear:()=>p(()=>we.clear())},cr={share:(e)=>p(()=>Dt.share(e)),isAvailable:()=>Dt.isAvailable()},ur={request:()=>p(()=>Jn.request())},Ae={impact:(e)=>Promise.resolve().then(()=>ye.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ye.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ye.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ye.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=M("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function Ft(e){if(typeof e==="string")return e.trim()||null;if(!e||typeof e!=="object")return null;let t=e.url;return typeof t==="string"&&t.trim()?t:null}var dr={async getInitialURL(){if(!await X())return null;return Ft(await Mt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Mt.onLink?.((o,i)=>{let a=Ft(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Re()?.craft)r();else X().then(r);return()=>{n=!0,t?.()}}},pi={isAvailable:()=>xe.isAvailable(),set:(e,t)=>xe.set(e,t),remove:(e)=>xe.remove(e),clear:()=>xe.clear()},pr={enable:()=>p(()=>Nt.enable()),disable:()=>p(()=>Nt.disable())},fr={isAvailable:()=>be.isAvailable(),get:()=>p(()=>be.get()),set:(e)=>p(()=>be.set(e)),restore:()=>p(()=>be.restore())},mr={isAvailable:()=>F.isAvailable(),supports:(e)=>F.supports(e),getAuthorizationStatus:()=>p(()=>F.getAuthorizationStatus()),requestAuthorization:()=>p(()=>F.requestAuthorization()),getNowPlaying:()=>p(()=>F.getNowPlaying()),play:()=>p(()=>F.play()),pause:()=>p(()=>F.pause()),togglePlayPause:()=>p(()=>F.togglePlayPause()),skipToNext:()=>p(()=>F.skipToNext()),skipToPrevious:(e)=>p(()=>F.skipToPrevious(e)),onChange:(e)=>Y(()=>F.onChange(e))},gr={supportsRecordingOwnership:z,supportsRecordingIntentIdentity:Bt,acknowledgeRecording:(e)=>D({expectedId:e?.expectedId},z,()=>k.acknowledgeRecording(e)),isAvailable:()=>k.isAvailable(),supports:(e)=>k.supports(e),getState:()=>p(()=>k.getState()),requestAuthorization:()=>p(()=>k.requestAuthorization()),scan:(e)=>p(()=>k.scan(e)),stopScan:()=>p(()=>k.stopScan()),getDevices:()=>p(()=>k.getDevices()),connect:(e)=>p(()=>k.connect(e)),reconnect:()=>p(()=>k.reconnect()),disconnect:(e)=>p(()=>k.disconnect(e)),startRecording:(e)=>Wt(e,Bt,()=>k.startRecording(e)),pauseRecording:(e)=>D(e,z,()=>k.pauseRecording(e)),resumeRecording:(e)=>D(e,z,()=>k.resumeRecording(e)),stopRecording:(e)=>D(e,z,()=>k.stopRecording(e)),getRecordingState:(e)=>D(e,z,()=>k.getRecordingState(e)),readRecording:(e)=>D(e,z,()=>k.readRecording(e)),onReading:(e)=>Y(()=>k.onReading(e)),onDevice:(e)=>Y(()=>k.onDevice(e)),onState:(e)=>Y(()=>k.onState(e))},hr={isAvailable:()=>Fe.isAvailable(),speak:(e,t)=>p(()=>Fe.speak(e,t)),stop:()=>p(()=>Fe.stop())},br={getStatus:()=>p(()=>Ht.getStatus()),onChange:(e)=>Y(()=>Ht.onChange(e))},vr={register:()=>p(()=>Be.register()),onToken:(e)=>Be.onToken(e),onNotification:(e)=>Y(()=>Be.onNotification(e))},yr={requestAuthorization:(e,t)=>p(()=>se.requestAuthorization(e,t)),getData:(e,t)=>p(()=>se.getData(e,t)),saveWorkout:(e)=>p(()=>se.saveWorkout(e)),getWorkouts:(e)=>p(()=>se.getWorkouts(e)),getDailyStatistics:(e,t)=>p(()=>se.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>v("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>v("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>v("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>v("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>v("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>v("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>v("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>_("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>M(`health.${e}`)!==null},Sr={start:(e)=>p(()=>_e.start(e)),update:(e)=>p(()=>_e.update(e)),end:()=>p(()=>_e.end())},wr={send:(e)=>p(()=>ce.send(e)),updateContext:(e)=>p(()=>ce.updateContext(e)),isReachable:()=>p(()=>ce.isReachable()),onMessage:(e)=>ce.onMessage(e),onReachabilityChange:(e)=>ce.onReachabilityChange(e)},fi=er;function Re(){return R()}function G(){let e=Re()?.craft;if(!e||typeof e!=="object")return null;if(!("platform"in e)||e.platform!=="ios"&&e.platform!=="android")return null;let t="capabilities"in e?e.capabilities:void 0,n=t&&typeof t==="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).filter(([,r])=>typeof r==="boolean")):{};return{platform:e.platform,capabilities:n}}function We(){return G()!==null}function xr(e=2000){if(We()||ee())return Promise.resolve(!0);let t=Re();if(!t||!(t.craft||t.webkit?.messageHandlers?.craft))return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(We())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Ar(e){let t=Re();if(!t)return()=>{};if(G()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!G())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Rr(e){await Ae.impact("light");try{let t=await e();return await Ae.notification("success"),t}catch(t){throw await Ae.notification("error"),t}}var mi={get nativeBridge(){return G()},biometrics:tr,camera:nr,device:rr,haptics:Ae,lifecycle:or,location:ir,notifications:ar,permissions:sr,secureStorage:lr,storage:dt,crypto:pt,share:cr,appReview:ur,deepLinks:dr,keepAwake:pr,brightness:fr,music:mr,heartRate:gr,scheduledWorkouts:mt,speech:hr,network:br,pushNotifications:vr,health:yr,liveActivities:Sr,watchConnectivity:wr,dialog:te,contextMenu:Pe,browser:Ze,symbols:et,statusBar:de,chrome:ne,refresh:j,background:re,clipboard:tt,db:nt,files:rt,shortcuts:ot,widgets:it,orientation:at,auth:st,storeKit:lt,isNativeMobile:We,whenNative:xr,onReady:Ar,withFeedback:Rr};export{kr as BRIDGE_WAIT_MS,Ao as HEART_RATE_MATCH_MS,Mo as INDOOR_CHECK_AFTER_S,Yo as MAX_SPOTLIGHT_SLOTS_PER_KIND,Sn as ROUTE_GAP_S,Wo as SHEET_FLICK_VELOCITY,He as TAB_BAR_COVER_EVENT,p as afterBridge,ur as appReview,Pn as applyAppearance,vn as attachHeartRate,st as auth,ho as backLabelFor,re as background,tr as biometrics,ue as bridgePending,fr as brightness,Ze as browser,v as callNative,nr as camera,mn as canGoBack,ne as chrome,tt as clipboard,Cr as confirmAction,Pe as contextMenu,ni as coverTabBar,R as craftHost,V as craftRoot,Zr as crashReporting,Eo as createRouteRecorder,Xo as createSpotlightIndex,Xn as createVoiceRecorder,pt as crypto,bt as currentAppearance,nt as db,hn as deepLinkPath,dr as deepLinks,rr as device,te as dialog,go as enterNavTrail,rt as files,xn as fixDistance,Gr as focusSegment,wo as followDeepLinks,G as getNativeMobileBridge,mo as goBack,yo as goBackToTabRoot,ti as handleTabReselect,Ae as haptics,ee as hasNativeMobileHost,yr as health,gr as heartRate,No as indoorVerdict,Go as installNativeChrome,Vr as installPressables,We as isNativeMobile,kn as isShown,pr as keepAwake,an as keepBreadcrumb,pn as largeTitleMetrics,or as lifecycle,$o as liftToBody,Sr as liveActivities,ir as location,ri as mirrorTabBar,mi as mobile,mr as music,jt as nativeFunction,M as nativeFunctionNow,Yn as nativeTabs,bo as navTrail,br as network,ln as normalizeAppearance,Ft as normalizeDeepLinkURL,nn as normalizeScheduledWorkout,ar as notifications,uo as observeLargeTitle,jr as observeLongPress,Bo as observeNativeRefresh,un as observePageScroll,co as observePullToRefresh,qr as observeSegmentScrub,Uo as observeSheetDrag,vt as onAppearance,ao as onBackgroundRefresh,_ as onCraftEvent,oo as onMemoryWarning,Ar as onMobileReady,ro as onResume,io as onSilentPush,Jo as onSpotlightTap,at as orientation,Ro as paceLabel,Cn as pageBackground,Mn as pageIsDark,oe as pageScrollTop,Oo as pauseSessionClock,sr as permissions,Yt as placeMenu,_n as placeSpotlightItem,Ge as presentActionSheet,qe as presentAlert,ke as presentChoice,ze as presentConfirm,Ve as presentContextMenu,Ko as presentPageAsCard,vo as previousScreenPath,dn as pullDistance,vr as pushNotifications,Wn as readSpotlightEntries,Tt as readSpotlightKinds,Vn as readTabLinks,j as refresh,Bn as removeSpotlightItem,po as resolveScrollHost,Po as resumeSessionClock,Me as routeStats,Qn as routerHandlesTabs,On as rubberBand,mt as scheduledWorkouts,tn as scheduledWorkoutsUnsupported,lr as secureStorage,rn as segmentAt,zr as segmentForKey,Lo as sessionClockElapsed,In as settleSheet,cr as share,Tn as sheetStops,ot as shortcuts,Mr as showContextMenuFor,pi as snapshots,hr as speech,ko as speedLabel,fi as splash,ie as spotlightAction,It as spotlightActions,Qo as spotlightActivityTypes,Kn as spotlightBridge,ae as spotlightKind,Fn as spotlightRoute,Dn as spotlightSlot,Ot as spotlightTitle,Io as startSessionClock,de as statusBar,dt as storage,lt as storeKit,Y as subscribeWhenReady,et as symbols,Gn as tabBar,Oe as toNativeRect,So as trailEntryFor,Ho as typedDistanceKm,An as usableFixes,Lr as useActionSheet,wr as watchConnectivity,X as whenBridgeReady,xr as whenNativeMobile,it as widgets,Rr as withNativeFeedback};
55
+ `;function Ke(){return E()?.document}function qt(e){if(e.getElementById(Ue))return;let t=e.createElement("style");t.id=Ue,t.textContent=zt,(e.head??e.documentElement).appendChild(t)}var Vt=0;function L(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function $e(){return E()?.stx?.overlays}var Gt=0;function je(e,t,n,r){qt(e);let o=E(),i=`native-dialog-layer-${++Gt}`,a=L(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(L(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,m=(c)=>{if(l)return;l=!0,a.classList.remove("is-open"),$e()?.close(i),setTimeout(()=>a.remove(),260),s(c)},d=n({root:a,settle:m});a.appendChild(d),e.body.appendChild(a),$e()?.open(i,{panel:d,root:a,onEscape:()=>m(r())});let u=o;(typeof u?.requestAnimationFrame==="function"?(c)=>u.requestAnimationFrame(()=>u.requestAnimationFrame(c)):(c)=>setTimeout(c,16))(()=>{if(!l)a.classList.add("is-open")})})}function ke(e){let t=Ke();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Vt}`,r=e.actions.find((a)=>a.style==="cancel"),o=e.variant==="sheet"?e.actions.filter((a)=>a.style!=="cancel"):e.actions,i=e.variant==="sheet"?r??{id:"__cancel",title:e.cancelLabel||"Cancel",style:"cancel"}:void 0;return je(t,e.variant,({root:a,settle:s})=>{let l=(c)=>c.style==="cancel"?null:c.id,m=L(t,"div","native-dialog-panel");m.setAttribute("role","alertdialog"),m.setAttribute("aria-modal","true"),m.tabIndex=-1;let d=L(t,"div","native-dialog-group");if(e.title||e.message){let c=L(t,"div","native-dialog-header");if(e.title){let f=L(t,"p","native-dialog-title",e.title);f.id=`${n}-title`,c.appendChild(f),m.setAttribute("aria-labelledby",f.id)}if(e.message){let f=L(t,"p","native-dialog-message",e.message);f.id=`${n}-message`,c.appendChild(f),m.setAttribute("aria-describedby",f.id)}d.appendChild(c)}let u=L(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)u.classList.add("is-row");for(let c of o){let f=L(t,"button",`native-dialog-action${c.style==="destructive"?" is-destructive":""}${c.style==="cancel"?" is-cancel":""}`,c.title);f.type="button",f.setAttribute("data-action-id",c.id),f.addEventListener("click",()=>s(l(c))),u.appendChild(f)}if(d.appendChild(u),m.appendChild(d),i){let c=L(t,"div","native-dialog-group"),f=L(t,"button","native-dialog-action is-cancel",i.title);f.type="button",f.setAttribute("data-action-id",i.id),f.addEventListener("click",()=>s(null)),c.appendChild(f),m.appendChild(c)}let g=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")g?.addEventListener("click",()=>s(null));return m},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function ze(e){await ke({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function qe(e){return await ke({variant:"alert",title:e.title,message:e.message,actions:[{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"},{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"}]})==="confirm"}function Ve(e){return ke({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Yt(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,m=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,d=e.x+e.width/2>n.width/2?"right":"left";return{top:m,left:i,origin:`${s||l<12?"top":"bottom"} ${d}`}}function Ge(e){let t=Ke();if(!t?.body)return Promise.resolve(null);let n=E();return je(t,"menu",({root:r,settle:o})=>{let i=L(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(L(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=L(t,"button",`native-menu-item${a.destructive?" is-destructive":""}`);if(s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-action-id",a.id),a.disabled)s.disabled=!0;if(s.appendChild(L(t,"span","native-menu-label",a.title)),a.icon){let l=L(t,"i",`native-menu-icon ${a.icon}`);l.setAttribute("aria-hidden","true"),s.appendChild(l)}s.addEventListener("click",()=>o(a.id)),i.appendChild(s)}return r.querySelector(".native-dialog-backdrop")?.addEventListener("click",()=>o(null)),queueMicrotask(()=>{let a=i.getBoundingClientRect?.(),s=Yt(e.anchor,{width:a?.width||248,height:a?.height||e.items.length*44},{width:n?.innerWidth||390,height:n?.innerHeight||844});i.style.top=`${s.top}px`,i.style.left=`${s.left}px`,i.style.setProperty("--native-menu-origin",s.origin)}),i},()=>null)}var Je=()=>!0,M=()=>!1,W=()=>null;function Ye(){return E()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Oe(e){return{x:Math.round(e.x??e.left??0),y:Math.round(e.y??e.top??0),width:Math.round(e.width),height:Math.round(e.height)}}var te={alert:(e)=>v("dialog.alert",[e],()=>ze(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>v("dialog.confirm",[e],()=>qe(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Oe(e.anchor):void 0},n=await v("dialog.actionSheet",[t],()=>Ve(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Cr(){return(e)=>te.actionSheet(e)}async function Mr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return te.confirm(e);return await te.actionSheet({title:e.title,message:e.message,anchor:e.anchor,actions:[{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"},{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"}]})==="confirm"}var Pe={show:async(e)=>{let t={title:e.title,anchor:Oe(e.anchor),items:e.items.map(({id:r,title:o,symbol:i,destructive:a,disabled:s})=>({id:r,title:o,symbol:i,destructive:a,disabled:s}))},n=await v("contextMenu.show",[t],()=>Ge(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Nr(e,t){return Pe.show({...t,anchor:Oe(e.getBoundingClientRect())})}function Qt(e,t){let n=E();if(!n)return{cancelled:!0};if(typeof n.craft?.openURL==="function")return Promise.resolve(n.craft.openURL(e)).catch(()=>{}),{cancelled:!1};if(t.mode==="auth")return n.location?.assign(e),{cancelled:!1};if(!(typeof n.open==="function"?n.open(e,"_blank","noopener"):null))n.location?.assign(e);return{cancelled:!1}}var Ze={open:async(e,t={})=>{let n=await v("browser.open",[e,t],()=>Qt(e,t),{fallbackOnError:!0});if(!n||typeof n!=="object")return{cancelled:!1};let{url:r,cancelled:o}=n;return typeof r==="string"?{url:r,cancelled:Boolean(o)}:{cancelled:Boolean(o)}}},Ee=new Map,Te=new Map;function Qe(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var et={isAvailable:()=>I("symbols.image")!==null,image:(e,t={})=>{let n=Qe(e,t),r=Ee.get(n);if(r)return r;let o=v("symbols.image",[e,t],W).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,W).then((i)=>(Te.set(n,i),i));return Ee.set(n,o),o},cached:(e,t={})=>Te.get(Qe(e,t)),clearCache:()=>{Ee.clear(),Te.clear()}},de={setStyle:(e)=>v("statusBar.setStyle",[e],M,{fallbackOnError:!0}).then((t)=>t!==!1)},ne={setUnderPageColor:(e)=>v("chrome.setUnderPageColor",[e],M,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>v("chrome.setKeyboardAccessory",[e],M,{fallbackOnError:!0}).then((t)=>t!==!1)},j={isAvailable:()=>I("refresh.enable")!==null,enable:(e)=>v("refresh.enable",[e??{}],M,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>v("refresh.disable",[],M,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>v("refresh.end",[],M,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>F("craftRefresh",()=>e())},re={complete:(e)=>v("background.complete",[e],M,{fallbackOnError:!0}).then((t)=>t!==!1)},tt={write:(e)=>v("clipboard.write",[e],async()=>{let t=Ye()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(Je,M)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>v("clipboard.read",[],async()=>{let e=Ye()?.clipboard;if(!e?.readText)return null;return e.readText().catch(W)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},nt={isAvailable:()=>I("db.query")!==null,query:(e,t=[])=>v("db.query",[e,t],W).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>v("db.execute",[e,t],W).then((n)=>{if(!n||typeof n!=="object")return null;let{rowsAffected:r,lastInsertId:o}=n;return{rowsAffected:Number(r)||0,lastInsertId:Number(o)||0}})};function Ie(e,t){let n=E()?.document;if(!n?.body)return null;let r=n.createElement("a");return r.href=e,r.download=t,r.rel="noopener",r.style.display="none",n.body.appendChild(r),r.click(),r.remove(),t}function Xt(e){let t=E()?.document;if(!t?.body)return Promise.resolve(null);return new Promise((n)=>{let r=t.createElement("input");if(r.type="file",r.style.display="none",e.length)r.accept=e.map((i)=>i.includes("/")||i.startsWith(".")?i:`.${i}`).join(",");let o=(i)=>{r.remove(),n(i)};r.addEventListener("cancel",()=>o(null)),r.addEventListener("change",()=>{let i=r.files?.[0];if(!i)return o(null);let a=new FileReader;a.onload=()=>o({name:i.name,mimeType:i.type||void 0,data:typeof a.result==="string"?a.result:void 0}),a.onerror=()=>o({name:i.name,mimeType:i.type||void 0}),a.readAsDataURL(i)}),t.body.appendChild(r),r.click()})}var rt={openPDF:(e,t=0)=>v("openPDF",[e,t],()=>{let n=E();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>v("takeScreenshot",[],W,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>v("scanQRCode",[],W).then((e)=>{if(!e||typeof e!=="object")return null;let{type:t,data:n}=e;return typeof n==="string"?{type:String(t??""),data:n}:null},W),pickFile:(e=[])=>v("pickFile",[e],()=>Xt(e)).then((t)=>{if(!t||typeof t!=="object")return null;let n=t;if(typeof n.name!=="string")return null;return{name:n.name,path:typeof n.path==="string"?n.path:void 0,data:typeof n.data==="string"?n.data:void 0,mimeType:typeof n.mimeType==="string"?n.mimeType:void 0}},W),saveFile:(e,t,n)=>v("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ie(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ie(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>v("downloadFile",[e,t],()=>Ie(e,t)).then((n)=>typeof n==="string"?n:null)},ot={set:(e)=>v("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],M).then((t)=>t!==!1),clear:()=>v("shortcuts.clear",[],M).then((e)=>e!==!1),onShortcut:(e)=>F("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},it={update:(e)=>v("widget.update",[e],M).then((t)=>t!==!1),reload:()=>v("widget.reload",[],M).then((e)=>e!==!1)},Jt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function Xe(){return E()?.screen?.orientation}var at={lock:(e)=>v("lockOrientation",[e],()=>{let t=Xe();return t?.lock?t.lock(Jt[e]).then(Je,M):!1}).then((t)=>t!==!1),unlock:()=>v("unlockOrientation",[],()=>(Xe()?.unlock?.(),!0)).then((e)=>e!==!1)},st={signInWithApple:(e={})=>v("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],W).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},lt={isAvailable:()=>I("iap.purchase")!==null,products:(e)=>v("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>v("iap.purchase",[e],W).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>v("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as K}from"craft-native/mobile";function ct(){return G()?.capabilities?.storageCompareAndSet===!0&&K.supportsCompareAndSet?.()===!0}function ut(){return G()?.capabilities?.storageSetIfAbsent===!0&&K.supportsSetIfAbsent?.()===!0}var dt={supportsCompareAndSet:ct,supportsSetIfAbsent:ut,get:(e)=>p(()=>K.get(e)),set:(e,t)=>p(()=>K.set(e,t)),remove:(e)=>p(()=>K.remove(e)),clear:()=>p(()=>K.clear()),keys:()=>p(()=>K.keys()),setIfAbsent:(e,t)=>p(()=>{if(!ut())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return K.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>p(()=>{if(!ct())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return K.compareAndSet(e,t,n)})};import{crypto as Zt}from"craft-native/mobile";var pt={randomUUID:()=>p(()=>Zt.randomUUID())};var en=["authorized","denied","notDetermined","restricted","unsupported"];function pe(){let e=G(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function tn(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function ft(e){return en.includes(e)?e:"unsupported"}function nn(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function J(e,t,...n){return p(async()=>{let r=pe();if(typeof r?.[e]!=="function")throw tn();return t(await r[e](...n))})}var mt={isAvailable:()=>typeof pe()?.isSupported==="function",supports:(e)=>typeof pe()?.[e]==="function",isSupported:()=>p(async()=>{let e=pe();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>J("authorization",ft),requestAuthorization:()=>J("requestAuthorization",ft),list:()=>J("list",(e)=>Array.isArray(e)?e.map(nn).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return J("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>J("remove",(t)=>t===!0,e),removeAll:()=>J("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function zr(e,t){let n=t.delay??500,r=t.tolerance??10,o=null,i=null,a=!1,s=()=>{if(o)clearTimeout(o);if(o=null,i&&!a)t.onPressEnd?.();i=null},l=(g)=>{let c=g;if(c.button!==void 0&&c.button!==0)return;a=!1,i={x:c.clientX,y:c.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},m=(g)=>{if(!i)return;let c=g;if(Math.hypot(c.clientX-i.x,c.clientY-i.y)>r)s()},d=(g)=>{if(!a)return;a=!1,g.preventDefault(),g.stopPropagation()},u=(g)=>g.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",m),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",d,!0),e.addEventListener("contextmenu",u),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",m),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",d,!0),e.removeEventListener("contextmenu",u)}}function rn(e,t,n){if(n<=1||t.width<=0)return 0;let r=Math.floor((e-t.left)/t.width*n);return Math.max(0,Math.min(n-1,r))}function qr(e,t){let n=null,r=null,o=!1,i=0,a=(c)=>{let f=e.getBoundingClientRect();return rn(c,{left:f.left+2,width:f.width-4},t.count())},s=(c)=>{let f=c;if(f.button!==void 0&&f.button!==0)return;let h=a(f.clientX);if(h!==t.selected())return;n=h,i=h,o=!1,r=f.pointerId;try{e.setPointerCapture?.(f.pointerId)}catch{}t.onPress?.(!0)},l=(c)=>{if(n===null)return;let f=a(c.clientX);if(f===i)return;o=!0,i=f,t.onScrub(f)},m=(c)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),c&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},d=(c)=>{if(!o)return;o=!1,c.preventDefault(),c.stopPropagation()},u=()=>m(!0),g=()=>m(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",g),e.addEventListener("click",d,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",g),e.removeEventListener("click",d,!0)}}function Vr(e,t,n){if(n<=0)return null;switch(e){case"ArrowRight":case"ArrowDown":return(t+1)%n;case"ArrowLeft":case"ArrowUp":return(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}function Gr(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function Yr(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=I("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as on}from"@bughq/sdk";import{crashReporter as Z}from"craft-native/mobile";var H=null;function an(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function gt(){return Z.isAvailable()}function sn(e){return async(t)=>{if(!gt())return!e;return Z.capture(t)}}var eo={start(e={}){if(H)return H;let t=ee()||gt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return H=new on({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?sn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!an(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)Z.addBreadcrumb(i);return i}}),H},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);H?.setUser(t===null?null:{id:t}),await Z.setUser(t)},capture(e,t){H?.captureException(e,t)},addBreadcrumb(e){if(H)H.addBreadcrumb(e);else Z.addBreadcrumb(e)},async flush(){await Promise.all([H?.flush(),Z.flush()])},client(){return H},stop(){H?.close(),H=null}};function Le(e){let t=E();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function ht(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function bt(){let e=E()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:ht(e?.getAttribute("data-craft-reduce-motion"))||Le("(prefers-reduced-motion: reduce)"),reduceTransparency:ht(e?.getAttribute("data-craft-reduce-transparency"))||Le("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||Le("(prefers-color-scheme: dark)")?"dark":"light"}}function ln(e){let t=bt(),n=Number(e?.fontScale);return{contentSizeCategory:typeof e?.contentSizeCategory==="string"?e.contentSizeCategory:void 0,fontScale:Number.isFinite(n)&&n>0?n:t.fontScale,reduceMotion:typeof e?.reduceMotion==="boolean"?e.reduceMotion:t.reduceMotion,reduceTransparency:typeof e?.reduceTransparency==="boolean"?e.reduceTransparency:t.reduceTransparency,colorScheme:e?.colorScheme==="dark"||e?.colorScheme==="light"?e.colorScheme:t.colorScheme}}function vt(e,t={}){if(t.immediate!==!1)e(bt());return F("craftAppearance",(n)=>e(ln(n)))}function oo(e){return F("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function io(e){return F("craftMemoryWarning",()=>e())}function yt(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>re.complete(!0),()=>re.complete(!1))}}function ao(e){let t=yt(e);return F("craftSilentPush",(n)=>t(n.payload??{}))}function so(e){let t=yt(()=>e());return F("craftBackgroundRefresh",()=>t(void 0))}import{haptics as cn}from"craft-native/mobile";function Ce(){if(typeof window>"u")return;return window}function oe(e=Ce()){if(!e)return 0;if(typeof e.scrollY==="number")return e.scrollY;if(typeof e.scrollTop==="number")return e.scrollTop;return e.document?.scrollingElement?.scrollTop??0}function un(e,t=Ce()){if(!t)return()=>{};let n=!1,r=typeof requestAnimationFrame==="function"?requestAnimationFrame:(i)=>setTimeout(i,16),o=()=>{if(n)return;n=!0,r(()=>{n=!1,e(oe(t))})};return e(oe(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function dn(e,t){let n=Math.max(0,-e),r=e<=0?Math.max(0,t)*0.5:0;return Math.round(Math.max(n,r))}function uo(e){let t=e.host??Ce();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(h)=>setTimeout(h,16),s=null,l=(h)=>{s=null,e.onPull?.(h,o,{bounce:Math.min(h,Math.max(0,-oe(t)))})},m=(h)=>{let w=s!==null;if(s=h,w)return;a(()=>{if(s!==null)l(s)})},d=(h)=>{let w=h.touches?.[0];return w?w.clientY:null},u=(h)=>{if(i||oe(t)>0)return;r=d(h),o=!1},g=(h)=>{if(r===null)return;let w=d(h);if(w===null)return;let k=dn(oe(t),w-r);if(!o&&k>=n)o=!0,Promise.resolve(cn.impact("medium")).catch(()=>{});else if(o&&k<n*0.8)o=!1;m(k)},c=async()=>{if(r===null)return;if(r=null,!o){l(0);return}o=!1,i=!0,l(n);try{await e.onRefresh()}finally{i=!1,l(0)}},f=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchmove",g,{passive:!0}),t.addEventListener("touchend",c),t.addEventListener("touchcancel",f),()=>{s=null,t.removeEventListener("touchstart",u),t.removeEventListener("touchmove",g),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",f)}}function pn(e,t=52){let n=Math.max(1,t),r=Math.min(1,Math.max(0,e/n)),o=e<0?1+Math.min(0.1,-e/600):1;return{progress:Math.round(r*1000)/1000,stretch:Math.round(o*1000)/1000}}function po(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return un((o)=>{let i=pn(o,r()),a=`${i.progress}|${i.stretch}`;if(a===n)return;n=a,e.style.setProperty("--native-nav-progress",String(i.progress)),e.style.setProperty("--native-nav-stretch",String(i.stretch)),t.onChange?.(i)},t.host)}function fo(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function xt(){if(typeof window>"u")return;return window}var St="__stxPushed",fn="__stxScroll";function mn(e=xt()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(St in n)return n[St]===!0;return!(fn in n)}function go(e=xt()){if(!mn(e))return!1;return e.history.back(),!0}function ho(e,t,n=50){let r=e[e.length-1];if(e.length>=2&&e[e.length-2].path===t)e.pop();else if(!r||r.path!==t)e.push({path:t,title:""});if(e.length>n)e.splice(0,e.length-n);return{current:e[e.length-1],previous:e[e.length-2]??null}}function bo(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function vo(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function gn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function yo(){if(typeof window>"u")return;let e=window.stxRouter;if(typeof e?.screens!=="function")return;let t=e.screens(),n=t.find((o)=>o.active);if(!n)return;let r=t.filter((o)=>o.tab===n.tab&&o.depth<n.depth);if(!r.length)return null;return gn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function So(e=typeof window>"u"?void 0:window){let t=e?.stxRouter;if(typeof t?.screens!=="function"||typeof e?.history?.go!=="function")return!1;let n=t.screens(),r=n.find((a)=>a.active);if(!r)return!1;let o=n.filter((a)=>a.tab===r.tab&&a.depth<r.depth);if(!o.length)return!1;let i=o.reduce((a,s)=>s.depth<a.depth?s:a);return e.history.go(i.depth-r.depth),!0}function wo(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function hn(e,t=bn()){let n;try{n=new URL(e)}catch{return null}let r=`${n.search}${n.hash}`;if(n.protocol==="http:"||n.protocol==="https:"){if(!t||n.origin!==t)return null;return`${n.pathname||"/"}${r}`}return`${`/${[n.host,n.pathname.replace(/^\/+/,"")].filter(Boolean).join("/")}`}${r}`}function bn(){if(typeof window>"u")return;return window.location?.origin}var wt="stacks-mobile-deep-link";function xo(e,t){let n=(r)=>{let o=hn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(wt)===r)return;sessionStorage.setItem(wt,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Ao=5000;function vn(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let d=i+a>>1;if(r[d].timestamp<o.timestamp)i=d+1;else a=d}let s=r[i],l=r[i-1],m=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!m||Math.abs(m.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(m.bpm)}})}var yn=6371008.8,Sn=30,wn=Sn;function xn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*yn*Math.asin(Math.min(1,Math.sqrt(i)))}function Rn(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&Math.abs(r.latitude)<=90&&Math.abs(r.longitude)<=180&&Number.isFinite(r.accuracy)&&r.accuracy>=0&&r.accuracy<=t).sort((r,o)=>r.timestamp-o.timestamp).filter((r)=>{if(n.has(r.timestamp))return!1;return n.add(r.timestamp),!0})}function Me(e,t={}){let n=Rn(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let u of n){let g=o[o.length-1],c=s?(u.timestamp-s.timestamp)/1000:0;if(s=u,!g){o.push({fix:u,cumM:0});continue}if(c>wn){o.push({fix:u,cumM:i});continue}let f=(u.timestamp-g.fix.timestamp)/1000,h=xn(g.fix,u),w=Math.min(10,Math.max(3,g.fix.accuracy,u.accuracy));if(h<w)continue;if(i+=h,f>0&&h/f>=0.5)a+=f;o.push({fix:u,cumM:i})}let l=o[o.length-1],m=null,d=null;if(l&&n.at(-1).timestamp-l.fix.timestamp<=r*1000){let u=l.fix.timestamp-r*1000,g=o.find((h)=>h.fix.timestamp>=u)??l,c=l.cumM-g.cumM,f=(l.fix.timestamp-g.fix.timestamp)/1000;if(c>=20&&f>0)d=c/f,m=f/(c/1000)}return{distanceM:i,movingS:a,paceSPerKm:m,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:d,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function ko(e){if(e==null||e<=0||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Eo(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Rt={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function To(e){let t=e.location,n=e.intervalMs??3000,r=Rt,o=null,i=e.heartRate,a=!1,s=null,l=[],m=()=>typeof document<"u"&&document.visibilityState==="hidden",d=0,u=null,g=Promise.resolve(),c=null,f=!1,h=null;function w(){if(f)throw Object.assign(Error("The recording screen is no longer active"),{code:"RECORDING_CONFLICT"});if(t.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect native recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"})}function k(){if(w(),!h)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return h}function B(b){let S=g.then(b);return g=S.then(()=>{},()=>{}),S}function O(){if(u)return u;let b=d,S=h,P=(async()=>{if(w(),!S)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let C=await t.readRecording({expectedId:S}),N=Me(C,e);if(b===d&&!f)r=N,e.onUpdate?.(r);return N})().finally(()=>{if(u===P)u=null});return u=P,P}function y(){if(x(),f)return;o=setInterval(()=>{if(!m())O().catch(()=>{})},n)}function x(){if(o)clearInterval(o);o=null}function A(b,S,P){if(x(),d++,u=null,h=b,s=S,a=S!==null,l=[],r=P,!f)e.onUpdate?.(r)}async function R(b){if(!i||!a||!s||f||i.supportsRecordingOwnership?.()!==!0)return;await b(i,s).catch(()=>{})}return{get stats(){return r},get recordingId(){return h},get heartRateRecordingId(){return s},get heartRate(){return l},start(b){return c=null,B(async()=>{if(w(),b&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(b&&(typeof b.recordingId!=="string"||!b.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let S=await t.startRecording({enableHighAccuracy:!0,...e.locationOptions,...b?{recordingId:b.recordingId}:{}});if(!S?.active||typeof S.id!=="string"||!S.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(b&&S.id!==b.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let P=null;if(!f&&i?.isAvailable()&&i.supportsRecordingOwnership?.()===!0&&(!b||b.heartRateRecordingId&&i.supportsRecordingIntentIdentity?.()===!0))try{let C=await i.startRecording(b?{recordingId:b.heartRateRecordingId}:void 0);if(b&&C.id!==b.heartRateRecordingId)throw Object.assign(Error("The native heart rate did not start with its registered ID"),{code:"RECORDING_CONFLICT"});if(C.active&&typeof C.id==="string"&&C.id.trim())P=C.id}catch{}return A(S.id,P,{...Rt}),y(),r})},attach(b){return c=null,B(async()=>{if(typeof b?.expectedId!=="string"||!b.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});w();let S=await t.getRecordingState({expectedId:b.expectedId});if(w(),!S?.id)return null;if(S.id!==b.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let P=null;if(b.expectedHeartRateId!==void 0){let N=b.expectedHeartRateId;if(typeof N!=="string"||!N.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!i?.isAvailable()||i.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let Ut=await i.getRecordingState({expectedId:N});if(w(),Ut.id!==N)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await i.readRecording({expectedId:N,since:Date.now()}),w(),P=N}let C=await t.readRecording({expectedId:b.expectedId});if(w(),A(b.expectedId,P,Me(C,e)),S.active&&!S.paused)y();return S})},pause(){return B(async()=>{await t.pauseRecording({expectedId:k()}),await R((b,S)=>b.pauseRecording({expectedId:S})),x(),await O().catch(()=>{})})},resume(){return B(async()=>{await t.resumeRecording({expectedId:k()}),await R((b,S)=>b.resumeRecording({expectedId:S})),y()})},stop(){if(c)return c;let b=B(async()=>{x(),d++;let S=k(),P=await t.stopRecording({expectedId:S});if(P.id!==S)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let C=P?.locations??[];if(!f&&i&&a&&s&&i.supportsRecordingOwnership?.()===!0){let N=await i.stopRecording({expectedId:s}).catch(()=>null);a=!1,l=N?.id===s?N.samples:[],C=vn(C,l)}if(r=Me(C,e),!f)e.onUpdate?.(r);return C}).catch((S)=>{if(c===b)c=null;throw S});return c=b,b},dispose(){f=!0,d++,u=null,x()},refresh:O}}function Oo(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Po(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Lo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Co(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var No=150;function An(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(i)))}function fe(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Ho(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)&&Math.abs(a.latitude)<=90&&Math.abs(a.longitude)<=180),r=n.filter((a)=>a.accuracy!=null).map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?fe(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:fe(n.map((s)=>s.latitude),0.5),longitude:fe(n.map((s)=>s.longitude),0.5)};i=fe(n.map((s)=>An(a,s)),0.8)}if(n.length>=10&&i>150&&o<=15)return"outside";if(t<150)return"unsure";if(n.length<3||o>30||i<25)return"indoors";if(i<50&&o>10)return"indoors";return"unsure"}function Do(e,t={}){let r=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d*)?|\.\d+)\s*(km|k|m|mi)?$/);if(!r)return null;let o=Number(r[1]),i=r[2]||t.defaultUnit||(o>100?"m":"km"),a=i==="m"?o/1000:i==="mi"?o*1.609344:o;return Number.isFinite(a)&&a>=0&&a<=2000?Math.round(a*1000)/1000:null}var he=new Set,At=!1,me=null;function kn(e){return e.isConnected&&e.getClientRects().length>0}function kt(){return[...he].find((e)=>kn(e.element))}function ge(){let e=kt(),t=Boolean(e);if(t===At)return;if(At=t,t)j.enable(e?.tintColor?{tintColor:e.tintColor}:{});else j.disable()}function En(){let e=kt();if(!e){j.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>j.end())}function Fo(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};he.add(n);let r=e.ownerDocument?.defaultView;if(!me){let o=j.onRefresh(En),i=()=>ge();r?.addEventListener("stx:load",i),me=()=>{o(),r?.removeEventListener("stx:load",i)}}return ge(),r?.requestAnimationFrame?.(()=>ge()),()=>{if(he.delete(n),he.size===0)me?.(),me=null;ge()}}var Uo=0.5;function Tn(e,t,n){let r=[];if(n.includes("large")||n.length===0)r.push({name:"large",y:0});if(n.includes("medium"))r.push({name:"medium",y:Math.max(0,Math.round(e-t*0.5))});return r.push({name:"dismiss",y:Math.max(1,e)}),r.sort((o,i)=>o.y-i.y)}function In(e){let{y:t,velocity:n,stops:r}=e,o=r.filter((s)=>s.name!=="dismiss"),i=r.find((s)=>s.name==="dismiss");if(o.length===0)return"dismiss";if(n>0.5)return(r.filter((l)=>l.y>t+1)[0]??i).name;if(n<-0.5){let s=o.filter((l)=>l.y<t-1);return(s[s.length-1]??o[0]).name}let a=o[o.length-1];if(t>a.y+(i.y-a.y)*0.5)return"dismiss";return o.reduce((s,l)=>Math.abs(l.y-t)<Math.abs(s.y-t)?l:s).name}function On(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function $o(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Tn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(d)=>{let u=d;if(u.button!==void 0&&u.button!==0)return;if(u.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let g=a().find((c)=>c.name===e.detent())?.y??0;n={y:u.clientY,base:g,pointerId:u.pointerId},o=g,r=[{y:g,t:u.timeStamp}],t.classList.add("is-dragging");try{d.currentTarget?.setPointerCapture?.(u.pointerId)}catch{}},l=(d)=>{if(!n)return;let u=d,g=n.base+u.clientY-n.y;o=g<0?-On(-g):g,r.push({y:o,t:u.timeStamp});while(r.length>2&&u.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let c=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/c))))},m=(d)=>{if(!n)return;let u=d;n=null;let g=r[0],c=Math.max(1,u.timeStamp-g.t),f=(o-g.y)/c;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(In({y:o,velocity:f,stops:a()}))};for(let d of e.handles)d.addEventListener("pointerdown",s),d.addEventListener("pointermove",l),d.addEventListener("pointerup",m),d.addEventListener("pointercancel",m);return()=>{for(let d of e.handles)d.removeEventListener("pointerdown",s),d.removeEventListener("pointermove",l),d.removeEventListener("pointerup",m),d.removeEventListener("pointercancel",m)}}function Ko(e){let t=e.ownerDocument;if(e.parentElement===t.body)return()=>{};let n=t.createComment("native-sheet");return e.parentNode?.insertBefore(n,e),t.body.appendChild(e),()=>{if(n.parentNode)n.parentNode.insertBefore(e,n);else e.remove();n.remove()}}var Ne=new WeakMap;function jo(e,t){let n=e.documentElement,r=Ne.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Ne.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Ne.set(e,r+1),r>0)return;let o=e.defaultView,i=(o?.scrollY??0)+(o?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(i)}px`),n.setAttribute("data-native-sheet-card","")}function Pn(e,t){e.style.setProperty("--native-font-scale",String(t.fontScale)),e.toggleAttribute("data-native-reduce-motion",t.reduceMotion),e.toggleAttribute("data-native-reduce-transparency",t.reduceTransparency)}function Ln(e){let t=e.replace(/\s+/g,"").toLowerCase();return!t||t==="transparent"||/^rgba\(\d+,\d+,\d+,0(\.0+)?\)$/.test(t)||/\/0(\.0+)?\)$/.test(t)}function Cn(e){let t=e.defaultView;if(!t?.getComputedStyle)return null;for(let n of[e.body,e.documentElement]){if(!n)continue;let r=t.getComputedStyle(n).backgroundColor;if(r&&!Ln(r))return r}return null}function Mn(e){if(e.documentElement.classList.contains("dark"))return!0;if(e.documentElement.classList.contains("light"))return!1;return Boolean(e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches)}function Go(e,t={}){let n=t.root??e.documentElement;ne.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let d=Cn(e);if(d&&d!==r)r=d,ne.setUnderPageColor(d);let u=Mn(e)?"light":"dark";if(u!==o)o=u,de.setStyle(u)},a=vt((d)=>{Pn(n,d),i()}),s=e.defaultView,l=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;l?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let m=s?.matchMedia?.("(prefers-color-scheme: dark)");return m?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),m?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var Qo=64;var Nn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Hn=/^(?:0|[1-9]\d*)$/;function Tt(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,m=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Nn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:m})}return{kinds:t,problems:n}}function ae(e,t){return e.find((n)=>n.name===t)??null}function ie(e,t,n){let r=ae(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function Dn(e,t){if(typeof t!=="string")return null;let n=t.lastIndexOf("-slot-");if(n<=0)return null;let r=t.slice(0,n),o=t.slice(n+6);if(!Hn.test(o))return null;let i=Number(o);return ie(e,r,i)===t?{kind:r,slot:i}:null}function It(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function Xo(e,t){let n=e&&typeof e==="object"?e:{};if(n.enabled===!1)return[];let o=[...(Array.isArray(n.activityTypes)?n.activityTypes.filter((i)=>typeof i==="string"&&i.trim().length>0):[]).map((i)=>i.trim()),...It(Tt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Ot(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ae(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function _n(e,t,n,r,o=Date.now()){let i=ae(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((f)=>f.kind===n),s=Ot(e,n,r),l=a.find((f)=>f.itemId===r.id)??null,m=l?null:Un(a,i.slots),d=l||m!==null?null:$n(a),u=l?.slot??m??d?.slot;if(u===void 0||u===null)return null;let g={kind:n,slot:u,itemId:r.id,title:s,donatedAt:o},c=t.filter((f)=>f.kind!==n||f.slot!==u&&f.itemId!==r.id);return{entries:Pt(e,[...c,g]),entry:g,evicted:d,changed:!l||l.title!==s}}function Bn(e,t,n){let r=e.find((o)=>o.kind===t&&o.itemId===n)??null;return{entries:r?e.filter((o)=>o!==r):[...e],removed:r}}function Fn(e,t,n){let r=Dn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ae(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Wn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:m,donatedAt:d}=i;if(typeof a!=="string"||typeof s!=="number"||ie(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let u=`${a}-slot-${s}`,g=`${a}#${l}`;if(n.has(u)||r.has(g))continue;n.set(u,{kind:a,slot:s,itemId:l,title:typeof m==="string"&&m.trim()?m:Ot(e,a,{id:l}),donatedAt:typeof d==="number"&&Number.isFinite(d)&&d>0?d:0}),r.add(g)}return Pt(e,[...n.values()])}function Pt(e,t){let n=new Map(e.map((r,o)=>[r.name,o]));return[...t].sort((r,o)=>(n.get(r.kind)??0)-(n.get(o.kind)??0)||r.slot-o.slot)}function Un(e,t){let n=new Set(e.map((r)=>r.slot));for(let r=0;r<t;r++)if(!n.has(r))return r;return null}function $n(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Kn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var jn="stacks_spotlight_index",zn=3000;function Jo(e){let t=e.onProblem??((y)=>console.warn(`[spotlight] ${y}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Tt(e.kinds);for(let y of n.problems)t(y);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??jn,i=e.legacyStorageKeys??[],a=e.timeoutMs??zn,s=e.now??(()=>Date.now()),l=e.bridge??Kn,m=null;function d(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function u(){if(m)return m;m=[];let y=d();if(!y)return m;try{let x=[o,...i].map((A)=>y.getItem(A)).find((A)=>A);m=x?Wn(r,JSON.parse(x)):[]}catch{m=[]}return m}function g(y){m=y;let x=d();if(!x)return;try{x.setItem(o,JSON.stringify(y));for(let A of i)x.removeItem(A)}catch{}}async function c(y){if(!y)return null;let x;try{return await Promise.race([y,new Promise((A)=>{x=setTimeout(()=>A(null),a)})])}catch{return null}finally{if(x!==void 0)clearTimeout(x)}}let f=Promise.resolve();function h(y){let x=f.then(y,y);return f=x.catch(()=>{return}),x}async function w(y,x){let A=l()?.register;if(!A||r.length===0)return!1;return h(async()=>{let R=_n(r,u(),y,x,s()),b=R&&ie(r,y,R.entry.slot);if(!R||!b)return!1;if(!R.changed)return g(R.entries),!0;let S=await c(A(R.entry.title,b))!==null;if(S)g(R.entries);return S})}async function k(y,x){let A=l()?.remove;if(!A)return!1;return h(async()=>{let{entries:R,removed:b}=Bn(u(),y,x);if(!b)return!1;let S=ie(r,y,b.slot),P=S?await c(A(S))!==null:!1;return g(R),P})}async function B(y,x){let A=ae(r,y)?.slots;if(!A||!l()?.register)return 0;let R=0;for(let b of[...x].slice(0,A).reverse())if(await w(y,b))R++;return R}async function O(){let y=l()?.remove;if(!y)return g([]),0;return h(async()=>{let x=0;for(let A of u()){let R=ie(r,A.kind,A.slot);if(R&&await c(y(R))!==null)x++}return g([]),x})}return{kinds:r,index:w,sync:B,remove:k,clear:O,routeFor:(y)=>Fn(r,u(),y),entries:()=>u(),activityTypes:(y)=>It(r).map((x)=>`${y}.${x}`),reset:()=>{m=null}}}var Et=["craftShortcut","craftSiriShortcut"];function Zo(e,t){let n=(r)=>{let o=r.detail,i=typeof o==="string"?o:o&&typeof o==="object"?o.action??o.type:null,a=typeof i==="string"?e.routeFor(i):null;if(a)t(a)};if(typeof globalThis.addEventListener!=="function")return()=>{};for(let r of Et)globalThis.addEventListener(r,n);return()=>{for(let r of Et)globalThis.removeEventListener(r,n)}}import{tabBar as qn}from"craft-native/mobile";var Vn=qn;function Gn(e){return Array.from(e.querySelectorAll("a[data-native-tab]")).map((t)=>({id:t.getAttribute("href")||"",title:t.getAttribute("data-native-tab")||t.getAttribute("aria-label")||"",symbol:t.getAttribute("data-native-tab-symbol")||"circle",badge:(t.querySelector(".native-tab-badge")?.textContent||"").trim(),current:t.hasAttribute("data-stx-nav-current")||t.classList.contains("is-active")})).filter((t)=>t.id&&t.title)}function Yn(e){return{tabs:e.map(({id:n,title:r,symbol:o,badge:i})=>i?{id:n,title:r,symbol:o,badge:i}:{id:n,title:r,symbol:o}),selected:e.find((n)=>n.current)?.id}}function Ct(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function Qn(){return typeof Ct()?.selectTab==="function"}function ni(e,t={}){let n=(r)=>{if(Qn()||r.defaultPrevented)return;let o=r.target?.closest?.("a[data-native-tab]");if(!o||!e.contains(o))return;if(!o.hasAttribute("data-stx-nav-current")&&!o.classList.contains("is-active")&&o.getAttribute("aria-current")!=="page")return;r.preventDefault();let i=e.ownerDocument.defaultView;if(t.scrollToTop)t.scrollToTop();else i?.scrollTo?.({top:0,behavior:i.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"});i?.dispatchEvent(new CustomEvent("stx:tabreselect",{detail:{href:o.getAttribute("href")||""}}))};return e.addEventListener("click",n),()=>e.removeEventListener("click",n)}function Lt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var He="stacks:tab-bar-cover";function ri(e,t){if(t)e.setAttribute("data-native-covers-tab-bar","");else e.removeAttribute("data-native-covers-tab-bar");e.ownerDocument?.defaultView?.dispatchEvent(new Event(He))}function oi(e,t={}){let n=t.api??Vn;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar], [data-native-covers-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=Lt(o?.getPropertyValue("--native-tab-active")||""),a=Lt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:g,selected:c}=Yn(Gn(e)),f=JSON.stringify({tabs:g,selected:c});if(f===s)return;let h=s&&s!=="hidden"?JSON.parse(s):null;if(h&&c&&JSON.stringify(h.tabs)===JSON.stringify(g))n.select(c);else n.set(g,{selected:c,tint:i,tintDark:a});s=f},m=typeof MutationObserver==="function"?new MutationObserver(l):null;m?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let d=n.onSelect((g)=>{let c=Ct();if(c?.selectTab){c.selectTab(g);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((h)=>h.getAttribute("href")===g)?.click()}),u=()=>l();if(typeof window<"u")window.addEventListener("stx:load",u),window.addEventListener("stx:screen-shown",u),window.addEventListener(He,u);return l(),()=>{if(m?.disconnect(),d(),typeof window<"u")window.removeEventListener("stx:load",u),window.removeEventListener("stx:screen-shown",u),window.removeEventListener(He,u);n.hide()}}function Xn(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((h)=>Number.isSafeInteger(h)&&h>0)||t>300)throw TypeError("Invalid voice recording limits");let r={status:"idle",audio:null,error:null},o=new Set,i={},a=null,s=null,l=null,m,d=(h)=>{r=h;for(let w of o)w({...h})},u=()=>{clearTimeout(m),l?.getTracks().forEach((h)=>h.stop()),l=null};function g(){if(i={},a){let w=a;a=null,Promise.resolve(I("audioRecording.cancel")?.(w)).catch(()=>{})}let h=s;if(s=null,h&&h.state!=="inactive")h.stop();u(),d({status:"idle",audio:null,error:null})}async function c(){g();let h=i;d({status:"requesting",audio:null,error:null});try{let w=I("audioRecording.start");if(w){let R=globalThis.crypto.randomUUID();if(a=R,await w(R,{maxSeconds:t}),i!==h)return;m=setTimeout(()=>{if(i===h)f()},t*1000-250),d({status:"recording",audio:null,error:null});return}if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>"u")throw Error("Microphone recording is unavailable. Upload an audio recording instead.");let k=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==h){k.getTracks().forEach((R)=>R.stop());return}l=k;let B=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((R)=>MediaRecorder.isTypeSupported(R)),O=new MediaRecorder(k,{...B?{mimeType:B}:{},audioBitsPerSecond:32000});s=O;let y=[],x=0,A=!1;O.ondataavailable=(R)=>{if(i!==h||!R.data.size)return;if(x+=R.data.size,x>n){if(A=!0,y.length=0,O.state!=="inactive")O.stop();u();return}if(!A)y.push(R.data)},O.onerror=()=>{if(i!==h)return;g(),d({status:"error",audio:null,error:"Recording failed. Please try again."})},O.onstop=()=>{if(i!==h)return;s=null,u();let R=new Blob(y,{type:O.mimeType||B||"audio/webm"});d(A||!R.size?{status:"error",audio:null,error:A?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:R,error:null})},O.start(1000),m=setTimeout(()=>{if(i===h&&O.state!=="inactive")O.stop()},t*1000-250),d({status:"recording",audio:null,error:null})}catch(w){if(i!==h)return;g(),d({status:"error",audio:null,error:w instanceof Error?w.message:"Microphone permission was refused."})}}async function f(){if(!a){if(s&&s.state!=="inactive")s.stop();return}let h=i,w=a;clearTimeout(m);try{let k=await I("audioRecording.stop")?.(w);if(i!==h)return;if(!k?.path||!k.size||k.size>n||!Number.isFinite(k.durationSeconds)||k.durationSeconds<=0||k.durationSeconds>t+1)throw Error("The recording is empty or exceeds its limits.");d({status:"ready",audio:k,error:null})}catch(k){if(i!==h)return;g(),d({status:"error",audio:null,error:k instanceof Error?k.message:"Recording failed."})}}return{start:c,cancel:g,dispose(){g(),o.clear()},stop:f,supported:()=>Boolean(I("audioRecording.start"))||typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(h){return o.add(h),h({...r}),()=>{o.delete(h)}}}}function Jn(e,t={},n="audio"){if(!n||Object.hasOwn(t,n))throw TypeError("Use a distinct recording field name");let r=new FormData;if(typeof Blob<"u"&&e instanceof Blob)r.append(n,e,"feedback");else{if(!e||!("path"in e)||typeof e.path!=="string"||!e.path||!I("audioRecording.stop"))throw TypeError("A native recording requires its native upload host");Reflect.apply(r.append,r,[n,e]);let o=r.get(n);if(!o||typeof o!=="object"||!("path"in o)||o.path!==e.path)throw TypeError("The upload host did not preserve the native recording file")}for(let[o,i]of Object.entries(t)){if(typeof i!=="string")throw TypeError("Upload fields must be strings");r.append(o,i)}return r}var nr={isAvailable:()=>p(()=>De.isAvailable()),getBiometricType:()=>p(()=>De.getBiometricType()),authenticate:(e)=>p(()=>De.authenticate(e))},rr={takePicture:(e)=>p(()=>ve.takePicture(e)),pickImage:()=>p(()=>ve.pickImage()),pickMultiple:(e)=>p(()=>ve.pickMultiple(e)),isAvailable:()=>p(()=>ve.isAvailable())},or={getInfo:()=>p(()=>Q.getInfo()),getCapabilities:()=>p(()=>Q.getCapabilities()),isMobile:()=>Q.isMobile(),isIOS:()=>Q.isIOS(),isAndroid:()=>Q.isAndroid(),getLocale:()=>Q.getLocale(),getTimezone:()=>Q.getTimezone()},ir=er;function z(){return V()?.capabilities.locationRecordingOwnership===!0&&D.supportsRecordingOwnership?.()===!0}function q(){return V()?.capabilities.heartRateRecordingOwnership===!0&&T.supportsRecordingOwnership?.()===!0}function _t(){return z()&&V()?.capabilities.locationRecordingIntentIdentity===!0&&D.supportsRecordingIntentIdentity?.()===!0}function Bt(){return q()&&V()?.capabilities.heartRateRecordingIntentIdentity===!0&&T.supportsRecordingIntentIdentity?.()===!0}function Wt(e,t,n){return p(async()=>{let r=e&&Object.hasOwn(e,"recordingId");if(r){if(!t())throw Object.assign(Error("This host or adapter cannot start a registered recording identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(typeof e.recordingId!=="string"||!e.recordingId.trim())throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"})}let o=await n();if(r&&o.id!==e.recordingId)throw Object.assign(Error("The native recording identity changed at start"),{code:"RECORDING_CONFLICT"});return o})}function _(e,t,n){return p(()=>{if(e&&Object.hasOwn(e,"expectedId")){if(!t())throw Object.assign(Error("This host or adapter cannot protect recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});if(typeof e.expectedId!=="string"||!e.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"})}return n()})}var ar={supportsRecordingOwnership:z,supportsRecordingIntentIdentity:_t,acknowledgeRecording:(e)=>_({expectedId:e?.expectedId},z,()=>D.acknowledgeRecording(e)),getCurrentPosition:(e)=>p(()=>D.getCurrentPosition(e)),watchPosition:(e,t)=>D.watchPosition(e,t),clearWatch:(e)=>D.clearWatch(e),startRecording:(e)=>Wt(e,_t,()=>D.startRecording(e)),pauseRecording:(e)=>_(e,z,()=>D.pauseRecording(e)),resumeRecording:(e)=>_(e,z,()=>D.resumeRecording(e)),stopRecording:(e)=>_(e,z,()=>D.stopRecording(e)),getRecordingState:(e)=>_(e,z,()=>D.getRecordingState(e)),readRecording:(e)=>_(e,z,()=>D.readRecording(e))},sr={show:(e)=>p(()=>Se.show(e)),schedule:(e)=>p(()=>Se.schedule(e)),cancelAll:()=>p(()=>Se.cancelAll()),setBadge:(e)=>p(()=>Se.setBadge(e))},lr={check:(e)=>p(()=>le.check(e)),request:(e)=>p(()=>le.request(e)),checkMultiple:(e)=>p(()=>le.checkMultiple(e)),requestMultiple:(e)=>p(()=>le.requestMultiple(e)),openSettings:()=>p(()=>le.openSettings())},cr={set:(e,t)=>p(()=>we.set(e,t)),get:(e)=>p(()=>we.get(e)),delete:(e)=>p(()=>we.delete(e)),clear:()=>p(()=>we.clear())},ur={share:(e)=>p(()=>Dt.share(e)),isAvailable:()=>Dt.isAvailable()},dr={request:()=>p(()=>Zn.request())},Re={impact:(e)=>Promise.resolve().then(()=>ye.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ye.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ye.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ye.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=I("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function Ft(e){if(typeof e==="string")return e.trim()||null;if(!e||typeof e!=="object")return null;let t=e.url;return typeof t==="string"&&t.trim()?t:null}var pr={async getInitialURL(){if(!await X())return null;return Ft(await Mt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Mt.onLink?.((o,i)=>{let a=Ft(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Ae()?.craft)r();else X().then(r);return()=>{n=!0,t?.()}}},mi={isAvailable:()=>xe.isAvailable(),set:(e,t)=>xe.set(e,t),remove:(e)=>xe.remove(e),clear:()=>xe.clear()},fr={enable:()=>p(()=>Nt.enable()),disable:()=>p(()=>Nt.disable())},mr={isAvailable:()=>be.isAvailable(),get:()=>p(()=>be.get()),set:(e)=>p(()=>be.set(e)),restore:()=>p(()=>be.restore())},gr={isAvailable:()=>U.isAvailable(),supports:(e)=>U.supports(e),getAuthorizationStatus:()=>p(()=>U.getAuthorizationStatus()),requestAuthorization:()=>p(()=>U.requestAuthorization()),getNowPlaying:()=>p(()=>U.getNowPlaying()),play:()=>p(()=>U.play()),pause:()=>p(()=>U.pause()),togglePlayPause:()=>p(()=>U.togglePlayPause()),skipToNext:()=>p(()=>U.skipToNext()),skipToPrevious:(e)=>p(()=>U.skipToPrevious(e)),onChange:(e)=>Y(()=>U.onChange(e))},hr={supportsRecordingOwnership:q,supportsRecordingIntentIdentity:Bt,acknowledgeRecording:(e)=>_({expectedId:e?.expectedId},q,()=>T.acknowledgeRecording(e)),isAvailable:()=>T.isAvailable(),supports:(e)=>T.supports(e),getState:()=>p(()=>T.getState()),requestAuthorization:()=>p(()=>T.requestAuthorization()),scan:(e)=>p(()=>T.scan(e)),stopScan:()=>p(()=>T.stopScan()),getDevices:()=>p(()=>T.getDevices()),connect:(e)=>p(()=>T.connect(e)),reconnect:()=>p(()=>T.reconnect()),disconnect:(e)=>p(()=>T.disconnect(e)),startRecording:(e)=>Wt(e,Bt,()=>T.startRecording(e)),pauseRecording:(e)=>_(e,q,()=>T.pauseRecording(e)),resumeRecording:(e)=>_(e,q,()=>T.resumeRecording(e)),stopRecording:(e)=>_(e,q,()=>T.stopRecording(e)),getRecordingState:(e)=>_(e,q,()=>T.getRecordingState(e)),readRecording:(e)=>_(e,q,()=>T.readRecording(e)),onReading:(e)=>Y(()=>T.onReading(e)),onDevice:(e)=>Y(()=>T.onDevice(e)),onState:(e)=>Y(()=>T.onState(e))},br={isAvailable:()=>Fe.isAvailable(),speak:(e,t)=>p(()=>Fe.speak(e,t)),stop:()=>p(()=>Fe.stop())},vr={getStatus:()=>p(()=>Ht.getStatus()),onChange:(e)=>Y(()=>Ht.onChange(e))},yr={register:()=>p(()=>Be.register()),onToken:(e)=>Be.onToken(e),onNotification:(e)=>Y(()=>Be.onNotification(e))},Sr={requestAuthorization:(e,t)=>p(()=>se.requestAuthorization(e,t)),getData:(e,t)=>p(()=>se.getData(e,t)),saveWorkout:(e)=>p(()=>se.saveWorkout(e)),getWorkouts:(e)=>p(()=>se.getWorkouts(e)),getDailyStatistics:(e,t)=>p(()=>se.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>v("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>v("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>v("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>v("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>v("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>v("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>v("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>F("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>I(`health.${e}`)!==null},wr={start:(e)=>p(()=>_e.start(e)),update:(e)=>p(()=>_e.update(e)),end:()=>p(()=>_e.end())},xr={send:(e)=>p(()=>ce.send(e)),updateContext:(e)=>p(()=>ce.updateContext(e)),isReachable:()=>p(()=>ce.isReachable()),onMessage:(e)=>ce.onMessage(e),onReachabilityChange:(e)=>ce.onReachabilityChange(e)},gi=tr;function Ae(){return E()}function V(){let e=Ae()?.craft;if(!e||typeof e!=="object")return null;if(!("platform"in e)||e.platform!=="ios"&&e.platform!=="android")return null;let t="capabilities"in e?e.capabilities:void 0,n=t&&typeof t==="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).filter(([,r])=>typeof r==="boolean")):{};return{platform:e.platform,capabilities:n}}function We(){return V()!==null}function Rr(e=2000){if(We()||ee())return Promise.resolve(!0);let t=Ae();if(!t||!(t.craft||t.webkit?.messageHandlers?.craft))return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(We())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Ar(e){let t=Ae();if(!t)return()=>{};if(V()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!V())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function kr(e){await Re.impact("light");try{let t=await e();return await Re.notification("success"),t}catch(t){throw await Re.notification("error"),t}}var hi={get nativeBridge(){return V()},biometrics:nr,camera:rr,device:or,haptics:Re,lifecycle:ir,location:ar,notifications:sr,permissions:lr,secureStorage:cr,storage:dt,crypto:pt,share:ur,appReview:dr,deepLinks:pr,keepAwake:fr,brightness:mr,music:gr,heartRate:hr,scheduledWorkouts:mt,speech:br,network:vr,pushNotifications:yr,health:Sr,liveActivities:wr,watchConnectivity:xr,dialog:te,contextMenu:Pe,browser:Ze,symbols:et,statusBar:de,chrome:ne,refresh:j,background:re,clipboard:tt,db:nt,files:rt,shortcuts:ot,widgets:it,orientation:at,auth:st,storeKit:lt,isNativeMobile:We,whenNative:Rr,onReady:Ar,withFeedback:kr};export{Er as BRIDGE_WAIT_MS,Ao as HEART_RATE_MATCH_MS,No as INDOOR_CHECK_AFTER_S,Qo as MAX_SPOTLIGHT_SLOTS_PER_KIND,Sn as ROUTE_GAP_S,Uo as SHEET_FLICK_VELOCITY,He as TAB_BAR_COVER_EVENT,p as afterBridge,dr as appReview,Pn as applyAppearance,vn as attachHeartRate,st as auth,bo as backLabelFor,re as background,nr as biometrics,ue as bridgePending,mr as brightness,Ze as browser,v as callNative,rr as camera,mn as canGoBack,ne as chrome,tt as clipboard,Mr as confirmAction,Pe as contextMenu,ri as coverTabBar,E as craftHost,G as craftRoot,eo as crashReporting,To as createRouteRecorder,Jo as createSpotlightIndex,Xn as createVoiceRecorder,pt as crypto,bt as currentAppearance,nt as db,hn as deepLinkPath,pr as deepLinks,or as device,te as dialog,ho as enterNavTrail,rt as files,xn as fixDistance,Gr as focusSegment,xo as followDeepLinks,V as getNativeMobileBridge,go as goBack,So as goBackToTabRoot,ni as handleTabReselect,Re as haptics,ee as hasNativeMobileHost,Sr as health,hr as heartRate,Ho as indoorVerdict,Go as installNativeChrome,Yr as installPressables,We as isNativeMobile,kn as isShown,fr as keepAwake,an as keepBreadcrumb,pn as largeTitleMetrics,ir as lifecycle,Ko as liftToBody,wr as liveActivities,ar as location,oi as mirrorTabBar,hi as mobile,gr as music,jt as nativeFunction,I as nativeFunctionNow,Yn as nativeTabs,vo as navTrail,vr as network,ln as normalizeAppearance,Ft as normalizeDeepLinkURL,nn as normalizeScheduledWorkout,sr as notifications,po as observeLargeTitle,zr as observeLongPress,Fo as observeNativeRefresh,un as observePageScroll,uo as observePullToRefresh,qr as observeSegmentScrub,$o as observeSheetDrag,vt as onAppearance,so as onBackgroundRefresh,F as onCraftEvent,io as onMemoryWarning,Ar as onMobileReady,oo as onResume,ao as onSilentPush,Zo as onSpotlightTap,at as orientation,ko as paceLabel,Cn as pageBackground,Mn as pageIsDark,oe as pageScrollTop,Po as pauseSessionClock,lr as permissions,Yt as placeMenu,_n as placeSpotlightItem,Ve as presentActionSheet,ze as presentAlert,ke as presentChoice,qe as presentConfirm,Ge as presentContextMenu,jo as presentPageAsCard,yo as previousScreenPath,dn as pullDistance,yr as pushNotifications,Wn as readSpotlightEntries,Tt as readSpotlightKinds,Gn as readTabLinks,j as refresh,Bn as removeSpotlightItem,fo as resolveScrollHost,Lo as resumeSessionClock,Me as routeStats,Qn as routerHandlesTabs,On as rubberBand,mt as scheduledWorkouts,tn as scheduledWorkoutsUnsupported,cr as secureStorage,rn as segmentAt,Vr as segmentForKey,Co as sessionClockElapsed,In as settleSheet,ur as share,Tn as sheetStops,ot as shortcuts,Nr as showContextMenuFor,mi as snapshots,br as speech,Eo as speedLabel,gi as splash,ie as spotlightAction,It as spotlightActions,Xo as spotlightActivityTypes,Kn as spotlightBridge,ae as spotlightKind,Fn as spotlightRoute,Dn as spotlightSlot,Ot as spotlightTitle,Oo as startSessionClock,de as statusBar,dt as storage,lt as storeKit,Y as subscribeWhenReady,et as symbols,Vn as tabBar,Oe as toNativeRect,wo as trailEntryFor,Do as typedDistanceKm,Rn as usableFixes,Cr as useActionSheet,Jn as voiceRecordingFormData,xr as watchConnectivity,X as whenBridgeReady,Rr as whenNativeMobile,it as widgets,kr as withNativeFeedback};
@@ -1,13 +1,18 @@
1
- export declare function createVoiceRecorder(options?: VoiceRecorderOptions): {
2
- start: unknown;
3
- cancel: unknown;
4
- dispose: () => void;
5
- stop: () => void;
6
- supported: () => boolean;
7
- snapshot: () => unknown;
8
- subscribe: (listener: (value: VoiceRecorderSnapshot) => void) => () => void
9
- };
1
+ export declare function createVoiceRecorder(options?: VoiceRecorderOptions): VoiceRecorder;
2
+ /** Build an upload using the host's real FormData; native recordings remain file descriptors. */
3
+ export declare function voiceRecordingFormData(audio: Blob | NativeVoiceFile, fields?: Record<string, string>, name?: string): FormData;
10
4
  /** A bounded, disposable microphone session. Audio is never persisted by this helper. */
11
5
  export declare interface VoiceRecorderOptions { maxSeconds?: number, maxBytes?: number }
12
- export declare interface VoiceRecorderSnapshot { status: VoiceRecorderStatus, audio: Blob | null, error: string | null }
6
+ export declare interface NativeVoiceFile { path: string, name: string, type: string, size: number, durationSeconds: number }
7
+ export declare interface VoiceRecorderSnapshot { status: VoiceRecorderStatus, audio: Blob | NativeVoiceFile | null, error: string | null }
8
+ /** Stable public contract shared by browser and native recording hosts. */
9
+ export declare interface VoiceRecorder {
10
+ start: () => Promise<void>
11
+ stop: () => Promise<void>
12
+ cancel: () => void
13
+ dispose: () => void
14
+ supported: () => boolean
15
+ snapshot: () => VoiceRecorderSnapshot
16
+ subscribe: (listener: (value: VoiceRecorderSnapshot) => void) => () => void
17
+ }
13
18
  export type VoiceRecorderStatus = 'idle' | 'requesting' | 'recording' | 'ready' | 'error';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/mobile",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.285",
5
+ "version": "0.75.288",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bughq/sdk": "^0.3.0",
42
- "@stacksjs/types": "0.75.285",
42
+ "@stacksjs/types": "0.75.288",
43
43
  "craft-native": ">=0.0.319"
44
44
  },
45
45
  "devDependencies": {
46
- "@stacksjs/build": "0.75.285",
46
+ "@stacksjs/build": "0.75.288",
47
47
  "better-dx": "^0.2.24"
48
48
  }
49
49
  }