@stacksjs/mobile 0.75.388 → 0.75.390

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -590,7 +590,7 @@ declare interface RouteRecorderOptions extends RouteStatsOptions {
590
590
  intervalMs?: number
591
591
  onUpdate?: (stats: RouteStats) => void
592
592
  location: LocationApi
593
- locationOptions?: LocationOptions
593
+ locationOptions?: LocationRecordingOptions | (() => LocationRecordingOptions | undefined)
594
594
  heartRate?: HeartRateRecordingApi
595
595
  }
596
596
  declare interface RouteRecorder {
@@ -1557,7 +1557,9 @@ declare interface LocationRecordingState {
1557
1557
  declare interface RecordingStartOptions {
1558
1558
  recordingId?: string
1559
1559
  }
1560
- declare interface LocationRecordingOptions extends LocationOptions, RecordingStartOptions {}
1560
+ declare interface LocationRecordingOptions extends LocationOptions, RecordingStartOptions {
1561
+ powerMode?: LocationPowerMode
1562
+ }
1561
1563
  declare interface LocationRecordingResult extends LocationRecordingState {
1562
1564
  locations: Location[]
1563
1565
  }
@@ -1568,6 +1570,7 @@ declare interface ShareOptions {
1568
1570
  files?: string[]
1569
1571
  }
1570
1572
  declare interface NotificationOptions {
1573
+ id?: string
1571
1574
  title: string
1572
1575
  body?: string
1573
1576
  badge?: number
@@ -1668,6 +1671,7 @@ declare interface LifecycleApi {
1668
1671
  declare interface NotificationsApi {
1669
1672
  show: (options: NotificationOptions) => Promise<void>
1670
1673
  schedule: (options: NotificationOptions) => Promise<void>
1674
+ cancel: (id: string) => Promise<void>
1671
1675
  cancelAll: () => Promise<void>
1672
1676
  setBadge: (count: number) => Promise<void>
1673
1677
  }
@@ -2015,6 +2019,15 @@ type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restricted';
2015
2019
  * since craft-native 0.0.119, so the type admits it.
2016
2020
  */
2017
2021
  type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris' | 'none';
2022
+ /**
2023
+ * How hard a route recording works the GPS (Craft 0.0.400+; older hosts
2024
+ * ignore it). `'saver'` is for a long effort, an ultra: fixes come at least
2025
+ * 5 m apart instead of every second, and iOS relaxes to ten-metre accuracy
2026
+ * while the pace holds steady. 5 m keeps fixes under ROUTE_GAP_S apart at any
2027
+ * speed that counts as moving, so distance and moving time come out as at
2028
+ * full rate.
2029
+ */
2030
+ type LocationPowerMode = 'default' | 'saver';
2018
2031
  type AppState = 'active' | 'inactive' | 'background';
2019
2032
  type HapticKind = 'impact' | 'notification' | 'selection';
2020
2033
  /** Whether the person has let the app see their music. `unavailable` off a phone. */
@@ -2092,6 +2105,6 @@ declare interface VoiceRecorder {
2092
2105
  }
2093
2106
  type VoiceRecorderStatus = 'idle' | 'requesting' | 'recording' | 'ready' | 'error';
2094
2107
 
2095
- 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, createRouteStats, routeStats, paceLabel, speedLabel, routeReadInterval, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, ROUTE_FULL_READ_FIXES, ROUTE_FULL_READ_MAX_MS, RouteFix, RouteStats, RouteStatsOptions, RouteStatsAccumulator, 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, LocationRecordingReadOptions, 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 };
2108
+ 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, createRouteStats, routeStats, paceLabel, speedLabel, routeReadInterval, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, ROUTE_FULL_READ_FIXES, ROUTE_FULL_READ_MAX_MS, RouteFix, RouteStats, RouteStatsOptions, RouteStatsAccumulator, 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, LocationRecordingReadOptions, 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, LocationPowerMode, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthSampleType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod, storage, crypto };
2096
2109
  export { NativeTab } from 'craft-native/mobile';
2097
2110
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as sr,biometrics as We,brightness as xe,camera as Re,deepLinks as Bt,device as Z,haptics as Ae,health as ue,heartRate as E,keepAwake as Ft,lifecycle as lr,liveActivities as $e,location as _,music as K,network as Ut,notifications as ke,permissions as de,pushNotifications as Ke,secureStorage as Te,share as Wt,speech as je,snapshots as Ee,splash as cr,watchConnectivity as pe}from"craft-native/mobile";var Nr=2500;function T(){if(typeof window>"u")return;return window}function Q(){let e=T()?.craft;return e&&typeof e==="object"?e:void 0}function Vt(){return typeof navigator>"u"?"":navigator.userAgent||""}function re(){let e=T();if(!e)return!1;if(e.CraftAndroid)return!0;let t=Q()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Vt())}function me(){let e=T();if(!e||e.craft)return!1;return re()||Boolean(e.webkit?.messageHandlers?.craft)}function ee(e=15000){let t=T();if(t?.craft)return Promise.resolve(!0);if(!t||!me())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 Gt(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 L(e){return Gt(Q(),e)}async function Yt(e,t=2500){let n=L(e);if(n||!me())return n;return await ee(t),L(e)}async function y(e,t,n,r={}){let o=await Yt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function d(e,t=2500){if(me())await ee(t);return e()}function J(e,t=2500){let n,r=!1;if(!me())n=e();else ee(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function U(e,t){let n=T();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var qe="native-dialog-styles",Xt=`
1
+ import{appReview as sr,biometrics as We,brightness as Re,camera as Ae,deepLinks as Bt,device as Z,haptics as ke,health as ue,heartRate as E,keepAwake as Ft,lifecycle as lr,liveActivities as $e,location as B,music as j,network as Ut,notifications as de,permissions as pe,pushNotifications as Ke,secureStorage as Te,share as Wt,speech as je,snapshots as Ee,splash as cr,watchConnectivity as fe}from"craft-native/mobile";var Nr=2500;function T(){if(typeof window>"u")return;return window}function Q(){let e=T()?.craft;return e&&typeof e==="object"?e:void 0}function Vt(){return typeof navigator>"u"?"":navigator.userAgent||""}function re(){let e=T();if(!e)return!1;if(e.CraftAndroid)return!0;let t=Q()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Vt())}function ge(){let e=T();if(!e||e.craft)return!1;return re()||Boolean(e.webkit?.messageHandlers?.craft)}function ee(e=15000){let t=T();if(t?.craft)return Promise.resolve(!0);if(!t||!ge())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 Gt(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 L(e){return Gt(Q(),e)}async function Yt(e,t=2500){let n=L(e);if(n||!ge())return n;return await ee(t),L(e)}async function y(e,t,n,r={}){let o=await Yt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function d(e,t=2500){if(ge())await ee(t);return e()}function J(e,t=2500){let n,r=!1;if(!ge())n=e();else ee(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function W(e,t){let n=T();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var qe="native-dialog-styles",Xt=`
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 sr,biometrics as We,brightness as xe,camera as Re,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 Ge(){return T()?.document}function Qt(e){if(e.getElementById(qe))return;let t=e.createElement("style");t.id=qe,t.textContent=Xt,(e.head??e.documentElement).appendChild(t)}var Jt=0;function M(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function Ve(){return T()?.stx?.overlays}var Zt=0;function Ye(e,t,n,r){Qt(e);let o=T(),i=`native-dialog-layer-${++Zt}`,a=M(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(M(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,f=(c)=>{if(l)return;l=!0,a.classList.remove("is-open"),Ve()?.close(i),setTimeout(()=>a.remove(),260),s(c)},u=n({root:a,settle:f});a.appendChild(u),e.body.appendChild(a),Ve()?.open(i,{panel:u,root:a,onEscape:()=>f(r())});let m=o;(typeof m?.requestAnimationFrame==="function"?(c)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(c)):(c)=>setTimeout(c,16))(()=>{if(!l)a.classList.add("is-open")})})}function Pe(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Jt}`,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 Ye(t,e.variant,({root:a,settle:s})=>{let l=(c)=>c.style==="cancel"?null:c.id,f=M(t,"div","native-dialog-panel");f.setAttribute("role","alertdialog"),f.setAttribute("aria-modal","true"),f.tabIndex=-1;let u=M(t,"div","native-dialog-group");if(e.title||e.message){let c=M(t,"div","native-dialog-header");if(e.title){let p=M(t,"p","native-dialog-title",e.title);p.id=`${n}-title`,c.appendChild(p),f.setAttribute("aria-labelledby",p.id)}if(e.message){let p=M(t,"p","native-dialog-message",e.message);p.id=`${n}-message`,c.appendChild(p),f.setAttribute("aria-describedby",p.id)}u.appendChild(c)}let m=M(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)m.classList.add("is-row");for(let c of o){let p=M(t,"button",`native-dialog-action${c.style==="destructive"?" is-destructive":""}${c.style==="cancel"?" is-cancel":""}`,c.title);p.type="button",p.setAttribute("data-action-id",c.id),p.addEventListener("click",()=>s(l(c))),m.appendChild(p)}if(u.appendChild(m),f.appendChild(u),i){let c=M(t,"div","native-dialog-group"),p=M(t,"button","native-dialog-action is-cancel",i.title);p.type="button",p.setAttribute("data-action-id",i.id),p.addEventListener("click",()=>s(null)),c.appendChild(p),f.appendChild(c)}let h=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")h?.addEventListener("click",()=>s(null));return f},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Xe(e){await Pe({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Qe(e){return await Pe({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 Je(e){return Pe({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function en(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,f=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,u=e.x+e.width/2>n.width/2?"right":"left";return{top:f,left:i,origin:`${s||l<12?"top":"bottom"} ${u}`}}function Ze(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=T();return Ye(t,"menu",({root:r,settle:o})=>{let i=M(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(M(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=M(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(M(t,"span","native-menu-label",a.title)),a.icon){let l=M(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=en(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 rt=()=>!0,H=()=>!1,W=()=>null;function et(){return T()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Ne(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 oe={alert:(e)=>y("dialog.alert",[e],()=>Xe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>y("dialog.confirm",[e],()=>Qe(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Ne(e.anchor):void 0},n=await y("dialog.actionSheet",[t],()=>Je(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Ur(){return(e)=>oe.actionSheet(e)}async function Wr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return oe.confirm(e);return await oe.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 He={show:async(e)=>{let t={title:e.title,anchor:Ne(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 y("contextMenu.show",[t],()=>Ze(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function $r(e,t){return He.show({...t,anchor:Ne(e.getBoundingClientRect())})}function tn(e,t){let n=T();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 ot={open:async(e,t={})=>{let n=await y("browser.open",[e,t],()=>tn(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)}}},Le=new Map,Me=new Map;function tt(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var it={isAvailable:()=>L("symbols.image")!==null,image:(e,t={})=>{let n=tt(e,t),r=Le.get(n);if(r)return r;let o=y("symbols.image",[e,t],W).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,W).then((i)=>(Me.set(n,i),i));return Le.set(n,o),o},cached:(e,t={})=>Me.get(tt(e,t)),clearCache:()=>{Le.clear(),Me.clear()}},ge={setStyle:(e)=>y("statusBar.setStyle",[e],H,{fallbackOnError:!0}).then((t)=>t!==!1)},ie={setUnderPageColor:(e)=>y("chrome.setUnderPageColor",[e],H,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>y("chrome.setKeyboardAccessory",[e],H,{fallbackOnError:!0}).then((t)=>t!==!1)},V={isAvailable:()=>L("refresh.enable")!==null,enable:(e)=>y("refresh.enable",[e??{}],H,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>y("refresh.disable",[],H,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>y("refresh.end",[],H,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>U("craftRefresh",()=>e())},ae={complete:(e)=>y("background.complete",[e],H,{fallbackOnError:!0}).then((t)=>t!==!1)},at={write:(e)=>y("clipboard.write",[e],async()=>{let t=et()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(rt,H)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>y("clipboard.read",[],async()=>{let e=et()?.clipboard;if(!e?.readText)return null;return e.readText().catch(W)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},st={isAvailable:()=>L("db.query")!==null,query:(e,t=[])=>y("db.query",[e,t],W).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>y("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 Ce(e,t){let n=T()?.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 nn(e){let t=T()?.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 lt={openPDF:(e,t=0)=>y("openPDF",[e,t],()=>{let n=T();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>y("takeScreenshot",[],W,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>y("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=[])=>y("pickFile",[e],()=>nn(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)=>y("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ce(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ce(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>y("downloadFile",[e,t],()=>Ce(e,t)).then((n)=>typeof n==="string"?n:null)},ct={set:(e)=>y("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],H).then((t)=>t!==!1),clear:()=>y("shortcuts.clear",[],H).then((e)=>e!==!1),onShortcut:(e)=>U("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},ut={update:(e)=>y("widget.update",[e],H).then((t)=>t!==!1),reload:()=>y("widget.reload",[],H).then((e)=>e!==!1)},rn={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function nt(){return T()?.screen?.orientation}var dt={lock:(e)=>y("lockOrientation",[e],()=>{let t=nt();return t?.lock?t.lock(rn[e]).then(rt,H):!1}).then((t)=>t!==!1),unlock:()=>y("unlockOrientation",[],()=>(nt()?.unlock?.(),!0)).then((e)=>e!==!1)},pt={signInWithApple:(e={})=>y("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],W).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},ft={isAvailable:()=>L("iap.purchase")!==null,products:(e)=>y("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>y("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:()=>y("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as z}from"craft-native/mobile";function mt(){return Q()?.capabilities?.storageCompareAndSet===!0&&z.supportsCompareAndSet?.()===!0}function gt(){return Q()?.capabilities?.storageSetIfAbsent===!0&&z.supportsSetIfAbsent?.()===!0}var ht={supportsCompareAndSet:mt,supportsSetIfAbsent:gt,get:(e)=>d(()=>z.get(e)),set:(e,t)=>d(()=>z.set(e,t)),remove:(e)=>d(()=>z.remove(e)),clear:()=>d(()=>z.clear()),keys:()=>d(()=>z.keys()),setIfAbsent:(e,t)=>d(()=>{if(!gt())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return z.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>d(()=>{if(!mt())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return z.compareAndSet(e,t,n)})};import{crypto as on}from"craft-native/mobile";var bt={randomUUID:()=>d(()=>on.randomUUID())};var an=["authorized","denied","notDetermined","restricted","unsupported"];function he(){let e=Q(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function sn(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function vt(e){return an.includes(e)?e:"unsupported"}function ln(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 te(e,t,...n){return d(async()=>{let r=he();if(typeof r?.[e]!=="function")throw sn();return t(await r[e](...n))})}var yt={isAvailable:()=>typeof he()?.isSupported==="function",supports:(e)=>typeof he()?.[e]==="function",isSupported:()=>d(async()=>{let e=he();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>te("authorization",vt),requestAuthorization:()=>te("requestAuthorization",vt),list:()=>te("list",(e)=>Array.isArray(e)?e.map(ln).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 te("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)=>te("remove",(t)=>t===!0,e),removeAll:()=>te("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=(h)=>{let c=h;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)},f=(h)=>{if(!i)return;let c=h;if(Math.hypot(c.clientX-i.x,c.clientY-i.y)>r)s()},u=(h)=>{if(!a)return;a=!1,h.preventDefault(),h.stopPropagation()},m=(h)=>h.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",f),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",u,!0),e.addEventListener("contextmenu",m),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",u,!0),e.removeEventListener("contextmenu",m)}}function cn(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 eo(e,t){let n=null,r=null,o=!1,i=0,a=(c)=>{let p=e.getBoundingClientRect();return cn(c,{left:p.left+2,width:p.width-4},t.count())},s=(c)=>{let p=c;if(p.button!==void 0&&p.button!==0)return;let g=a(p.clientX);if(g!==t.selected())return;n=g,i=g,o=!1,r=p.pointerId;try{e.setPointerCapture?.(p.pointerId)}catch{}t.onPress?.(!0)},l=(c)=>{if(n===null)return;let p=a(c.clientX);if(p===i)return;o=!0,i=p,t.onScrub(p)},f=(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},u=(c)=>{if(!o)return;o=!1,c.preventDefault(),c.stopPropagation()},m=()=>f(!0),h=()=>f(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",m),e.addEventListener("pointercancel",h),e.addEventListener("click",u,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",m),e.removeEventListener("pointercancel",h),e.removeEventListener("click",u,!0)}}function to(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 no(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function ro(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=L("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 un}from"@bughq/sdk";import{crashReporter as ne}from"craft-native/mobile";var D=null;function dn(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 St(){return ne.isAvailable()}function pn(e){return async(t)=>{if(!St())return!e;return ne.capture(t)}}var lo={start(e={}){if(D)return D;let t=re()||St();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return D=new un({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?pn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!dn(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)ne.addBreadcrumb(i);return i}}),D},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);D?.setUser(t===null?null:{id:t}),await ne.setUser(t)},capture(e,t){D?.captureException(e,t)},addBreadcrumb(e){if(D)D.addBreadcrumb(e);else ne.addBreadcrumb(e)},async flush(){await Promise.all([D?.flush(),ne.flush()])},client(){return D},stop(){D?.close(),D=null}};function De(e){let t=T();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function wt(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function xt(){let e=T()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:wt(e?.getAttribute("data-craft-reduce-motion"))||De("(prefers-reduced-motion: reduce)"),reduceTransparency:wt(e?.getAttribute("data-craft-reduce-transparency"))||De("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||De("(prefers-color-scheme: dark)")?"dark":"light"}}function fn(e){let t=xt(),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 Rt(e,t={}){if(t.immediate!==!1)e(xt());return U("craftAppearance",(n)=>e(fn(n)))}function fo(e){return U("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function mo(e){return U("craftMemoryWarning",()=>e())}function At(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>ae.complete(!0),()=>ae.complete(!1))}}function go(e){let t=At(e);return U("craftSilentPush",(n)=>t(n.payload??{}))}function ho(e){let t=At(()=>e());return U("craftBackgroundRefresh",()=>t(void 0))}import{haptics as mn}from"craft-native/mobile";function _e(){if(typeof window>"u")return;return window}function se(e=_e()){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 gn(e,t=_e()){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(se(t))})};return e(se(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function hn(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 yo(e){let t=e.host??_e();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(g)=>setTimeout(g,16),s=null,l=(g)=>{s=null,e.onPull?.(g,o,{bounce:Math.min(g,Math.max(0,-se(t)))})},f=(g)=>{let S=s!==null;if(s=g,S)return;a(()=>{if(s!==null)l(s)})},u=(g)=>{let S=g.touches?.[0];return S?S.clientY:null},m=(g)=>{if(i||se(t)>0)return;r=u(g),o=!1},h=(g)=>{if(r===null)return;let S=u(g);if(S===null)return;let b=hn(se(t),S-r);if(!o&&b>=n)o=!0,Promise.resolve(mn.impact("medium")).catch(()=>{});else if(o&&b<n*0.8)o=!1;f(b)},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)}},p=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",h,{passive:!0}),t.addEventListener("touchend",c),t.addEventListener("touchcancel",p),()=>{s=null,t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",h),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",p)}}function bn(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 So(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return gn((o)=>{let i=bn(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 wo(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Et(){if(typeof window>"u")return;return window}var kt="__stxPushed",vn="__stxScroll";function yn(e=Et()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(kt in n)return n[kt]===!0;return!(vn in n)}function Ro(e=Et()){if(!yn(e))return!1;return e.history.back(),!0}function Ao(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 ko(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function To(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Sn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Eo(){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 Sn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Oo(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 Io(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function wn(e,t=xn()){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 xn(){if(typeof window>"u")return;return window.location?.origin}var Tt="stacks-mobile-deep-link";function Po(e,t){let n=(r)=>{let o=wn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Tt)===r)return;sessionStorage.setItem(Tt,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Mo=5000;function Rn(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 u=i+a>>1;if(r[u].timestamp<o.timestamp)i=u+1;else a=u}let s=r[i],l=r[i-1],f=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!f||Math.abs(f.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(f.bpm)}})}var An=6371008.8,Be={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0},kn=30,Tn=kn;function En(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*An*Math.asin(Math.min(1,Math.sqrt(i)))}function Co(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 On(e,t){return Number.isFinite(e.latitude)&&Number.isFinite(e.longitude)&&Number.isFinite(e.timestamp)&&Math.abs(e.latitude)<=90&&Math.abs(e.longitude)<=180&&Number.isFinite(e.accuracy)&&e.accuracy>=0&&e.accuracy<=t}function be(e={}){let t=e.maxAccuracyM??25,n=(e.paceWindowS??30)*1000,r=[],o=0,i=0,a=null,s=0,l=null,f=null,u={...Be};function m(c){let p=r[r.length-1],g=a?(c.timestamp-a.timestamp)/1000:0;if(a=c,s++,!p){r.push({fix:c,cumM:0});return}if(g>Tn){r.push({fix:c,cumM:o});return}let S=(c.timestamp-p.fix.timestamp)/1000,b=En(p.fix,c),I=Math.min(10,Math.max(3,p.fix.accuracy,c.accuracy));if(b<I)return;if(o+=b,S>0&&b/S>=0.5)i+=S;r.push({fix:c,cumM:o})}function h(){let c=r[r.length-1];if(c){let S=c.fix.timestamp-n,b=0;while(b<r.length-1&&r[b].fix.timestamp<S)b++;if(b)r=r.slice(b)}let p=null,g=null;if(c&&a.timestamp-c.fix.timestamp<=n){let S=r[0],b=c.cumM-S.cumM,I=(c.fix.timestamp-S.fix.timestamp)/1000;if(b>=20&&I>0)g=b/I,p=I/(b/1000)}return{distanceM:o,movingS:i,paceSPerKm:p,averagePaceSPerKm:o>=50&&i>0?i/(o/1000):null,speedMps:g,accuracyM:a?a.accuracy:f,fixes:s}}return{get stats(){return u},get latestTimestamp(){return l},add(c){if(c.length){let p=c[c.length-1];if(!a)f=p.accuracy??null;let g=a?a.timestamp:-1/0,S=c.filter((b)=>On(b,t)&&b.timestamp>g).sort((b,I)=>b.timestamp-I.timestamp);for(let b of S){if(a&&b.timestamp<=a.timestamp)continue;m(b)}for(let b of c)if(Number.isFinite(b.timestamp)&&(l===null||b.timestamp>l))l=b.timestamp}return u=h(),u}}}function In(e,t={}){return be(t).add(e)}function No(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 Ho(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Ot=3600,Pn=30000;function Ln(e,t,n){if(!n||t<=Ot)return e;return Math.max(e,Math.min(Pn,Math.round(e*t/Ot)))}function Do(e){let t=e.location,n=e.intervalMs??3000,r=Be,o=be(e),i=!1,a=null,s=0,l=e.heartRate,f=!1,u=null,m=[],h=()=>typeof document<"u"&&document.visibilityState==="hidden",c=0,p=null,g=Promise.resolve(),S=null,b=!1,I=null;function O(){if(b)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 w(){if(O(),!I)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return I}function x(v){let A=g.then(v);return g=A.then(()=>{},()=>{}),A}function k(){if(p)return p;let v=c,A=I,C=(async()=>{if(O(),!A)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let P=o,j=P.latestTimestamp,F=await t.readRecording(j===null?{expectedId:A}:{expectedId:A,since:j});if(v!==c||b||P!==o)return P.add(F);if(j!==null&&F.length&&F[0].timestamp<=j)i=!0;return r=P.add(F),e.onUpdate?.(r),r})().finally(()=>{if(p===C)p=null});return p=C,C}function R(){if(N(),b)return;let v=s,A=()=>{a=setTimeout(()=>{if(a=null,b||v!==s)return;(h()?Promise.resolve():k().then(()=>{},()=>{})).then(()=>{if(!b&&v===s)A()})},Ln(n,r.fixes,i))};A()}function N(){if(s++,a)clearTimeout(a);a=null}function q(v,A,C,P=be(e)){if(N(),c++,p=null,o=P,i=!1,I=v,u=A,f=A!==null,m=[],r=C,!b)e.onUpdate?.(r)}async function fe(v){if(!l||!f||!u||b||l.supportsRecordingOwnership?.()!==!0)return;await v(l,u).catch(()=>{})}return{get stats(){return r},get recordingId(){return I},get heartRateRecordingId(){return u},get heartRate(){return m},start(v){return S=null,x(async()=>{if(O(),v&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(v&&(typeof v.recordingId!=="string"||!v.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let A=await t.startRecording({enableHighAccuracy:!0,...e.locationOptions,...v?{recordingId:v.recordingId}:{}});if(!A?.active||typeof A.id!=="string"||!A.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(v&&A.id!==v.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let C=null;if(!b&&l?.isAvailable()&&l.supportsRecordingOwnership?.()===!0&&(!v||v.heartRateRecordingId&&l.supportsRecordingIntentIdentity?.()===!0))try{let P=await l.startRecording(v?{recordingId:v.heartRateRecordingId}:void 0);if(v&&P.id!==v.heartRateRecordingId)throw Object.assign(Error("The native heart rate did not start with its registered ID"),{code:"RECORDING_CONFLICT"});if(P.active&&typeof P.id==="string"&&P.id.trim())C=P.id}catch{}return q(A.id,C,{...Be}),R(),r})},attach(v){return S=null,x(async()=>{if(typeof v?.expectedId!=="string"||!v.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});O();let A=await t.getRecordingState({expectedId:v.expectedId});if(O(),!A?.id)return null;if(A.id!==v.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let C=null;if(v.expectedHeartRateId!==void 0){let F=v.expectedHeartRateId;if(typeof F!=="string"||!F.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!l?.isAvailable()||l.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let qt=await l.getRecordingState({expectedId:F});if(O(),qt.id!==F)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await l.readRecording({expectedId:F,since:Date.now()}),O(),C=F}let P=await t.readRecording({expectedId:v.expectedId});O();let j=be(e);if(q(v.expectedId,C,j.add(P),j),A.active&&!A.paused)R();return A})},pause(){return x(async()=>{await t.pauseRecording({expectedId:w()}),await fe((v,A)=>v.pauseRecording({expectedId:A})),N(),await k().catch(()=>{})})},resume(){return x(async()=>{await t.resumeRecording({expectedId:w()}),await fe((v,A)=>v.resumeRecording({expectedId:A})),R()})},stop(){if(S)return S;let v=x(async()=>{N(),c++;let A=w(),C=await t.stopRecording({expectedId:A});if(C.id!==A)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let P=C?.locations??[];if(!b&&l&&f&&u&&l.supportsRecordingOwnership?.()===!0){let j=await l.stopRecording({expectedId:u}).catch(()=>null);f=!1,m=j?.id===u?j.samples:[],P=Rn(P,m)}if(r=In(P,e),!b)e.onUpdate?.(r);return P}).catch((A)=>{if(S===v)S=null;throw A});return S=v,v},dispose(){b=!0,c++,p=null,N()},refresh:k}}function Bo(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Fo(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Uo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Wo(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 Ko=150;function Mn(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 ve(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function jo(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?ve(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:ve(n.map((s)=>s.latitude),0.5),longitude:ve(n.map((s)=>s.longitude),0.5)};i=ve(n.map((s)=>Mn(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 zo(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 we=new Set,It=!1,ye=null;function Cn(e){return e.isConnected&&e.getClientRects().length>0}function Pt(){return[...we].find((e)=>Cn(e.element))}function Se(){let e=Pt(),t=Boolean(e);if(t===It)return;if(It=t,t)V.enable(e?.tintColor?{tintColor:e.tintColor}:{});else V.disable()}function Nn(){let e=Pt();if(!e){V.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>V.end())}function Go(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};we.add(n);let r=e.ownerDocument?.defaultView;if(!ye){let o=V.onRefresh(Nn),i=()=>Se();r?.addEventListener("stx:load",i),ye=()=>{o(),r?.removeEventListener("stx:load",i)}}return Se(),r?.requestAnimationFrame?.(()=>Se()),()=>{if(we.delete(n),we.size===0)ye?.(),ye=null;Se()}}var Xo=0.5;function Hn(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 Dn(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 _n(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function Qo(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Hn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(u)=>{let m=u;if(m.button!==void 0&&m.button!==0)return;if(m.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let h=a().find((c)=>c.name===e.detent())?.y??0;n={y:m.clientY,base:h,pointerId:m.pointerId},o=h,r=[{y:h,t:m.timeStamp}],t.classList.add("is-dragging");try{u.currentTarget?.setPointerCapture?.(m.pointerId)}catch{}},l=(u)=>{if(!n)return;let m=u,h=n.base+m.clientY-n.y;o=h<0?-_n(-h):h,r.push({y:o,t:m.timeStamp});while(r.length>2&&m.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))))},f=(u)=>{if(!n)return;let m=u;n=null;let h=r[0],c=Math.max(1,m.timeStamp-h.t),p=(o-h.y)/c;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Dn({y:o,velocity:p,stops:a()}))};for(let u of e.handles)u.addEventListener("pointerdown",s),u.addEventListener("pointermove",l),u.addEventListener("pointerup",f),u.addEventListener("pointercancel",f);return()=>{for(let u of e.handles)u.removeEventListener("pointerdown",s),u.removeEventListener("pointermove",l),u.removeEventListener("pointerup",f),u.removeEventListener("pointercancel",f)}}function Jo(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 Fe=new WeakMap;function Zo(e,t){let n=e.documentElement,r=Fe.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Fe.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Fe.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 Bn(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 Fn(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 Un(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&&!Fn(r))return r}return null}function Wn(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 ri(e,t={}){let n=t.root??e.documentElement;ie.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let u=Un(e);if(u&&u!==r)r=u,ie.setUnderPageColor(u);let m=Wn(e)?"light":"dark";if(m!==o)o=m,ge.setStyle(m)},a=Rt((u)=>{Bn(n,u),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 f=s?.matchMedia?.("(prefers-color-scheme: dark)");return f?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),f?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var ii=64;var $n=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Kn=/^(?:0|[1-9]\d*)$/;function Mt(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,f=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!$n.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:f})}return{kinds:t,problems:n}}function ce(e,t){return e.find((n)=>n.name===t)??null}function le(e,t,n){let r=ce(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function jn(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(!Kn.test(o))return null;let i=Number(o);return le(e,r,i)===t?{kind:r,slot:i}:null}function Ct(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function ai(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()),...Ct(Mt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Nt(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ce(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function zn(e,t,n,r,o=Date.now()){let i=ce(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((p)=>p.kind===n),s=Nt(e,n,r),l=a.find((p)=>p.itemId===r.id)??null,f=l?null:Yn(a,i.slots),u=l||f!==null?null:Xn(a),m=l?.slot??f??u?.slot;if(m===void 0||m===null)return null;let h={kind:n,slot:m,itemId:r.id,title:s,donatedAt:o},c=t.filter((p)=>p.kind!==n||p.slot!==m&&p.itemId!==r.id);return{entries:Ht(e,[...c,h]),entry:h,evicted:u,changed:!l||l.title!==s}}function qn(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 Vn(e,t,n){let r=jn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ce(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Gn(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:f,donatedAt:u}=i;if(typeof a!=="string"||typeof s!=="number"||le(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let m=`${a}-slot-${s}`,h=`${a}#${l}`;if(n.has(m)||r.has(h))continue;n.set(m,{kind:a,slot:s,itemId:l,title:typeof f==="string"&&f.trim()?f:Nt(e,a,{id:l}),donatedAt:typeof u==="number"&&Number.isFinite(u)&&u>0?u:0}),r.add(h)}return Ht(e,[...n.values()])}function Ht(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 Yn(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 Xn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Qn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var Jn="stacks_spotlight_index",Zn=3000;function si(e){let t=e.onProblem??((w)=>console.warn(`[spotlight] ${w}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Mt(e.kinds);for(let w of n.problems)t(w);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??Qn,f=null;function u(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function m(){if(f)return f;f=[];let w=u();if(!w)return f;try{let x=[o,...i].map((k)=>w.getItem(k)).find((k)=>k);f=x?Gn(r,JSON.parse(x)):[]}catch{f=[]}return f}function h(w){f=w;let x=u();if(!x)return;try{x.setItem(o,JSON.stringify(w));for(let k of i)x.removeItem(k)}catch{}}async function c(w){if(!w)return null;let x;try{return await Promise.race([w,new Promise((k)=>{x=setTimeout(()=>k(null),a)})])}catch{return null}finally{if(x!==void 0)clearTimeout(x)}}let p=Promise.resolve();function g(w){let x=p.then(w,w);return p=x.catch(()=>{return}),x}async function S(w,x){let k=l()?.register;if(!k||r.length===0)return!1;return g(async()=>{let R=zn(r,m(),w,x,s()),N=R&&le(r,w,R.entry.slot);if(!R||!N)return!1;if(!R.changed)return h(R.entries),!0;let q=await c(k(R.entry.title,N))!==null;if(q)h(R.entries);return q})}async function b(w,x){let k=l()?.remove;if(!k)return!1;return g(async()=>{let{entries:R,removed:N}=qn(m(),w,x);if(!N)return!1;let q=le(r,w,N.slot),fe=q?await c(k(q))!==null:!1;return h(R),fe})}async function I(w,x){let k=ce(r,w)?.slots;if(!k||!l()?.register)return 0;let R=0;for(let N of[...x].slice(0,k).reverse())if(await S(w,N))R++;return R}async function O(){let w=l()?.remove;if(!w)return h([]),0;return g(async()=>{let x=0;for(let k of m()){let R=le(r,k.kind,k.slot);if(R&&await c(w(R))!==null)x++}return h([]),x})}return{kinds:r,index:S,sync:I,remove:b,clear:O,routeFor:(w)=>Vn(r,m(),w),entries:()=>m(),activityTypes:(w)=>Ct(r).map((x)=>`${w}.${x}`),reset:()=>{f=null}}}var Lt=["craftShortcut","craftSiriShortcut"];function li(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 Lt)globalThis.addEventListener(r,n);return()=>{for(let r of Lt)globalThis.removeEventListener(r,n)}}import{tabBar as er}from"craft-native/mobile";var tr=er;function nr(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 rr(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 _t(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function or(){return typeof _t()?.selectTab==="function"}function di(e,t={}){let n=(r)=>{if(or()||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 Dt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Ue="stacks:tab-bar-cover";function pi(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(Ue))}function fi(e,t={}){let n=t.api??tr;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=Dt(o?.getPropertyValue("--native-tab-active")||""),a=Dt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:h,selected:c}=rr(nr(e)),p=JSON.stringify({tabs:h,selected:c});if(p===s)return;let g=s&&s!=="hidden"?JSON.parse(s):null;if(g&&c&&JSON.stringify(g.tabs)===JSON.stringify(h))n.select(c);else n.set(h,{selected:c,tint:i,tintDark:a});s=p},f=typeof MutationObserver==="function"?new MutationObserver(l):null;f?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let u=n.onSelect((h)=>{let c=_t();if(c?.selectTab){c.selectTab(h);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((g)=>g.getAttribute("href")===h)?.click()}),m=()=>l();if(typeof window<"u")window.addEventListener("stx:load",m),window.addEventListener("stx:screen-shown",m),window.addEventListener(Ue,m);return l(),()=>{if(f?.disconnect(),u(),typeof window<"u")window.removeEventListener("stx:load",m),window.removeEventListener("stx:screen-shown",m),window.removeEventListener(Ue,m);n.hide()}}function ir(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((g)=>Number.isSafeInteger(g)&&g>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,f,u=(g)=>{r=g;for(let S of o)S({...g})},m=()=>{clearTimeout(f),l?.getTracks().forEach((g)=>g.stop()),l=null};function h(){if(i={},a){let S=a;a=null,Promise.resolve(L("audioRecording.cancel")?.(S)).catch(()=>{})}let g=s;if(s=null,g&&g.state!=="inactive")g.stop();m(),u({status:"idle",audio:null,error:null})}async function c(){h();let g=i;u({status:"requesting",audio:null,error:null});try{let S=L("audioRecording.start");if(S){let R=globalThis.crypto.randomUUID();if(a=R,await S(R,{maxSeconds:t}),i!==g)return;f=setTimeout(()=>{if(i===g)p()},t*1000-250),u({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 b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==g){b.getTracks().forEach((R)=>R.stop());return}l=b;let I=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((R)=>MediaRecorder.isTypeSupported(R)),O=new MediaRecorder(b,{...I?{mimeType:I}:{},audioBitsPerSecond:32000});s=O;let w=[],x=0,k=!1;O.ondataavailable=(R)=>{if(i!==g||!R.data.size)return;if(x+=R.data.size,x>n){if(k=!0,w.length=0,O.state!=="inactive")O.stop();m();return}if(!k)w.push(R.data)},O.onerror=()=>{if(i!==g)return;h(),u({status:"error",audio:null,error:"Recording failed. Please try again."})},O.onstop=()=>{if(i!==g)return;s=null,m();let R=new Blob(w,{type:O.mimeType||I||"audio/webm"});u(k||!R.size?{status:"error",audio:null,error:k?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:R,error:null})},O.start(1000),f=setTimeout(()=>{if(i===g&&O.state!=="inactive")O.stop()},t*1000-250),u({status:"recording",audio:null,error:null})}catch(S){if(i!==g)return;h(),u({status:"error",audio:null,error:S instanceof Error?S.message:"Microphone permission was refused."})}}async function p(){if(!a){if(s&&s.state!=="inactive")s.stop();return}let g=i,S=a;clearTimeout(f);try{let b=await L("audioRecording.stop")?.(S);if(i!==g)return;if(!b?.path||!b.size||b.size>n||!Number.isFinite(b.durationSeconds)||b.durationSeconds<=0||b.durationSeconds>t+1)throw Error("The recording is empty or exceeds its limits.");u({status:"ready",audio:b,error:null})}catch(b){if(i!==g)return;h(),u({status:"error",audio:null,error:b instanceof Error?b.message:"Recording failed."})}}return{start:c,cancel:h,dispose(){h(),o.clear()},stop:p,supported:()=>Boolean(L("audioRecording.start"))||typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(g){return o.add(g),g({...r}),()=>{o.delete(g)}}}}function ar(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||!L("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 ur={isAvailable:()=>d(()=>We.isAvailable()),getBiometricType:()=>d(()=>We.getBiometricType()),authenticate:(e)=>d(()=>We.authenticate(e))},dr={takePicture:(e)=>d(()=>Re.takePicture(e)),pickImage:()=>d(()=>Re.pickImage()),pickMultiple:(e)=>d(()=>Re.pickMultiple(e)),isAvailable:()=>d(()=>Re.isAvailable())},pr={getInfo:()=>d(()=>Z.getInfo()),getCapabilities:()=>d(()=>Z.getCapabilities()),isMobile:()=>Z.isMobile(),isIOS:()=>Z.isIOS(),isAndroid:()=>Z.isAndroid(),getLocale:()=>Z.getLocale(),getTimezone:()=>Z.getTimezone()},fr=lr;function G(){return X()?.capabilities.locationRecordingOwnership===!0&&_.supportsRecordingOwnership?.()===!0}function Y(){return X()?.capabilities.heartRateRecordingOwnership===!0&&E.supportsRecordingOwnership?.()===!0}function $t(){return G()&&X()?.capabilities.locationRecordingIntentIdentity===!0&&_.supportsRecordingIntentIdentity?.()===!0}function Kt(){return Y()&&X()?.capabilities.heartRateRecordingIntentIdentity===!0&&E.supportsRecordingIntentIdentity?.()===!0}function zt(e,t,n){return d(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 B(e,t,n){return d(()=>{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 mr={supportsRecordingOwnership:G,supportsRecordingIntentIdentity:$t,acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},G,()=>_.acknowledgeRecording(e)),getCurrentPosition:(e)=>d(()=>_.getCurrentPosition(e)),watchPosition:(e,t)=>_.watchPosition(e,t),clearWatch:(e)=>_.clearWatch(e),startRecording:(e)=>zt(e,$t,()=>_.startRecording(e)),pauseRecording:(e)=>B(e,G,()=>_.pauseRecording(e)),resumeRecording:(e)=>B(e,G,()=>_.resumeRecording(e)),stopRecording:(e)=>B(e,G,()=>_.stopRecording(e)),getRecordingState:(e)=>B(e,G,()=>_.getRecordingState(e)),readRecording:(e)=>B(e,G,()=>_.readRecording(e))},gr={show:(e)=>d(()=>ke.show(e)),schedule:(e)=>d(()=>ke.schedule(e)),cancelAll:()=>d(()=>ke.cancelAll()),setBadge:(e)=>d(()=>ke.setBadge(e))},hr={check:(e)=>d(()=>de.check(e)),request:(e)=>d(()=>de.request(e)),checkMultiple:(e)=>d(()=>de.checkMultiple(e)),requestMultiple:(e)=>d(()=>de.requestMultiple(e)),openSettings:()=>d(()=>de.openSettings())},br={set:(e,t)=>d(()=>Te.set(e,t)),get:(e)=>d(()=>Te.get(e)),delete:(e)=>d(()=>Te.delete(e)),clear:()=>d(()=>Te.clear())},vr={share:(e)=>d(()=>Wt.share(e)),isAvailable:()=>Wt.isAvailable()},yr={request:()=>d(()=>sr.request())},Oe={impact:(e)=>Promise.resolve().then(()=>Ae.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>Ae.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>Ae.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>Ae.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=L("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function jt(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 Sr={async getInitialURL(){if(!await ee())return null;return jt(await Bt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Bt.onLink?.((o,i)=>{let a=jt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Ie()?.craft)r();else ee().then(r);return()=>{n=!0,t?.()}}},Ri={isAvailable:()=>Ee.isAvailable(),set:(e,t)=>Ee.set(e,t),remove:(e)=>Ee.remove(e),clear:()=>Ee.clear()},wr={enable:()=>d(()=>Ft.enable()),disable:()=>d(()=>Ft.disable())},xr={isAvailable:()=>xe.isAvailable(),get:()=>d(()=>xe.get()),set:(e)=>d(()=>xe.set(e)),restore:()=>d(()=>xe.restore())},Rr={isAvailable:()=>K.isAvailable(),supports:(e)=>K.supports(e),getAuthorizationStatus:()=>d(()=>K.getAuthorizationStatus()),requestAuthorization:()=>d(()=>K.requestAuthorization()),getNowPlaying:()=>d(()=>K.getNowPlaying()),play:()=>d(()=>K.play()),pause:()=>d(()=>K.pause()),togglePlayPause:()=>d(()=>K.togglePlayPause()),skipToNext:()=>d(()=>K.skipToNext()),skipToPrevious:(e)=>d(()=>K.skipToPrevious(e)),onChange:(e)=>J(()=>K.onChange(e))},Ar={supportsRecordingOwnership:Y,supportsRecordingIntentIdentity:Kt,acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},Y,()=>E.acknowledgeRecording(e)),isAvailable:()=>E.isAvailable(),supports:(e)=>E.supports(e),getState:()=>d(()=>E.getState()),requestAuthorization:()=>d(()=>E.requestAuthorization()),scan:(e)=>d(()=>E.scan(e)),stopScan:()=>d(()=>E.stopScan()),getDevices:()=>d(()=>E.getDevices()),connect:(e)=>d(()=>E.connect(e)),reconnect:()=>d(()=>E.reconnect()),disconnect:(e)=>d(()=>E.disconnect(e)),startRecording:(e)=>zt(e,Kt,()=>E.startRecording(e)),pauseRecording:(e)=>B(e,Y,()=>E.pauseRecording(e)),resumeRecording:(e)=>B(e,Y,()=>E.resumeRecording(e)),stopRecording:(e)=>B(e,Y,()=>E.stopRecording(e)),getRecordingState:(e)=>B(e,Y,()=>E.getRecordingState(e)),readRecording:(e)=>B(e,Y,()=>E.readRecording(e)),onReading:(e)=>J(()=>E.onReading(e)),onDevice:(e)=>J(()=>E.onDevice(e)),onState:(e)=>J(()=>E.onState(e))},kr={isAvailable:()=>je.isAvailable(),speak:(e,t)=>d(()=>je.speak(e,t)),stop:()=>d(()=>je.stop())},Tr={getStatus:()=>d(()=>Ut.getStatus()),onChange:(e)=>J(()=>Ut.onChange(e))},Er={register:()=>d(()=>Ke.register()),onToken:(e)=>Ke.onToken(e),onNotification:(e)=>J(()=>Ke.onNotification(e))},Or={requestAuthorization:(e,t)=>d(()=>ue.requestAuthorization(e,t)),getData:(e,t)=>d(()=>ue.getData(e,t)),saveWorkout:(e)=>d(()=>ue.saveWorkout(e)),getWorkouts:(e)=>d(()=>ue.getWorkouts(e)),getDailyStatistics:(e,t)=>d(()=>ue.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>y("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>y("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>y("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>y("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>y("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>y("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>y("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>U("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>L(`health.${e}`)!==null},Ir={start:(e)=>d(()=>$e.start(e)),update:(e)=>d(()=>$e.update(e)),end:()=>d(()=>$e.end())},Pr={send:(e)=>d(()=>pe.send(e)),updateContext:(e)=>d(()=>pe.updateContext(e)),isReachable:()=>d(()=>pe.isReachable()),onMessage:(e)=>pe.onMessage(e),onReachabilityChange:(e)=>pe.onReachabilityChange(e)},Ai=cr;function Ie(){return T()}function X(){let e=Ie()?.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 ze(){return X()!==null}function Lr(e=2000){if(ze()||re())return Promise.resolve(!0);let t=Ie();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(ze())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Mr(e){let t=Ie();if(!t)return()=>{};if(X()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!X())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Cr(e){await Oe.impact("light");try{let t=await e();return await Oe.notification("success"),t}catch(t){throw await Oe.notification("error"),t}}var ki={get nativeBridge(){return X()},biometrics:ur,camera:dr,device:pr,haptics:Oe,lifecycle:fr,location:mr,notifications:gr,permissions:hr,secureStorage:br,storage:ht,crypto:bt,share:vr,appReview:yr,deepLinks:Sr,keepAwake:wr,brightness:xr,music:Rr,heartRate:Ar,scheduledWorkouts:yt,speech:kr,network:Tr,pushNotifications:Er,health:Or,liveActivities:Ir,watchConnectivity:Pr,dialog:oe,contextMenu:He,browser:ot,symbols:it,statusBar:ge,chrome:ie,refresh:V,background:ae,clipboard:at,db:st,files:lt,shortcuts:ct,widgets:ut,orientation:dt,auth:pt,storeKit:ft,isNativeMobile:ze,whenNative:Lr,onReady:Mr,withFeedback:Cr};export{Nr as BRIDGE_WAIT_MS,Mo as HEART_RATE_MATCH_MS,Ko as INDOOR_CHECK_AFTER_S,ii as MAX_SPOTLIGHT_SLOTS_PER_KIND,Ot as ROUTE_FULL_READ_FIXES,Pn as ROUTE_FULL_READ_MAX_MS,kn as ROUTE_GAP_S,Xo as SHEET_FLICK_VELOCITY,Ue as TAB_BAR_COVER_EVENT,d as afterBridge,yr as appReview,Bn as applyAppearance,Rn as attachHeartRate,pt as auth,ko as backLabelFor,ae as background,ur as biometrics,me as bridgePending,xr as brightness,ot as browser,y as callNative,dr as camera,yn as canGoBack,ie as chrome,at as clipboard,Wr as confirmAction,He as contextMenu,pi as coverTabBar,T as craftHost,Q as craftRoot,lo as crashReporting,Do as createRouteRecorder,be as createRouteStats,si as createSpotlightIndex,ir as createVoiceRecorder,bt as crypto,xt as currentAppearance,st as db,wn as deepLinkPath,Sr as deepLinks,pr as device,oe as dialog,Ao as enterNavTrail,lt as files,En as fixDistance,no as focusSegment,Po as followDeepLinks,X as getNativeMobileBridge,Ro as goBack,Oo as goBackToTabRoot,di as handleTabReselect,Oe as haptics,re as hasNativeMobileHost,Or as health,Ar as heartRate,jo as indoorVerdict,ri as installNativeChrome,ro as installPressables,ze as isNativeMobile,Cn as isShown,wr as keepAwake,dn as keepBreadcrumb,bn as largeTitleMetrics,fr as lifecycle,Jo as liftToBody,Ir as liveActivities,mr as location,fi as mirrorTabBar,ki as mobile,Rr as music,Yt as nativeFunction,L as nativeFunctionNow,rr as nativeTabs,To as navTrail,Tr as network,fn as normalizeAppearance,jt as normalizeDeepLinkURL,ln as normalizeScheduledWorkout,gr as notifications,So as observeLargeTitle,Zr as observeLongPress,Go as observeNativeRefresh,gn as observePageScroll,yo as observePullToRefresh,eo as observeSegmentScrub,Qo as observeSheetDrag,Rt as onAppearance,ho as onBackgroundRefresh,U as onCraftEvent,mo as onMemoryWarning,Mr as onMobileReady,fo as onResume,go as onSilentPush,li as onSpotlightTap,dt as orientation,No as paceLabel,Un as pageBackground,Wn as pageIsDark,se as pageScrollTop,Fo as pauseSessionClock,hr as permissions,en as placeMenu,zn as placeSpotlightItem,Je as presentActionSheet,Xe as presentAlert,Pe as presentChoice,Qe as presentConfirm,Ze as presentContextMenu,Zo as presentPageAsCard,Eo as previousScreenPath,hn as pullDistance,Er as pushNotifications,Gn as readSpotlightEntries,Mt as readSpotlightKinds,nr as readTabLinks,V as refresh,qn as removeSpotlightItem,wo as resolveScrollHost,Uo as resumeSessionClock,Ln as routeReadInterval,In as routeStats,or as routerHandlesTabs,_n as rubberBand,yt as scheduledWorkouts,sn as scheduledWorkoutsUnsupported,br as secureStorage,cn as segmentAt,to as segmentForKey,Wo as sessionClockElapsed,Dn as settleSheet,vr as share,Hn as sheetStops,ct as shortcuts,$r as showContextMenuFor,Ri as snapshots,kr as speech,Ho as speedLabel,Ai as splash,le as spotlightAction,Ct as spotlightActions,ai as spotlightActivityTypes,Qn as spotlightBridge,ce as spotlightKind,Vn as spotlightRoute,jn as spotlightSlot,Nt as spotlightTitle,Bo as startSessionClock,ge as statusBar,ht as storage,ft as storeKit,J as subscribeWhenReady,it as symbols,tr as tabBar,Ne as toNativeRect,Io as trailEntryFor,zo as typedDistanceKm,Co as usableFixes,Ur as useActionSheet,ar as voiceRecordingFormData,Pr as watchConnectivity,ee as whenBridgeReady,Lr as whenNativeMobile,ut as widgets,Cr as withNativeFeedback};
55
+ `;function Ge(){return T()?.document}function Qt(e){if(e.getElementById(qe))return;let t=e.createElement("style");t.id=qe,t.textContent=Xt,(e.head??e.documentElement).appendChild(t)}var Jt=0;function N(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function Ve(){return T()?.stx?.overlays}var Zt=0;function Ye(e,t,n,r){Qt(e);let o=T(),i=`native-dialog-layer-${++Zt}`,a=N(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(N(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,f=(c)=>{if(l)return;l=!0,a.classList.remove("is-open"),Ve()?.close(i),setTimeout(()=>a.remove(),260),s(c)},u=n({root:a,settle:f});a.appendChild(u),e.body.appendChild(a),Ve()?.open(i,{panel:u,root:a,onEscape:()=>f(r())});let m=o;(typeof m?.requestAnimationFrame==="function"?(c)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(c)):(c)=>setTimeout(c,16))(()=>{if(!l)a.classList.add("is-open")})})}function Pe(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Jt}`,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 Ye(t,e.variant,({root:a,settle:s})=>{let l=(c)=>c.style==="cancel"?null:c.id,f=N(t,"div","native-dialog-panel");f.setAttribute("role","alertdialog"),f.setAttribute("aria-modal","true"),f.tabIndex=-1;let u=N(t,"div","native-dialog-group");if(e.title||e.message){let c=N(t,"div","native-dialog-header");if(e.title){let p=N(t,"p","native-dialog-title",e.title);p.id=`${n}-title`,c.appendChild(p),f.setAttribute("aria-labelledby",p.id)}if(e.message){let p=N(t,"p","native-dialog-message",e.message);p.id=`${n}-message`,c.appendChild(p),f.setAttribute("aria-describedby",p.id)}u.appendChild(c)}let m=N(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)m.classList.add("is-row");for(let c of o){let p=N(t,"button",`native-dialog-action${c.style==="destructive"?" is-destructive":""}${c.style==="cancel"?" is-cancel":""}`,c.title);p.type="button",p.setAttribute("data-action-id",c.id),p.addEventListener("click",()=>s(l(c))),m.appendChild(p)}if(u.appendChild(m),f.appendChild(u),i){let c=N(t,"div","native-dialog-group"),p=N(t,"button","native-dialog-action is-cancel",i.title);p.type="button",p.setAttribute("data-action-id",i.id),p.addEventListener("click",()=>s(null)),c.appendChild(p),f.appendChild(c)}let h=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")h?.addEventListener("click",()=>s(null));return f},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Xe(e){await Pe({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Qe(e){return await Pe({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 Je(e){return Pe({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function en(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,f=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,u=e.x+e.width/2>n.width/2?"right":"left";return{top:f,left:i,origin:`${s||l<12?"top":"bottom"} ${u}`}}function Ze(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=T();return Ye(t,"menu",({root:r,settle:o})=>{let i=N(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(N(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=N(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(N(t,"span","native-menu-label",a.title)),a.icon){let l=N(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=en(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 rt=()=>!0,D=()=>!1,K=()=>null;function et(){return T()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Ne(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 oe={alert:(e)=>y("dialog.alert",[e],()=>Xe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>y("dialog.confirm",[e],()=>Qe(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Ne(e.anchor):void 0},n=await y("dialog.actionSheet",[t],()=>Je(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Ur(){return(e)=>oe.actionSheet(e)}async function Wr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return oe.confirm(e);return await oe.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 He={show:async(e)=>{let t={title:e.title,anchor:Ne(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 y("contextMenu.show",[t],()=>Ze(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function $r(e,t){return He.show({...t,anchor:Ne(e.getBoundingClientRect())})}function tn(e,t){let n=T();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 ot={open:async(e,t={})=>{let n=await y("browser.open",[e,t],()=>tn(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)}}},Le=new Map,Me=new Map;function tt(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var it={isAvailable:()=>L("symbols.image")!==null,image:(e,t={})=>{let n=tt(e,t),r=Le.get(n);if(r)return r;let o=y("symbols.image",[e,t],K).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,K).then((i)=>(Me.set(n,i),i));return Le.set(n,o),o},cached:(e,t={})=>Me.get(tt(e,t)),clearCache:()=>{Le.clear(),Me.clear()}},he={setStyle:(e)=>y("statusBar.setStyle",[e],D,{fallbackOnError:!0}).then((t)=>t!==!1)},ie={setUnderPageColor:(e)=>y("chrome.setUnderPageColor",[e],D,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>y("chrome.setKeyboardAccessory",[e],D,{fallbackOnError:!0}).then((t)=>t!==!1)},V={isAvailable:()=>L("refresh.enable")!==null,enable:(e)=>y("refresh.enable",[e??{}],D,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>y("refresh.disable",[],D,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>y("refresh.end",[],D,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>W("craftRefresh",()=>e())},ae={complete:(e)=>y("background.complete",[e],D,{fallbackOnError:!0}).then((t)=>t!==!1)},at={write:(e)=>y("clipboard.write",[e],async()=>{let t=et()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(rt,D)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>y("clipboard.read",[],async()=>{let e=et()?.clipboard;if(!e?.readText)return null;return e.readText().catch(K)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},st={isAvailable:()=>L("db.query")!==null,query:(e,t=[])=>y("db.query",[e,t],K).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>y("db.execute",[e,t],K).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 Ce(e,t){let n=T()?.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 nn(e){let t=T()?.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 lt={openPDF:(e,t=0)=>y("openPDF",[e,t],()=>{let n=T();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>y("takeScreenshot",[],K,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>y("scanQRCode",[],K).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},K),pickFile:(e=[])=>y("pickFile",[e],()=>nn(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}},K),saveFile:(e,t,n)=>y("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ce(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ce(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>y("downloadFile",[e,t],()=>Ce(e,t)).then((n)=>typeof n==="string"?n:null)},ct={set:(e)=>y("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],D).then((t)=>t!==!1),clear:()=>y("shortcuts.clear",[],D).then((e)=>e!==!1),onShortcut:(e)=>W("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},ut={update:(e)=>y("widget.update",[e],D).then((t)=>t!==!1),reload:()=>y("widget.reload",[],D).then((e)=>e!==!1)},rn={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function nt(){return T()?.screen?.orientation}var dt={lock:(e)=>y("lockOrientation",[e],()=>{let t=nt();return t?.lock?t.lock(rn[e]).then(rt,D):!1}).then((t)=>t!==!1),unlock:()=>y("unlockOrientation",[],()=>(nt()?.unlock?.(),!0)).then((e)=>e!==!1)},pt={signInWithApple:(e={})=>y("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],K).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},ft={isAvailable:()=>L("iap.purchase")!==null,products:(e)=>y("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>y("iap.purchase",[e],K).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>y("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as z}from"craft-native/mobile";function mt(){return Q()?.capabilities?.storageCompareAndSet===!0&&z.supportsCompareAndSet?.()===!0}function gt(){return Q()?.capabilities?.storageSetIfAbsent===!0&&z.supportsSetIfAbsent?.()===!0}var ht={supportsCompareAndSet:mt,supportsSetIfAbsent:gt,get:(e)=>d(()=>z.get(e)),set:(e,t)=>d(()=>z.set(e,t)),remove:(e)=>d(()=>z.remove(e)),clear:()=>d(()=>z.clear()),keys:()=>d(()=>z.keys()),setIfAbsent:(e,t)=>d(()=>{if(!gt())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return z.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>d(()=>{if(!mt())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return z.compareAndSet(e,t,n)})};import{crypto as on}from"craft-native/mobile";var bt={randomUUID:()=>d(()=>on.randomUUID())};var an=["authorized","denied","notDetermined","restricted","unsupported"];function be(){let e=Q(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function sn(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function vt(e){return an.includes(e)?e:"unsupported"}function ln(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 te(e,t,...n){return d(async()=>{let r=be();if(typeof r?.[e]!=="function")throw sn();return t(await r[e](...n))})}var yt={isAvailable:()=>typeof be()?.isSupported==="function",supports:(e)=>typeof be()?.[e]==="function",isSupported:()=>d(async()=>{let e=be();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>te("authorization",vt),requestAuthorization:()=>te("requestAuthorization",vt),list:()=>te("list",(e)=>Array.isArray(e)?e.map(ln).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 te("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)=>te("remove",(t)=>t===!0,e),removeAll:()=>te("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=(h)=>{let c=h;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)},f=(h)=>{if(!i)return;let c=h;if(Math.hypot(c.clientX-i.x,c.clientY-i.y)>r)s()},u=(h)=>{if(!a)return;a=!1,h.preventDefault(),h.stopPropagation()},m=(h)=>h.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",f),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",u,!0),e.addEventListener("contextmenu",m),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",u,!0),e.removeEventListener("contextmenu",m)}}function cn(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 eo(e,t){let n=null,r=null,o=!1,i=0,a=(c)=>{let p=e.getBoundingClientRect();return cn(c,{left:p.left+2,width:p.width-4},t.count())},s=(c)=>{let p=c;if(p.button!==void 0&&p.button!==0)return;let g=a(p.clientX);if(g!==t.selected())return;n=g,i=g,o=!1,r=p.pointerId;try{e.setPointerCapture?.(p.pointerId)}catch{}t.onPress?.(!0)},l=(c)=>{if(n===null)return;let p=a(c.clientX);if(p===i)return;o=!0,i=p,t.onScrub(p)},f=(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},u=(c)=>{if(!o)return;o=!1,c.preventDefault(),c.stopPropagation()},m=()=>f(!0),h=()=>f(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",m),e.addEventListener("pointercancel",h),e.addEventListener("click",u,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",m),e.removeEventListener("pointercancel",h),e.removeEventListener("click",u,!0)}}function to(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 no(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function ro(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=L("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 un}from"@bughq/sdk";import{crashReporter as ne}from"craft-native/mobile";var _=null;function dn(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 St(){return ne.isAvailable()}function pn(e){return async(t)=>{if(!St())return!e;return ne.capture(t)}}var lo={start(e={}){if(_)return _;let t=re()||St();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return _=new un({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?pn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!dn(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)ne.addBreadcrumb(i);return i}}),_},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);_?.setUser(t===null?null:{id:t}),await ne.setUser(t)},capture(e,t){_?.captureException(e,t)},addBreadcrumb(e){if(_)_.addBreadcrumb(e);else ne.addBreadcrumb(e)},async flush(){await Promise.all([_?.flush(),ne.flush()])},client(){return _},stop(){_?.close(),_=null}};function De(e){let t=T();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function wt(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function xt(){let e=T()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:wt(e?.getAttribute("data-craft-reduce-motion"))||De("(prefers-reduced-motion: reduce)"),reduceTransparency:wt(e?.getAttribute("data-craft-reduce-transparency"))||De("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||De("(prefers-color-scheme: dark)")?"dark":"light"}}function fn(e){let t=xt(),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 Rt(e,t={}){if(t.immediate!==!1)e(xt());return W("craftAppearance",(n)=>e(fn(n)))}function fo(e){return W("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function mo(e){return W("craftMemoryWarning",()=>e())}function At(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>ae.complete(!0),()=>ae.complete(!1))}}function go(e){let t=At(e);return W("craftSilentPush",(n)=>t(n.payload??{}))}function ho(e){let t=At(()=>e());return W("craftBackgroundRefresh",()=>t(void 0))}import{haptics as mn}from"craft-native/mobile";function _e(){if(typeof window>"u")return;return window}function se(e=_e()){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 gn(e,t=_e()){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(se(t))})};return e(se(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function hn(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 yo(e){let t=e.host??_e();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(g)=>setTimeout(g,16),s=null,l=(g)=>{s=null,e.onPull?.(g,o,{bounce:Math.min(g,Math.max(0,-se(t)))})},f=(g)=>{let S=s!==null;if(s=g,S)return;a(()=>{if(s!==null)l(s)})},u=(g)=>{let S=g.touches?.[0];return S?S.clientY:null},m=(g)=>{if(i||se(t)>0)return;r=u(g),o=!1},h=(g)=>{if(r===null)return;let S=u(g);if(S===null)return;let b=hn(se(t),S-r);if(!o&&b>=n)o=!0,Promise.resolve(mn.impact("medium")).catch(()=>{});else if(o&&b<n*0.8)o=!1;f(b)},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)}},p=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",h,{passive:!0}),t.addEventListener("touchend",c),t.addEventListener("touchcancel",p),()=>{s=null,t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",h),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",p)}}function bn(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 So(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return gn((o)=>{let i=bn(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 wo(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Et(){if(typeof window>"u")return;return window}var kt="__stxPushed",vn="__stxScroll";function yn(e=Et()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(kt in n)return n[kt]===!0;return!(vn in n)}function Ro(e=Et()){if(!yn(e))return!1;return e.history.back(),!0}function Ao(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 ko(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function To(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Sn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Eo(){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 Sn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Oo(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 Io(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function wn(e,t=xn()){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 xn(){if(typeof window>"u")return;return window.location?.origin}var Tt="stacks-mobile-deep-link";function Po(e,t){let n=(r)=>{let o=wn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Tt)===r)return;sessionStorage.setItem(Tt,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Mo=5000;function Rn(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 u=i+a>>1;if(r[u].timestamp<o.timestamp)i=u+1;else a=u}let s=r[i],l=r[i-1],f=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!f||Math.abs(f.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(f.bpm)}})}var An=6371008.8,Be={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0},kn=30,Tn=kn;function En(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*An*Math.asin(Math.min(1,Math.sqrt(i)))}function Co(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 On(e,t){return Number.isFinite(e.latitude)&&Number.isFinite(e.longitude)&&Number.isFinite(e.timestamp)&&Math.abs(e.latitude)<=90&&Math.abs(e.longitude)<=180&&Number.isFinite(e.accuracy)&&e.accuracy>=0&&e.accuracy<=t}function ve(e={}){let t=e.maxAccuracyM??25,n=(e.paceWindowS??30)*1000,r=[],o=0,i=0,a=null,s=0,l=null,f=null,u={...Be};function m(c){let p=r[r.length-1],g=a?(c.timestamp-a.timestamp)/1000:0;if(a=c,s++,!p){r.push({fix:c,cumM:0});return}if(g>Tn){r.push({fix:c,cumM:o});return}let S=(c.timestamp-p.fix.timestamp)/1000,b=En(p.fix,c),I=Math.min(10,Math.max(3,p.fix.accuracy,c.accuracy));if(b<I)return;if(o+=b,S>0&&b/S>=0.5)i+=S;r.push({fix:c,cumM:o})}function h(){let c=r[r.length-1];if(c){let S=c.fix.timestamp-n,b=0;while(b<r.length-1&&r[b].fix.timestamp<S)b++;if(b)r=r.slice(b)}let p=null,g=null;if(c&&a.timestamp-c.fix.timestamp<=n){let S=r[0],b=c.cumM-S.cumM,I=(c.fix.timestamp-S.fix.timestamp)/1000;if(b>=20&&I>0)g=b/I,p=I/(b/1000)}return{distanceM:o,movingS:i,paceSPerKm:p,averagePaceSPerKm:o>=50&&i>0?i/(o/1000):null,speedMps:g,accuracyM:a?a.accuracy:f,fixes:s}}return{get stats(){return u},get latestTimestamp(){return l},add(c){if(c.length){let p=c[c.length-1];if(!a)f=p.accuracy??null;let g=a?a.timestamp:-1/0,S=c.filter((b)=>On(b,t)&&b.timestamp>g).sort((b,I)=>b.timestamp-I.timestamp);for(let b of S){if(a&&b.timestamp<=a.timestamp)continue;m(b)}for(let b of c)if(Number.isFinite(b.timestamp)&&(l===null||b.timestamp>l))l=b.timestamp}return u=h(),u}}}function In(e,t={}){return ve(t).add(e)}function No(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 Ho(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Ot=3600,Pn=30000;function Ln(e,t,n){if(!n||t<=Ot)return e;return Math.max(e,Math.min(Pn,Math.round(e*t/Ot)))}function Do(e){let t=e.location,n=e.intervalMs??3000,r=Be,o=ve(e),i=!1,a=null,s=0,l=e.heartRate,f=!1,u=null,m=[],h=()=>typeof document<"u"&&document.visibilityState==="hidden",c=0,p=null,g=Promise.resolve(),S=null,b=!1,I=null;function O(){if(b)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 w(){if(O(),!I)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return I}function x(v){let A=g.then(v);return g=A.then(()=>{},()=>{}),A}function k(){if(p)return p;let v=c,A=I,P=(async()=>{if(O(),!A)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let M=o,C=M.latestTimestamp,U=await t.readRecording(C===null?{expectedId:A}:{expectedId:A,since:C});if(v!==c||b||M!==o)return M.add(U);if(C!==null&&U.length&&U[0].timestamp<=C)i=!0;return r=M.add(U),e.onUpdate?.(r),r})().finally(()=>{if(p===P)p=null});return p=P,P}function R(){if(H(),b)return;let v=s,A=()=>{a=setTimeout(()=>{if(a=null,b||v!==s)return;(h()?Promise.resolve():k().then(()=>{},()=>{})).then(()=>{if(!b&&v===s)A()})},Ln(n,r.fixes,i))};A()}function H(){if(s++,a)clearTimeout(a);a=null}function q(v,A,P,M=ve(e)){if(H(),c++,p=null,o=M,i=!1,I=v,u=A,f=A!==null,m=[],r=P,!b)e.onUpdate?.(r)}async function me(v){if(!l||!f||!u||b||l.supportsRecordingOwnership?.()!==!0)return;await v(l,u).catch(()=>{})}return{get stats(){return r},get recordingId(){return I},get heartRateRecordingId(){return u},get heartRate(){return m},start(v){return S=null,x(async()=>{if(O(),v&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(v&&(typeof v.recordingId!=="string"||!v.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let A=typeof e.locationOptions==="function"?e.locationOptions():e.locationOptions,P=await t.startRecording({enableHighAccuracy:!0,...A,...v?{recordingId:v.recordingId}:{}});if(!P?.active||typeof P.id!=="string"||!P.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(v&&P.id!==v.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let M=null;if(!b&&l?.isAvailable()&&l.supportsRecordingOwnership?.()===!0&&(!v||v.heartRateRecordingId&&l.supportsRecordingIntentIdentity?.()===!0))try{let C=await l.startRecording(v?{recordingId:v.heartRateRecordingId}:void 0);if(v&&C.id!==v.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())M=C.id}catch{}return q(P.id,M,{...Be}),R(),r})},attach(v){return S=null,x(async()=>{if(typeof v?.expectedId!=="string"||!v.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});O();let A=await t.getRecordingState({expectedId:v.expectedId});if(O(),!A?.id)return null;if(A.id!==v.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let P=null;if(v.expectedHeartRateId!==void 0){let U=v.expectedHeartRateId;if(typeof U!=="string"||!U.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!l?.isAvailable()||l.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let qt=await l.getRecordingState({expectedId:U});if(O(),qt.id!==U)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await l.readRecording({expectedId:U,since:Date.now()}),O(),P=U}let M=await t.readRecording({expectedId:v.expectedId});O();let C=ve(e);if(q(v.expectedId,P,C.add(M),C),A.active&&!A.paused)R();return A})},pause(){return x(async()=>{await t.pauseRecording({expectedId:w()}),await me((v,A)=>v.pauseRecording({expectedId:A})),H(),await k().catch(()=>{})})},resume(){return x(async()=>{await t.resumeRecording({expectedId:w()}),await me((v,A)=>v.resumeRecording({expectedId:A})),R()})},stop(){if(S)return S;let v=x(async()=>{H(),c++;let A=w(),P=await t.stopRecording({expectedId:A});if(P.id!==A)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let M=P?.locations??[];if(!b&&l&&f&&u&&l.supportsRecordingOwnership?.()===!0){let C=await l.stopRecording({expectedId:u}).catch(()=>null);f=!1,m=C?.id===u?C.samples:[],M=Rn(M,m)}if(r=In(M,e),!b)e.onUpdate?.(r);return M}).catch((A)=>{if(S===v)S=null;throw A});return S=v,v},dispose(){b=!0,c++,p=null,H()},refresh:k}}function Bo(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Fo(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Uo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Wo(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 Ko=150;function Mn(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 ye(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function jo(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?ye(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:ye(n.map((s)=>s.latitude),0.5),longitude:ye(n.map((s)=>s.longitude),0.5)};i=ye(n.map((s)=>Mn(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 zo(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 xe=new Set,It=!1,Se=null;function Cn(e){return e.isConnected&&e.getClientRects().length>0}function Pt(){return[...xe].find((e)=>Cn(e.element))}function we(){let e=Pt(),t=Boolean(e);if(t===It)return;if(It=t,t)V.enable(e?.tintColor?{tintColor:e.tintColor}:{});else V.disable()}function Nn(){let e=Pt();if(!e){V.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>V.end())}function Go(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};xe.add(n);let r=e.ownerDocument?.defaultView;if(!Se){let o=V.onRefresh(Nn),i=()=>we();r?.addEventListener("stx:load",i),Se=()=>{o(),r?.removeEventListener("stx:load",i)}}return we(),r?.requestAnimationFrame?.(()=>we()),()=>{if(xe.delete(n),xe.size===0)Se?.(),Se=null;we()}}var Xo=0.5;function Hn(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 Dn(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 _n(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function Qo(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Hn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(u)=>{let m=u;if(m.button!==void 0&&m.button!==0)return;if(m.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let h=a().find((c)=>c.name===e.detent())?.y??0;n={y:m.clientY,base:h,pointerId:m.pointerId},o=h,r=[{y:h,t:m.timeStamp}],t.classList.add("is-dragging");try{u.currentTarget?.setPointerCapture?.(m.pointerId)}catch{}},l=(u)=>{if(!n)return;let m=u,h=n.base+m.clientY-n.y;o=h<0?-_n(-h):h,r.push({y:o,t:m.timeStamp});while(r.length>2&&m.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))))},f=(u)=>{if(!n)return;let m=u;n=null;let h=r[0],c=Math.max(1,m.timeStamp-h.t),p=(o-h.y)/c;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Dn({y:o,velocity:p,stops:a()}))};for(let u of e.handles)u.addEventListener("pointerdown",s),u.addEventListener("pointermove",l),u.addEventListener("pointerup",f),u.addEventListener("pointercancel",f);return()=>{for(let u of e.handles)u.removeEventListener("pointerdown",s),u.removeEventListener("pointermove",l),u.removeEventListener("pointerup",f),u.removeEventListener("pointercancel",f)}}function Jo(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 Fe=new WeakMap;function Zo(e,t){let n=e.documentElement,r=Fe.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Fe.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Fe.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 Bn(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 Fn(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 Un(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&&!Fn(r))return r}return null}function Wn(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 ri(e,t={}){let n=t.root??e.documentElement;ie.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let u=Un(e);if(u&&u!==r)r=u,ie.setUnderPageColor(u);let m=Wn(e)?"light":"dark";if(m!==o)o=m,he.setStyle(m)},a=Rt((u)=>{Bn(n,u),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 f=s?.matchMedia?.("(prefers-color-scheme: dark)");return f?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),f?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var ii=64;var $n=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Kn=/^(?:0|[1-9]\d*)$/;function Mt(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,f=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!$n.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:f})}return{kinds:t,problems:n}}function ce(e,t){return e.find((n)=>n.name===t)??null}function le(e,t,n){let r=ce(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function jn(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(!Kn.test(o))return null;let i=Number(o);return le(e,r,i)===t?{kind:r,slot:i}:null}function Ct(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function ai(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()),...Ct(Mt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Nt(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ce(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function zn(e,t,n,r,o=Date.now()){let i=ce(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((p)=>p.kind===n),s=Nt(e,n,r),l=a.find((p)=>p.itemId===r.id)??null,f=l?null:Yn(a,i.slots),u=l||f!==null?null:Xn(a),m=l?.slot??f??u?.slot;if(m===void 0||m===null)return null;let h={kind:n,slot:m,itemId:r.id,title:s,donatedAt:o},c=t.filter((p)=>p.kind!==n||p.slot!==m&&p.itemId!==r.id);return{entries:Ht(e,[...c,h]),entry:h,evicted:u,changed:!l||l.title!==s}}function qn(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 Vn(e,t,n){let r=jn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ce(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Gn(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:f,donatedAt:u}=i;if(typeof a!=="string"||typeof s!=="number"||le(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let m=`${a}-slot-${s}`,h=`${a}#${l}`;if(n.has(m)||r.has(h))continue;n.set(m,{kind:a,slot:s,itemId:l,title:typeof f==="string"&&f.trim()?f:Nt(e,a,{id:l}),donatedAt:typeof u==="number"&&Number.isFinite(u)&&u>0?u:0}),r.add(h)}return Ht(e,[...n.values()])}function Ht(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 Yn(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 Xn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Qn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var Jn="stacks_spotlight_index",Zn=3000;function si(e){let t=e.onProblem??((w)=>console.warn(`[spotlight] ${w}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Mt(e.kinds);for(let w of n.problems)t(w);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??Qn,f=null;function u(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function m(){if(f)return f;f=[];let w=u();if(!w)return f;try{let x=[o,...i].map((k)=>w.getItem(k)).find((k)=>k);f=x?Gn(r,JSON.parse(x)):[]}catch{f=[]}return f}function h(w){f=w;let x=u();if(!x)return;try{x.setItem(o,JSON.stringify(w));for(let k of i)x.removeItem(k)}catch{}}async function c(w){if(!w)return null;let x;try{return await Promise.race([w,new Promise((k)=>{x=setTimeout(()=>k(null),a)})])}catch{return null}finally{if(x!==void 0)clearTimeout(x)}}let p=Promise.resolve();function g(w){let x=p.then(w,w);return p=x.catch(()=>{return}),x}async function S(w,x){let k=l()?.register;if(!k||r.length===0)return!1;return g(async()=>{let R=zn(r,m(),w,x,s()),H=R&&le(r,w,R.entry.slot);if(!R||!H)return!1;if(!R.changed)return h(R.entries),!0;let q=await c(k(R.entry.title,H))!==null;if(q)h(R.entries);return q})}async function b(w,x){let k=l()?.remove;if(!k)return!1;return g(async()=>{let{entries:R,removed:H}=qn(m(),w,x);if(!H)return!1;let q=le(r,w,H.slot),me=q?await c(k(q))!==null:!1;return h(R),me})}async function I(w,x){let k=ce(r,w)?.slots;if(!k||!l()?.register)return 0;let R=0;for(let H of[...x].slice(0,k).reverse())if(await S(w,H))R++;return R}async function O(){let w=l()?.remove;if(!w)return h([]),0;return g(async()=>{let x=0;for(let k of m()){let R=le(r,k.kind,k.slot);if(R&&await c(w(R))!==null)x++}return h([]),x})}return{kinds:r,index:S,sync:I,remove:b,clear:O,routeFor:(w)=>Vn(r,m(),w),entries:()=>m(),activityTypes:(w)=>Ct(r).map((x)=>`${w}.${x}`),reset:()=>{f=null}}}var Lt=["craftShortcut","craftSiriShortcut"];function li(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 Lt)globalThis.addEventListener(r,n);return()=>{for(let r of Lt)globalThis.removeEventListener(r,n)}}import{tabBar as er}from"craft-native/mobile";var tr=er;function nr(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 rr(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 _t(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function or(){return typeof _t()?.selectTab==="function"}function di(e,t={}){let n=(r)=>{if(or()||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 Dt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Ue="stacks:tab-bar-cover";function pi(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(Ue))}function fi(e,t={}){let n=t.api??tr;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=Dt(o?.getPropertyValue("--native-tab-active")||""),a=Dt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:h,selected:c}=rr(nr(e)),p=JSON.stringify({tabs:h,selected:c});if(p===s)return;let g=s&&s!=="hidden"?JSON.parse(s):null;if(g&&c&&JSON.stringify(g.tabs)===JSON.stringify(h))n.select(c);else n.set(h,{selected:c,tint:i,tintDark:a});s=p},f=typeof MutationObserver==="function"?new MutationObserver(l):null;f?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let u=n.onSelect((h)=>{let c=_t();if(c?.selectTab){c.selectTab(h);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((g)=>g.getAttribute("href")===h)?.click()}),m=()=>l();if(typeof window<"u")window.addEventListener("stx:load",m),window.addEventListener("stx:screen-shown",m),window.addEventListener(Ue,m);return l(),()=>{if(f?.disconnect(),u(),typeof window<"u")window.removeEventListener("stx:load",m),window.removeEventListener("stx:screen-shown",m),window.removeEventListener(Ue,m);n.hide()}}function ir(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((g)=>Number.isSafeInteger(g)&&g>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,f,u=(g)=>{r=g;for(let S of o)S({...g})},m=()=>{clearTimeout(f),l?.getTracks().forEach((g)=>g.stop()),l=null};function h(){if(i={},a){let S=a;a=null,Promise.resolve(L("audioRecording.cancel")?.(S)).catch(()=>{})}let g=s;if(s=null,g&&g.state!=="inactive")g.stop();m(),u({status:"idle",audio:null,error:null})}async function c(){h();let g=i;u({status:"requesting",audio:null,error:null});try{let S=L("audioRecording.start");if(S){let R=globalThis.crypto.randomUUID();if(a=R,await S(R,{maxSeconds:t}),i!==g)return;f=setTimeout(()=>{if(i===g)p()},t*1000-250),u({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 b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==g){b.getTracks().forEach((R)=>R.stop());return}l=b;let I=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((R)=>MediaRecorder.isTypeSupported(R)),O=new MediaRecorder(b,{...I?{mimeType:I}:{},audioBitsPerSecond:32000});s=O;let w=[],x=0,k=!1;O.ondataavailable=(R)=>{if(i!==g||!R.data.size)return;if(x+=R.data.size,x>n){if(k=!0,w.length=0,O.state!=="inactive")O.stop();m();return}if(!k)w.push(R.data)},O.onerror=()=>{if(i!==g)return;h(),u({status:"error",audio:null,error:"Recording failed. Please try again."})},O.onstop=()=>{if(i!==g)return;s=null,m();let R=new Blob(w,{type:O.mimeType||I||"audio/webm"});u(k||!R.size?{status:"error",audio:null,error:k?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:R,error:null})},O.start(1000),f=setTimeout(()=>{if(i===g&&O.state!=="inactive")O.stop()},t*1000-250),u({status:"recording",audio:null,error:null})}catch(S){if(i!==g)return;h(),u({status:"error",audio:null,error:S instanceof Error?S.message:"Microphone permission was refused."})}}async function p(){if(!a){if(s&&s.state!=="inactive")s.stop();return}let g=i,S=a;clearTimeout(f);try{let b=await L("audioRecording.stop")?.(S);if(i!==g)return;if(!b?.path||!b.size||b.size>n||!Number.isFinite(b.durationSeconds)||b.durationSeconds<=0||b.durationSeconds>t+1)throw Error("The recording is empty or exceeds its limits.");u({status:"ready",audio:b,error:null})}catch(b){if(i!==g)return;h(),u({status:"error",audio:null,error:b instanceof Error?b.message:"Recording failed."})}}return{start:c,cancel:h,dispose(){h(),o.clear()},stop:p,supported:()=>Boolean(L("audioRecording.start"))||typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(g){return o.add(g),g({...r}),()=>{o.delete(g)}}}}function ar(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||!L("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 ur={isAvailable:()=>d(()=>We.isAvailable()),getBiometricType:()=>d(()=>We.getBiometricType()),authenticate:(e)=>d(()=>We.authenticate(e))},dr={takePicture:(e)=>d(()=>Ae.takePicture(e)),pickImage:()=>d(()=>Ae.pickImage()),pickMultiple:(e)=>d(()=>Ae.pickMultiple(e)),isAvailable:()=>d(()=>Ae.isAvailable())},pr={getInfo:()=>d(()=>Z.getInfo()),getCapabilities:()=>d(()=>Z.getCapabilities()),isMobile:()=>Z.isMobile(),isIOS:()=>Z.isIOS(),isAndroid:()=>Z.isAndroid(),getLocale:()=>Z.getLocale(),getTimezone:()=>Z.getTimezone()},fr=lr;function G(){return X()?.capabilities.locationRecordingOwnership===!0&&B.supportsRecordingOwnership?.()===!0}function Y(){return X()?.capabilities.heartRateRecordingOwnership===!0&&E.supportsRecordingOwnership?.()===!0}function $t(){return G()&&X()?.capabilities.locationRecordingIntentIdentity===!0&&B.supportsRecordingIntentIdentity?.()===!0}function Kt(){return Y()&&X()?.capabilities.heartRateRecordingIntentIdentity===!0&&E.supportsRecordingIntentIdentity?.()===!0}function zt(e,t,n){return d(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 F(e,t,n){return d(()=>{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 mr={supportsRecordingOwnership:G,supportsRecordingIntentIdentity:$t,acknowledgeRecording:(e)=>F({expectedId:e?.expectedId},G,()=>B.acknowledgeRecording(e)),getCurrentPosition:(e)=>d(()=>B.getCurrentPosition(e)),watchPosition:(e,t)=>B.watchPosition(e,t),clearWatch:(e)=>B.clearWatch(e),startRecording:(e)=>zt(e,$t,()=>B.startRecording(e)),pauseRecording:(e)=>F(e,G,()=>B.pauseRecording(e)),resumeRecording:(e)=>F(e,G,()=>B.resumeRecording(e)),stopRecording:(e)=>F(e,G,()=>B.stopRecording(e)),getRecordingState:(e)=>F(e,G,()=>B.getRecordingState(e)),readRecording:(e)=>F(e,G,()=>B.readRecording(e))},gr={show:(e)=>d(()=>de.show(e)),schedule:(e)=>d(()=>de.schedule(e)),cancel:(e)=>d(()=>de.cancel(e)),cancelAll:()=>d(()=>de.cancelAll()),setBadge:(e)=>d(()=>de.setBadge(e))},hr={check:(e)=>d(()=>pe.check(e)),request:(e)=>d(()=>pe.request(e)),checkMultiple:(e)=>d(()=>pe.checkMultiple(e)),requestMultiple:(e)=>d(()=>pe.requestMultiple(e)),openSettings:()=>d(()=>pe.openSettings())},br={set:(e,t)=>d(()=>Te.set(e,t)),get:(e)=>d(()=>Te.get(e)),delete:(e)=>d(()=>Te.delete(e)),clear:()=>d(()=>Te.clear())},vr={share:(e)=>d(()=>Wt.share(e)),isAvailable:()=>Wt.isAvailable()},yr={request:()=>d(()=>sr.request())},Oe={impact:(e)=>Promise.resolve().then(()=>ke.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ke.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ke.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ke.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=L("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function jt(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 Sr={async getInitialURL(){if(!await ee())return null;return jt(await Bt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Bt.onLink?.((o,i)=>{let a=jt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Ie()?.craft)r();else ee().then(r);return()=>{n=!0,t?.()}}},Ri={isAvailable:()=>Ee.isAvailable(),set:(e,t)=>Ee.set(e,t),remove:(e)=>Ee.remove(e),clear:()=>Ee.clear()},wr={enable:()=>d(()=>Ft.enable()),disable:()=>d(()=>Ft.disable())},xr={isAvailable:()=>Re.isAvailable(),get:()=>d(()=>Re.get()),set:(e)=>d(()=>Re.set(e)),restore:()=>d(()=>Re.restore())},Rr={isAvailable:()=>j.isAvailable(),supports:(e)=>j.supports(e),getAuthorizationStatus:()=>d(()=>j.getAuthorizationStatus()),requestAuthorization:()=>d(()=>j.requestAuthorization()),getNowPlaying:()=>d(()=>j.getNowPlaying()),play:()=>d(()=>j.play()),pause:()=>d(()=>j.pause()),togglePlayPause:()=>d(()=>j.togglePlayPause()),skipToNext:()=>d(()=>j.skipToNext()),skipToPrevious:(e)=>d(()=>j.skipToPrevious(e)),onChange:(e)=>J(()=>j.onChange(e))},Ar={supportsRecordingOwnership:Y,supportsRecordingIntentIdentity:Kt,acknowledgeRecording:(e)=>F({expectedId:e?.expectedId},Y,()=>E.acknowledgeRecording(e)),isAvailable:()=>E.isAvailable(),supports:(e)=>E.supports(e),getState:()=>d(()=>E.getState()),requestAuthorization:()=>d(()=>E.requestAuthorization()),scan:(e)=>d(()=>E.scan(e)),stopScan:()=>d(()=>E.stopScan()),getDevices:()=>d(()=>E.getDevices()),connect:(e)=>d(()=>E.connect(e)),reconnect:()=>d(()=>E.reconnect()),disconnect:(e)=>d(()=>E.disconnect(e)),startRecording:(e)=>zt(e,Kt,()=>E.startRecording(e)),pauseRecording:(e)=>F(e,Y,()=>E.pauseRecording(e)),resumeRecording:(e)=>F(e,Y,()=>E.resumeRecording(e)),stopRecording:(e)=>F(e,Y,()=>E.stopRecording(e)),getRecordingState:(e)=>F(e,Y,()=>E.getRecordingState(e)),readRecording:(e)=>F(e,Y,()=>E.readRecording(e)),onReading:(e)=>J(()=>E.onReading(e)),onDevice:(e)=>J(()=>E.onDevice(e)),onState:(e)=>J(()=>E.onState(e))},kr={isAvailable:()=>je.isAvailable(),speak:(e,t)=>d(()=>je.speak(e,t)),stop:()=>d(()=>je.stop())},Tr={getStatus:()=>d(()=>Ut.getStatus()),onChange:(e)=>J(()=>Ut.onChange(e))},Er={register:()=>d(()=>Ke.register()),onToken:(e)=>Ke.onToken(e),onNotification:(e)=>J(()=>Ke.onNotification(e))},Or={requestAuthorization:(e,t)=>d(()=>ue.requestAuthorization(e,t)),getData:(e,t)=>d(()=>ue.getData(e,t)),saveWorkout:(e)=>d(()=>ue.saveWorkout(e)),getWorkouts:(e)=>d(()=>ue.getWorkouts(e)),getDailyStatistics:(e,t)=>d(()=>ue.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>y("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>y("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>y("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>y("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>y("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>y("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>y("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>W("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>L(`health.${e}`)!==null},Ir={start:(e)=>d(()=>$e.start(e)),update:(e)=>d(()=>$e.update(e)),end:()=>d(()=>$e.end())},Pr={send:(e)=>d(()=>fe.send(e)),updateContext:(e)=>d(()=>fe.updateContext(e)),isReachable:()=>d(()=>fe.isReachable()),onMessage:(e)=>fe.onMessage(e),onReachabilityChange:(e)=>fe.onReachabilityChange(e)},Ai=cr;function Ie(){return T()}function X(){let e=Ie()?.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 ze(){return X()!==null}function Lr(e=2000){if(ze()||re())return Promise.resolve(!0);let t=Ie();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(ze())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Mr(e){let t=Ie();if(!t)return()=>{};if(X()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!X())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Cr(e){await Oe.impact("light");try{let t=await e();return await Oe.notification("success"),t}catch(t){throw await Oe.notification("error"),t}}var ki={get nativeBridge(){return X()},biometrics:ur,camera:dr,device:pr,haptics:Oe,lifecycle:fr,location:mr,notifications:gr,permissions:hr,secureStorage:br,storage:ht,crypto:bt,share:vr,appReview:yr,deepLinks:Sr,keepAwake:wr,brightness:xr,music:Rr,heartRate:Ar,scheduledWorkouts:yt,speech:kr,network:Tr,pushNotifications:Er,health:Or,liveActivities:Ir,watchConnectivity:Pr,dialog:oe,contextMenu:He,browser:ot,symbols:it,statusBar:he,chrome:ie,refresh:V,background:ae,clipboard:at,db:st,files:lt,shortcuts:ct,widgets:ut,orientation:dt,auth:pt,storeKit:ft,isNativeMobile:ze,whenNative:Lr,onReady:Mr,withFeedback:Cr};export{Nr as BRIDGE_WAIT_MS,Mo as HEART_RATE_MATCH_MS,Ko as INDOOR_CHECK_AFTER_S,ii as MAX_SPOTLIGHT_SLOTS_PER_KIND,Ot as ROUTE_FULL_READ_FIXES,Pn as ROUTE_FULL_READ_MAX_MS,kn as ROUTE_GAP_S,Xo as SHEET_FLICK_VELOCITY,Ue as TAB_BAR_COVER_EVENT,d as afterBridge,yr as appReview,Bn as applyAppearance,Rn as attachHeartRate,pt as auth,ko as backLabelFor,ae as background,ur as biometrics,ge as bridgePending,xr as brightness,ot as browser,y as callNative,dr as camera,yn as canGoBack,ie as chrome,at as clipboard,Wr as confirmAction,He as contextMenu,pi as coverTabBar,T as craftHost,Q as craftRoot,lo as crashReporting,Do as createRouteRecorder,ve as createRouteStats,si as createSpotlightIndex,ir as createVoiceRecorder,bt as crypto,xt as currentAppearance,st as db,wn as deepLinkPath,Sr as deepLinks,pr as device,oe as dialog,Ao as enterNavTrail,lt as files,En as fixDistance,no as focusSegment,Po as followDeepLinks,X as getNativeMobileBridge,Ro as goBack,Oo as goBackToTabRoot,di as handleTabReselect,Oe as haptics,re as hasNativeMobileHost,Or as health,Ar as heartRate,jo as indoorVerdict,ri as installNativeChrome,ro as installPressables,ze as isNativeMobile,Cn as isShown,wr as keepAwake,dn as keepBreadcrumb,bn as largeTitleMetrics,fr as lifecycle,Jo as liftToBody,Ir as liveActivities,mr as location,fi as mirrorTabBar,ki as mobile,Rr as music,Yt as nativeFunction,L as nativeFunctionNow,rr as nativeTabs,To as navTrail,Tr as network,fn as normalizeAppearance,jt as normalizeDeepLinkURL,ln as normalizeScheduledWorkout,gr as notifications,So as observeLargeTitle,Zr as observeLongPress,Go as observeNativeRefresh,gn as observePageScroll,yo as observePullToRefresh,eo as observeSegmentScrub,Qo as observeSheetDrag,Rt as onAppearance,ho as onBackgroundRefresh,W as onCraftEvent,mo as onMemoryWarning,Mr as onMobileReady,fo as onResume,go as onSilentPush,li as onSpotlightTap,dt as orientation,No as paceLabel,Un as pageBackground,Wn as pageIsDark,se as pageScrollTop,Fo as pauseSessionClock,hr as permissions,en as placeMenu,zn as placeSpotlightItem,Je as presentActionSheet,Xe as presentAlert,Pe as presentChoice,Qe as presentConfirm,Ze as presentContextMenu,Zo as presentPageAsCard,Eo as previousScreenPath,hn as pullDistance,Er as pushNotifications,Gn as readSpotlightEntries,Mt as readSpotlightKinds,nr as readTabLinks,V as refresh,qn as removeSpotlightItem,wo as resolveScrollHost,Uo as resumeSessionClock,Ln as routeReadInterval,In as routeStats,or as routerHandlesTabs,_n as rubberBand,yt as scheduledWorkouts,sn as scheduledWorkoutsUnsupported,br as secureStorage,cn as segmentAt,to as segmentForKey,Wo as sessionClockElapsed,Dn as settleSheet,vr as share,Hn as sheetStops,ct as shortcuts,$r as showContextMenuFor,Ri as snapshots,kr as speech,Ho as speedLabel,Ai as splash,le as spotlightAction,Ct as spotlightActions,ai as spotlightActivityTypes,Qn as spotlightBridge,ce as spotlightKind,Vn as spotlightRoute,jn as spotlightSlot,Nt as spotlightTitle,Bo as startSessionClock,he as statusBar,ht as storage,ft as storeKit,J as subscribeWhenReady,it as symbols,tr as tabBar,Ne as toNativeRect,Io as trailEntryFor,zo as typedDistanceKm,Co as usableFixes,Ur as useActionSheet,ar as voiceRecordingFormData,Pr as watchConnectivity,ee as whenBridgeReady,Lr as whenNativeMobile,ut as widgets,Cr as withNativeFeedback};
package/dist/route.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { HeartRateRecordingApi, HeartRateSample, Location, LocationApi, LocationOptions, LocationRecordingState } from './types';
1
+ import type { HeartRateRecordingApi, HeartRateSample, Location, LocationApi, LocationRecordingOptions, LocationRecordingState } from './types';
2
2
  /**
3
3
  * The fixes with the heart rate of the reading nearest each one, when there
4
4
  * is one within `maxGapMs`: a strap reads about once a second, a phone fixes
@@ -85,7 +85,7 @@ export declare interface RouteRecorderOptions extends RouteStatsOptions {
85
85
  intervalMs?: number
86
86
  onUpdate?: (stats: RouteStats) => void
87
87
  location: LocationApi
88
- locationOptions?: LocationOptions
88
+ locationOptions?: LocationRecordingOptions | (() => LocationRecordingOptions | undefined)
89
89
  heartRate?: HeartRateRecordingApi
90
90
  }
91
91
  export declare interface RouteRecorder {
package/dist/types.d.ts CHANGED
@@ -173,7 +173,9 @@ export declare interface LocationRecordingState {
173
173
  export declare interface RecordingStartOptions {
174
174
  recordingId?: string
175
175
  }
176
- export declare interface LocationRecordingOptions extends LocationOptions, RecordingStartOptions {}
176
+ export declare interface LocationRecordingOptions extends LocationOptions, RecordingStartOptions {
177
+ powerMode?: LocationPowerMode
178
+ }
177
179
  export declare interface LocationRecordingResult extends LocationRecordingState {
178
180
  locations: Location[]
179
181
  }
@@ -184,6 +186,7 @@ export declare interface ShareOptions {
184
186
  files?: string[]
185
187
  }
186
188
  export declare interface NotificationOptions {
189
+ id?: string
187
190
  title: string
188
191
  body?: string
189
192
  badge?: number
@@ -284,6 +287,7 @@ export declare interface LifecycleApi {
284
287
  export declare interface NotificationsApi {
285
288
  show: (options: NotificationOptions) => Promise<void>
286
289
  schedule: (options: NotificationOptions) => Promise<void>
290
+ cancel: (id: string) => Promise<void>
287
291
  cancelAll: () => Promise<void>
288
292
  setBadge: (count: number) => Promise<void>
289
293
  }
@@ -631,6 +635,15 @@ export type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restrict
631
635
  * since craft-native 0.0.119, so the type admits it.
632
636
  */
633
637
  export type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris' | 'none';
638
+ /**
639
+ * How hard a route recording works the GPS (Craft 0.0.400+; older hosts
640
+ * ignore it). `'saver'` is for a long effort, an ultra: fixes come at least
641
+ * 5 m apart instead of every second, and iOS relaxes to ten-metre accuracy
642
+ * while the pace holds steady. 5 m keeps fixes under ROUTE_GAP_S apart at any
643
+ * speed that counts as moving, so distance and moving time come out as at
644
+ * full rate.
645
+ */
646
+ export type LocationPowerMode = 'default' | 'saver';
634
647
  export type AppState = 'active' | 'inactive' | 'background';
635
648
  export type HapticKind = 'impact' | 'notification' | 'selection';
636
649
  /** Whether the person has let the app see their music. `unavailable` off a phone. */
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.388",
5
+ "version": "0.75.390",
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.388",
42
+ "@stacksjs/types": "0.75.390",
43
43
  "craft-native": ">=0.0.341"
44
44
  },
45
45
  "devDependencies": {
46
- "@stacksjs/build": "0.75.388",
46
+ "@stacksjs/build": "0.75.390",
47
47
  "better-dx": "^0.2.24"
48
48
  }
49
49
  }