@stacksjs/mobile 0.75.152 → 0.75.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -116,6 +116,37 @@ if (health.supports('getHeartRateSamples')) {
116
116
  }
117
117
  ```
118
118
 
119
+ ## Apple Music
120
+
121
+ `music` shows what the Music app is playing (title, artist, album, a small
122
+ artwork data URL, duration, position, playback state) and steers it: `play`,
123
+ `pause`, `togglePlayPause`, `skipToNext` and `skipToPrevious`, which restarts
124
+ the song a few seconds in, like the Music app's own button. Changes arrive
125
+ from native as they happen, so a page never polls. iOS only, behind
126
+ `capabilities.appleMusic`; music control is local to the phone, so it works
127
+ offline.
128
+
129
+ ```ts
130
+ import { music } from '@stacksjs/mobile'
131
+
132
+ // From the person's tap, never on load: iOS shows its prompt the first time.
133
+ if (await music.requestAuthorization() === 'authorized') {
134
+ render(await music.getNowPlaying())
135
+ const stop = music.onChange(render) // observes while anyone listens
136
+ await music.togglePlayPause()
137
+ }
138
+ ```
139
+
140
+ Only Apple Music: iOS gives no app the controls of another player, Spotify
141
+ included, so while one plays the song fields are null and `otherAudioPlaying`
142
+ is true; say so rather than show controls that do nothing. Nothing is read
143
+ before access is allowed (`authorization` is `notDetermined`, `denied` or
144
+ `restricted` until then). In a browser and on Android `isAvailable()` is false,
145
+ every call answers `{ available: false }` and `onChange` never fires. Word the
146
+ prompt with `ios.usageDescriptions.NSAppleMusicUsageDescription`. The
147
+ simulator's Music app has nothing to play; launch a simulator build with
148
+ `-CraftFakeMusicPlayer YES` for three made-up songs that play and skip.
149
+
119
150
  ## Recording a route
120
151
 
121
152
  Craft records the route natively: fixes go to disk, keep coming with the screen
package/dist/index.d.ts CHANGED
@@ -73,6 +73,16 @@ declare const keepAwake: KeepAwakeApi;
73
73
  * backlight to set: `isAvailable()` is false and the calls resolve `null`.
74
74
  */
75
75
  declare const brightness: BrightnessApi;
76
+ /**
77
+ * What the Music app is playing, and its play/pause/skip, for a screen the
78
+ * person trains with. iOS only, and only Apple Music: iOS gives no app another
79
+ * player's controls (Spotify included), so then the song fields are null and
80
+ * `otherAudioPlaying` is true. Nothing is read until `requestAuthorization()`,
81
+ * which shows iOS's prompt once; call it from the person's tap. In a browser
82
+ * and on Android every call answers `{ available: false }` and changes never
83
+ * fire. Music control is local to the phone, so it works offline.
84
+ */
85
+ declare const music: MusicApi;
76
86
  /**
77
87
  * Short spoken cues ("Rest, 15 seconds"). In the app the voice ducks the
78
88
  * user's music and plays with the silent switch on; in a browser it falls back
@@ -1216,6 +1226,7 @@ declare interface CraftMobileCapabilities {
1216
1226
  orientationLock?: boolean
1217
1227
  deepLinks?: boolean
1218
1228
  flashlight?: boolean
1229
+ music?: boolean
1219
1230
  network?: boolean
1220
1231
  deviceInfo?: boolean
1221
1232
  badge?: boolean
@@ -1262,6 +1273,7 @@ declare interface MobileApi {
1262
1273
  deepLinks: DeepLinksApi
1263
1274
  keepAwake: KeepAwakeApi
1264
1275
  brightness: BrightnessApi
1276
+ music: MusicApi
1265
1277
  speech: SpeechApi
1266
1278
  network: NetworkApi
1267
1279
  pushNotifications: PushNotificationsApi
@@ -1451,6 +1463,43 @@ declare interface SpeechApi {
1451
1463
  speak: (text: string, options?: SpeechOptions) => Promise<boolean>
1452
1464
  stop: () => Promise<void>
1453
1465
  }
1466
+ /**
1467
+ * What the Music app is playing. The song fields are null without access,
1468
+ * with nothing queued, and while another app (Spotify, a podcast) plays; then
1469
+ * `otherAudioPlaying` is true.
1470
+ */
1471
+ declare interface NowPlaying {
1472
+ available: boolean
1473
+ authorization: MusicAuthorization
1474
+ source: 'appleMusic' | 'simulated' | null
1475
+ playbackState: MusicPlaybackState
1476
+ isPlaying: boolean
1477
+ itemId: string | null
1478
+ title: string | null
1479
+ artist: string | null
1480
+ album: string | null
1481
+ duration: number | null
1482
+ position: number | null
1483
+ artworkDataURL: string | null
1484
+ otherAudioPlaying: boolean
1485
+ timestamp: number
1486
+ }
1487
+ declare interface MusicSkipOptions {
1488
+ restartAfter?: number
1489
+ }
1490
+ declare interface MusicApi {
1491
+ isAvailable: () => boolean
1492
+ supports: (method: MusicMethod) => boolean
1493
+ getAuthorizationStatus: () => Promise<MusicAuthorization>
1494
+ requestAuthorization: () => Promise<MusicAuthorization>
1495
+ getNowPlaying: () => Promise<NowPlaying>
1496
+ play: () => Promise<NowPlaying>
1497
+ pause: () => Promise<NowPlaying>
1498
+ togglePlayPause: () => Promise<NowPlaying>
1499
+ skipToNext: () => Promise<NowPlaying>
1500
+ skipToPrevious: (options?: MusicSkipOptions) => Promise<NowPlaying>
1501
+ onChange: (callback: (nowPlaying: NowPlaying) => void) => () => void
1502
+ }
1454
1503
  declare interface DeepLinksApi {
1455
1504
  getInitialURL: () => Promise<string | null>
1456
1505
  onLink: (callback: (url: string, link?: { initial: boolean }) => void) => () => void
@@ -1621,6 +1670,10 @@ type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restricted';
1621
1670
  type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris' | 'none';
1622
1671
  type AppState = 'active' | 'inactive' | 'background';
1623
1672
  type HapticKind = 'impact' | 'notification' | 'selection';
1673
+ /** Whether the person has let the app see their music. `unavailable` off a phone. */
1674
+ type MusicAuthorization = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';
1675
+ type MusicPlaybackState = 'stopped' | 'playing' | 'paused' | 'interrupted' | 'seekingForward' | 'seekingBackward' | 'unknown';
1676
+ type MusicMethod = 'getAuthorizationStatus' | 'requestAuthorization' | 'getNowPlaying' | 'play' | 'pause' | 'togglePlayPause' | 'skipToNext' | 'skipToPrevious' | 'observe';
1624
1677
  type HealthDataType = | 'steps'
1625
1678
  | 'heartRate'
1626
1679
  | 'activeEnergy'
@@ -1642,6 +1695,6 @@ type HealthSleepStage = 'inBed' | 'awake' | 'asleep' | 'core' | 'deep' | 'rem';
1642
1695
  /** The health reads an installed app build may or may not answer. */
1643
1696
  type HealthReadMethod = 'getWorkouts' | 'getDailyStatistics' | 'getHeartRateSamples' | 'getSleepIntervals';
1644
1697
 
1645
- export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, 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, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, 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, lockBackground, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, trapFocus, 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, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod };
1698
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, 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, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, 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, lockBackground, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, trapFocus, 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, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod };
1646
1699
  export { NativeTab } from 'craft-native/mobile';
1647
1700
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as vn,biometrics as ye,brightness as Q,camera as Z,deepLinks as dt,device as O,haptics as ee,health as U,keepAwake as pt,lifecycle as yn,liveActivities as xe,location as M,network as ft,notifications as te,permissions as W,pushNotifications as Se,secureStorage as ne,share as mt,speech as we,snapshots as re,splash as xn,watchConnectivity as z}from"craft-native/mobile";var Un=2500;function S(){if(typeof window>"u")return;return window}function yt(){let e=S()?.craft;return e&&typeof e==="object"?e:void 0}function xt(){return typeof navigator>"u"?"":navigator.userAgent||""}function se(){let e=S();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(xt())}function Y(){let e=S();if(!e||e.craft)return!1;return se()||Boolean(e.webkit?.messageHandlers?.craft)}function I(e=15000){let t=S();if(t?.craft)return Promise.resolve(!0);if(!t||!Y())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 St(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 T(e){return St(yt(),e)}async function wt(e,t=2500){let n=T(e);if(n||!Y())return n;return await I(t),T(e)}async function b(e,t,n,r={}){let o=await wt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function h(e,t=2500){if(Y())await I(t);return e()}function le(e,t=2500){let n,r=!1;if(!Y())n=e();else I(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function R(e,t){let n=S();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var ke="native-dialog-styles",At=`
1
+ import{appReview as yn,biometrics as xe,brightness as ee,camera as te,deepLinks as pt,device as N,haptics as ne,health as W,keepAwake as ft,lifecycle as xn,liveActivities as Se,location as M,music as R,network as mt,notifications as re,permissions as z,pushNotifications as we,secureStorage as oe,share as gt,speech as Ae,snapshots as ie,splash as Sn,watchConnectivity as Y}from"craft-native/mobile";var zn=2500;function S(){if(typeof window>"u")return;return window}function xt(){let e=S()?.craft;return e&&typeof e==="object"?e:void 0}function St(){return typeof navigator>"u"?"":navigator.userAgent||""}function ce(){let e=S();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(St())}function j(){let e=S();if(!e||e.craft)return!1;return ce()||Boolean(e.webkit?.messageHandlers?.craft)}function I(e=15000){let t=S();if(t?.craft)return Promise.resolve(!0);if(!t||!j())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 wt(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 T(e){return wt(xt(),e)}async function At(e,t=2500){let n=T(e);if(n||!j())return n;return await I(t),T(e)}async function b(e,t,n,r={}){let o=await At(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function g(e,t=2500){if(j())await I(t);return e()}function G(e,t=2500){let n,r=!1;if(!j())n=e();else I(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function P(e,t){let n=S();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var Ee="native-dialog-styles",kt=`
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 vn,biometrics as ye,brightness as Q,camera as Z,deepLinks as
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 Ee(){return S()?.document}function kt(e){if(e.getElementById(ke))return;let t=e.createElement("style");t.id=ke,t.textContent=At,(e.head??e.documentElement).appendChild(t)}var Et=0;function A(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}var Te='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Tt(e,t){if(t.key!=="Tab")return;let n=Array.from(e.querySelectorAll(Te));if(n.length===0){t.preventDefault();return}let r=n[0],o=n[n.length-1],i=e.ownerDocument.activeElement;if(t.shiftKey&&(i===r||!e.contains(i)))t.preventDefault(),o.focus();else if(!t.shiftKey&&(i===o||!e.contains(i)))t.preventDefault(),r.focus()}function Le(e,t,n,r){kt(e);let o=S(),i=e.activeElement,a=A(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(A(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,m=(g)=>{if(l)return;l=!0,a.classList.remove("is-open"),e.removeEventListener("keydown",p,!0),setTimeout(()=>{if(a.remove(),i&&typeof i.focus==="function")i.focus()},260),s(g)},p=(g)=>{if(g.key==="Escape"){g.preventDefault(),m(r());return}Tt(c,g)},c=n({root:a,settle:m});a.appendChild(c),e.body.appendChild(a),e.addEventListener("keydown",p,!0);let f=o;(typeof f?.requestAnimationFrame==="function"?(g)=>f.requestAnimationFrame(()=>f.requestAnimationFrame(g)):(g)=>setTimeout(g,16))(()=>{if(!l)a.classList.add("is-open")}),(c.querySelector("[data-native-autofocus]")??c.querySelector(Te))?.focus()})}function ce(e){let t=Ee();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Et}`,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 Le(t,e.variant,({root:a,settle:s})=>{let l=(u)=>u.style==="cancel"?null:u.id,m=A(t,"div","native-dialog-panel");m.setAttribute("role","alertdialog"),m.setAttribute("aria-modal","true"),m.tabIndex=-1;let p=A(t,"div","native-dialog-group");if(e.title||e.message){let u=A(t,"div","native-dialog-header");if(e.title){let d=A(t,"p","native-dialog-title",e.title);d.id=`${n}-title`,u.appendChild(d),m.setAttribute("aria-labelledby",d.id)}if(e.message){let d=A(t,"p","native-dialog-message",e.message);d.id=`${n}-message`,u.appendChild(d),m.setAttribute("aria-describedby",d.id)}p.appendChild(u)}let c=A(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)c.classList.add("is-row");for(let u of o){let d=A(t,"button",`native-dialog-action${u.style==="destructive"?" is-destructive":""}${u.style==="cancel"?" is-cancel":""}`,u.title);d.type="button",d.setAttribute("data-action-id",u.id),d.addEventListener("click",()=>s(l(u))),c.appendChild(d)}if(p.appendChild(c),m.appendChild(p),i){let u=A(t,"div","native-dialog-group"),d=A(t,"button","native-dialog-action is-cancel",i.title);d.type="button",d.setAttribute("data-action-id",i.id),d.addEventListener("click",()=>s(null)),u.appendChild(d),m.appendChild(u)}let f=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")f?.addEventListener("click",()=>s(null));return m},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Re(e){await ce({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Me(e){return await ce({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 Pe(e){return ce({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Lt(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,m=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,p=e.x+e.width/2>n.width/2?"right":"left";return{top:m,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function Ce(e){let t=Ee();if(!t?.body)return Promise.resolve(null);let n=S();return Le(t,"menu",({root:r,settle:o})=>{let i=A(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(A(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=A(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(A(t,"span","native-menu-label",a.title)),a.icon){let l=A(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=Lt(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 He=()=>!0,E=()=>!1,L=()=>null;function Oe(){return S()?.navigator??(typeof navigator>"u"?void 0:navigator)}function fe(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 _={alert:(e)=>b("dialog.alert",[e],()=>Re(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>b("dialog.confirm",[e],()=>Me(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?fe(e.anchor):void 0},n=await b("dialog.actionSheet",[t],()=>Pe(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Vn(){return(e)=>_.actionSheet(e)}async function Xn(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return _.confirm(e);return await _.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 me={show:async(e)=>{let t={title:e.title,anchor:fe(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 b("contextMenu.show",[t],()=>Ce(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Jn(e,t){return me.show({...t,anchor:fe(e.getBoundingClientRect())})}function Rt(e,t){let n=S();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 _e={open:async(e,t={})=>{let n=await b("browser.open",[e,t],()=>Rt(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)}}},ue=new Map,de=new Map;function Ie(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var De={isAvailable:()=>T("symbols.image")!==null,image:(e,t={})=>{let n=Ie(e,t),r=ue.get(n);if(r)return r;let o=b("symbols.image",[e,t],L).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,L).then((i)=>(de.set(n,i),i));return ue.set(n,o),o},cached:(e,t={})=>de.get(Ie(e,t)),clearCache:()=>{ue.clear(),de.clear()}},j={setStyle:(e)=>b("statusBar.setStyle",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},D={setUnderPageColor:(e)=>b("chrome.setUnderPageColor",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>b("chrome.setKeyboardAccessory",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},P={isAvailable:()=>T("refresh.enable")!==null,enable:(e)=>b("refresh.enable",[e??{}],E,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>b("refresh.disable",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>b("refresh.end",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>R("craftRefresh",()=>e())},B={complete:(e)=>b("background.complete",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},Be={write:(e)=>b("clipboard.write",[e],async()=>{let t=Oe()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(He,E)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>b("clipboard.read",[],async()=>{let e=Oe()?.clipboard;if(!e?.readText)return null;return e.readText().catch(L)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},Fe={isAvailable:()=>T("db.query")!==null,query:(e,t=[])=>b("db.query",[e,t],L).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>b("db.execute",[e,t],L).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 pe(e,t){let n=S()?.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 Mt(e){let t=S()?.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 Ke={openPDF:(e,t=0)=>b("openPDF",[e,t],()=>{let n=S();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>b("takeScreenshot",[],L,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>b("scanQRCode",[],L).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},L),pickFile:(e=[])=>b("pickFile",[e],()=>Mt(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}},L),saveFile:(e,t,n)=>b("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return pe(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=pe(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>b("downloadFile",[e,t],()=>pe(e,t)).then((n)=>typeof n==="string"?n:null)},$e={set:(e)=>b("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],E).then((t)=>t!==!1),clear:()=>b("shortcuts.clear",[],E).then((e)=>e!==!1),onShortcut:(e)=>R("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},qe={update:(e)=>b("widget.update",[e],E).then((t)=>t!==!1),reload:()=>b("widget.reload",[],E).then((e)=>e!==!1)},Pt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function Ne(){return S()?.screen?.orientation}var Ue={lock:(e)=>b("lockOrientation",[e],()=>{let t=Ne();return t?.lock?t.lock(Pt[e]).then(He,E):!1}).then((t)=>t!==!1),unlock:()=>b("unlockOrientation",[],()=>(Ne()?.unlock?.(),!0)).then((e)=>e!==!1)},We={signInWithApple:(e={})=>b("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],L).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},ze={isAvailable:()=>T("iap.purchase")!==null,products:(e)=>b("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>b("iap.purchase",[e],L).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>b("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};function er(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=(f)=>{let u=f;if(u.button!==void 0&&u.button!==0)return;a=!1,i={x:u.clientX,y:u.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},m=(f)=>{if(!i)return;let u=f;if(Math.hypot(u.clientX-i.x,u.clientY-i.y)>r)s()},p=(f)=>{if(!a)return;a=!1,f.preventDefault(),f.stopPropagation()},c=(f)=>f.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",m),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",c),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",m),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",c)}}function Ct(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 tr(e,t){let n=null,r=null,o=!1,i=0,a=(u)=>{let d=e.getBoundingClientRect();return Ct(u,{left:d.left+2,width:d.width-4},t.count())},s=(u)=>{let d=u;if(d.button!==void 0&&d.button!==0)return;let g=a(d.clientX);if(g!==t.selected())return;n=g,i=g,o=!1,r=d.pointerId;try{e.setPointerCapture?.(d.pointerId)}catch{}t.onPress?.(!0)},l=(u)=>{if(n===null)return;let d=a(u.clientX);if(d===i)return;o=!0,i=d,t.onScrub(d)},m=(u)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),u&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},p=(u)=>{if(!o)return;o=!1,u.preventDefault(),u.stopPropagation()},c=()=>m(!0),f=()=>m(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",f),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",f),e.removeEventListener("click",p,!0)}}function nr(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 rr(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function or(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=T("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})}function ge(e){let t=S();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function Ye(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function je(){let e=S()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:Ye(e?.getAttribute("data-craft-reduce-motion"))||ge("(prefers-reduced-motion: reduce)"),reduceTransparency:Ye(e?.getAttribute("data-craft-reduce-transparency"))||ge("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||ge("(prefers-color-scheme: dark)")?"dark":"light"}}function Ot(e){let t=je(),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 Ge(e,t={}){if(t.immediate!==!1)e(je());return R("craftAppearance",(n)=>e(Ot(n)))}function lr(e){return R("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function cr(e){return R("craftMemoryWarning",()=>e())}function Ve(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>B.complete(!0),()=>B.complete(!1))}}function ur(e){let t=Ve(e);return R("craftSilentPush",(n)=>t(n.payload??{}))}function dr(e){let t=Ve(()=>e());return R("craftBackgroundRefresh",()=>t(void 0))}import{haptics as It}from"craft-native/mobile";function he(){if(typeof window>"u")return;return window}function F(e=he()){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 Nt(e,t=he()){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(F(t))})};return e(F(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function Ht(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 mr(e){let t=e.host??he();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,-F(t)))})},m=(g)=>{let x=s!==null;if(s=g,x)return;a(()=>{if(s!==null)l(s)})},p=(g)=>{let x=g.touches?.[0];return x?x.clientY:null},c=(g)=>{if(i||F(t)>0)return;r=p(g),o=!1},f=(g)=>{if(r===null)return;let x=p(g);if(x===null)return;let N=Ht(F(t),x-r);if(!o&&N>=n)o=!0,Promise.resolve(It.impact("medium")).catch(()=>{});else if(o&&N<n*0.8)o=!1;m(N)},u=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)}},d=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",f,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("touchcancel",d),()=>{s=null,t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",f),t.removeEventListener("touchend",u),t.removeEventListener("touchcancel",d)}}function _t(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 gr(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Nt((o)=>{let i=_t(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 hr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Qe(){if(typeof window>"u")return;return window}var Xe="__stxPushed",Dt="__stxScroll";function Bt(e=Qe()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(Xe in n)return n[Xe]===!0;return!(Dt in n)}function vr(e=Qe()){if(!Bt(e))return!1;return e.history.back(),!0}function yr(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 xr(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function Sr(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Ft(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function wr(){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 Ft(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Ar(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 kr(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function Kt(e,t=$t()){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 $t(){if(typeof window>"u")return;return window.location?.origin}var Je="stacks-mobile-deep-link";function Er(e,t){let n=(r)=>{let o=Kt(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Je)===r)return;sessionStorage.setItem(Je,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Lr=30;function qt(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 Ut(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 Ze(e,t={}){let n=Ut(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let c of n){let f=o[o.length-1],u=s?(c.timestamp-s.timestamp)/1000:0;if(s=c,!f){o.push({fix:c,cumM:0});continue}if(u>30){o.push({fix:c,cumM:i});continue}let d=(c.timestamp-f.fix.timestamp)/1000,g=qt(f.fix,c),x=Math.min(10,Math.max(3,f.fix.accuracy,c.accuracy));if(g<x)continue;if(i+=g,d>0&&g/d>=0.5)a+=d;o.push({fix:c,cumM:i})}let l=o[o.length-1],m=null,p=null;if(l&&n.at(-1).timestamp-l.fix.timestamp<=r*1000){let c=l.fix.timestamp-r*1000,f=o.find((g)=>g.fix.timestamp>=c)??l,u=l.cumM-f.cumM,d=(l.fix.timestamp-f.fix.timestamp)/1000;if(u>=20&&d>0)p=u/d,m=d/(u/1000)}return{distanceM:i,movingS:a,paceSPerKm:m,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:p,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function Rr(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 Mr(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var et={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function Pr(e){let t=e.location,n=e.intervalMs??3000,r=et,o=null,i=()=>typeof document<"u"&&document.visibilityState==="hidden",a=0,s=null,l=Promise.resolve(),m=null,p=!1;function c(g){let x=l.then(g);return l=x.then(()=>{},()=>{}),x}function f(){if(s)return s;let g=a;return s=(async()=>{let x=await t.readRecording();if(g===a&&!p)r=Ze(x,e),e.onUpdate?.(r);return r})().finally(()=>{s=null}),s}function u(){if(d(),p)return;o=setInterval(()=>{if(!i())f().catch(()=>{})},n)}function d(){if(o)clearInterval(o);o=null}return{get stats(){return r},start(){return m=null,c(async()=>{if(await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),a++,r={...et},!p)e.onUpdate?.(r);return u(),r})},attach(){return c(async()=>{let g=await t.getRecordingState();if(!g?.active)return null;if(await f().catch(()=>{}),!g.paused)u();return g})},pause(){return c(async()=>{await t.pauseRecording(),d(),await f().catch(()=>{})})},resume(){return c(async()=>{await t.resumeRecording(),u()})},stop(){if(m)return m;return m=c(async()=>{d(),a++;let x=(await t.stopRecording())?.locations??[];if(r=Ze(x,e),!p)e.onUpdate?.(r);return x}).catch((g)=>{throw m=null,g}),m},dispose(){p=!0,a++,d()},refresh:f}}function Or(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Ir(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Nr(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Hr(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 Dr=150;function Wt(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 G(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Br(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?G(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:G(n.map((s)=>s.latitude),0.5),longitude:G(n.map((s)=>s.longitude),0.5)};i=G(n.map((s)=>Wt(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 Fr(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 J=new Set,tt=!1,V=null;function zt(e){return e.isConnected&&e.getClientRects().length>0}function nt(){return[...J].find((e)=>zt(e.element))}function X(){let e=nt(),t=Boolean(e);if(t===tt)return;if(tt=t,t)P.enable(e?.tintColor?{tintColor:e.tintColor}:{});else P.disable()}function Yt(){let e=nt();if(!e){P.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>P.end())}function qr(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};J.add(n);let r=e.ownerDocument?.defaultView;if(!V){let o=P.onRefresh(Yt),i=()=>X();r?.addEventListener("stx:load",i),V=()=>{o(),r?.removeEventListener("stx:load",i)}}return X(),r?.requestAnimationFrame?.(()=>X()),()=>{if(J.delete(n),J.size===0)V?.(),V=null;X()}}var Wr=0.5;function jt(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 Gt(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 Vt(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function zr(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>jt(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let c=p;if(c.button!==void 0&&c.button!==0)return;if(c.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let f=a().find((u)=>u.name===e.detent())?.y??0;n={y:c.clientY,base:f,pointerId:c.pointerId},o=f,r=[{y:f,t:c.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(c.pointerId)}catch{}},l=(p)=>{if(!n)return;let c=p,f=n.base+c.clientY-n.y;o=f<0?-Vt(-f):f,r.push({y:o,t:c.timeStamp});while(r.length>2&&c.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let u=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/u))))},m=(p)=>{if(!n)return;let c=p;n=null;let f=r[0],u=Math.max(1,c.timeStamp-f.t),d=(o-f.y)/u;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Gt({y:o,velocity:d,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",m),p.addEventListener("pointercancel",m);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",m),p.removeEventListener("pointercancel",m)}}var rt=0,be="";function Yr(e){let t=e.ownerDocument,n=[],r=e;while(r.parentElement&&r!==t.body){for(let a of Array.from(r.parentElement.children)){if(a===r||a.hasAttribute("inert")||a.hasAttribute("data-native-dialog"))continue;if(["SCRIPT","STYLE","TEMPLATE","LINK"].includes(a.tagName))continue;if(a.hasAttribute("data-native-sheet")&&a.getAttribute("aria-hidden")==="true")continue;a.setAttribute("inert",""),n.push(a)}r=r.parentElement}let o=t.documentElement;if(rt++===0)be=o.style.overflow||"",o.style.overflow="hidden";let i=!1;return()=>{if(i)return;i=!0;for(let a of n)a.removeAttribute("inert");if(--rt===0)if(be)o.style.overflow=be;else o.style.removeProperty("overflow")}}function jr(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()}}function Gr(e,t){let n=e.documentElement;if(!t){n.removeAttribute("data-native-sheet-card");return}let r=e.defaultView,o=(r?.scrollY??0)+(r?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(o)}px`),n.setAttribute("data-native-sheet-card","")}function Xt(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 Jt(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 Qt(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&&!Jt(r))return r}return null}function Zt(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 Qr(e,t={}){let n=t.root??e.documentElement;D.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=Qt(e);if(p&&p!==r)r=p,D.setUnderPageColor(p);let c=Zt(e)?"light":"dark";if(c!==o)o=c,j.setStyle(c)},a=Ge((p)=>{Xt(n,p),i()}),s=e.defaultView,l=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;l?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let m=s?.matchMedia?.("(prefers-color-scheme: dark)");return m?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),m?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var eo=64;var en=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,tn=/^(?:0|[1-9]\d*)$/;function it(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,m=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!en.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:m})}return{kinds:t,problems:n}}function q(e,t){return e.find((n)=>n.name===t)??null}function K(e,t,n){let r=q(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function nn(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(!tn.test(o))return null;let i=Number(o);return K(e,r,i)===t?{kind:r,slot:i}:null}function at(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function to(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()),...at(it(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function st(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${q(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function rn(e,t,n,r,o=Date.now()){let i=q(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((d)=>d.kind===n),s=st(e,n,r),l=a.find((d)=>d.itemId===r.id)??null,m=l?null:ln(a,i.slots),p=l||m!==null?null:cn(a),c=l?.slot??m??p?.slot;if(c===void 0||c===null)return null;let f={kind:n,slot:c,itemId:r.id,title:s,donatedAt:o},u=t.filter((d)=>d.kind!==n||d.slot!==c&&d.itemId!==r.id);return{entries:lt(e,[...u,f]),entry:f,evicted:p,changed:!l||l.title!==s}}function on(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 an(e,t,n){let r=nn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=q(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function sn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:m,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||K(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let c=`${a}-slot-${s}`,f=`${a}#${l}`;if(n.has(c)||r.has(f))continue;n.set(c,{kind:a,slot:s,itemId:l,title:typeof m==="string"&&m.trim()?m:st(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(f)}return lt(e,[...n.values()])}function lt(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 ln(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 cn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function un(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var dn="stacks_spotlight_index",pn=3000;function no(e){let t=e.onProblem??((v)=>console.warn(`[spotlight] ${v}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:it(e.kinds);for(let v of n.problems)t(v);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??dn,i=e.legacyStorageKeys??[],a=e.timeoutMs??pn,s=e.now??(()=>Date.now()),l=e.bridge??un,m=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function c(){if(m)return m;m=[];let v=p();if(!v)return m;try{let y=[o,...i].map((w)=>v.getItem(w)).find((w)=>w);m=y?sn(r,JSON.parse(y)):[]}catch{m=[]}return m}function f(v){m=v;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(v));for(let w of i)y.removeItem(w)}catch{}}async function u(v){if(!v)return null;let y;try{return await Promise.race([v,new Promise((w)=>{y=setTimeout(()=>w(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let d=Promise.resolve();function g(v){let y=d.then(v,v);return d=y.catch(()=>{return}),y}async function x(v,y){let w=l()?.register;if(!w||r.length===0)return!1;return g(async()=>{let k=rn(r,c(),v,y,s()),C=k&&K(r,v,k.entry.slot);if(!k||!C)return!1;if(!k.changed)return f(k.entries),!0;let H=await u(w(k.entry.title,C))!==null;if(H)f(k.entries);return H})}async function N(v,y){let w=l()?.remove;if(!w)return!1;return g(async()=>{let{entries:k,removed:C}=on(c(),v,y);if(!C)return!1;let H=K(r,v,C.slot),vt=H?await u(w(H))!==null:!1;return f(k),vt})}async function ht(v,y){let w=q(r,v)?.slots;if(!w||!l()?.register)return 0;let k=0;for(let C of[...y].slice(0,w).reverse())if(await x(v,C))k++;return k}async function bt(){let v=l()?.remove;if(!v)return f([]),0;return g(async()=>{let y=0;for(let w of c()){let k=K(r,w.kind,w.slot);if(k&&await u(v(k))!==null)y++}return f([]),y})}return{kinds:r,index:x,sync:ht,remove:N,clear:bt,routeFor:(v)=>an(r,c(),v),entries:()=>c(),activityTypes:(v)=>at(r).map((y)=>`${v}.${y}`),reset:()=>{m=null}}}var ot=["craftShortcut","craftSiriShortcut"];function ro(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 ot)globalThis.addEventListener(r,n);return()=>{for(let r of ot)globalThis.removeEventListener(r,n)}}import{tabBar as fn}from"craft-native/mobile";var mn=fn;function gn(e){return Array.from(e.querySelectorAll("a[data-native-tab]")).map((t)=>({id:t.getAttribute("href")||"",title:t.getAttribute("data-native-tab")||t.getAttribute("aria-label")||"",symbol:t.getAttribute("data-native-tab-symbol")||"circle",badge:(t.querySelector(".native-tab-badge")?.textContent||"").trim(),current:t.hasAttribute("data-stx-nav-current")||t.classList.contains("is-active")})).filter((t)=>t.id&&t.title)}function hn(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 ut(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function bn(){return typeof ut()?.selectTab==="function"}function ao(e,t={}){let n=(r)=>{if(bn()||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 ct(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var ve="stacks:tab-bar-cover";function so(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(ve))}function lo(e,t={}){let n=t.api??mn;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=ct(o?.getPropertyValue("--native-tab-active")||""),a=ct(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:f,selected:u}=hn(gn(e)),d=JSON.stringify({tabs:f,selected:u});if(d===s)return;let g=s&&s!=="hidden"?JSON.parse(s):null;if(g&&u&&JSON.stringify(g.tabs)===JSON.stringify(f))n.select(u);else n.set(f,{selected:u,tint:i,tintDark:a});s=d},m=typeof MutationObserver==="function"?new MutationObserver(l):null;m?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((f)=>{let u=ut();if(u?.selectTab){u.selectTab(f);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((g)=>g.getAttribute("href")===f)?.click()}),c=()=>l();if(typeof window<"u")window.addEventListener("stx:load",c),window.addEventListener("stx:screen-shown",c),window.addEventListener(ve,c);return l(),()=>{if(m?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",c),window.removeEventListener("stx:screen-shown",c),window.removeEventListener(ve,c);n.hide()}}var Sn={isAvailable:()=>h(()=>ye.isAvailable()),getBiometricType:()=>h(()=>ye.getBiometricType()),authenticate:(e)=>h(()=>ye.authenticate(e))},wn={takePicture:(e)=>h(()=>Z.takePicture(e)),pickImage:()=>h(()=>Z.pickImage()),pickMultiple:(e)=>h(()=>Z.pickMultiple(e)),isAvailable:()=>h(()=>Z.isAvailable())},An={getInfo:()=>h(()=>O.getInfo()),getCapabilities:()=>h(()=>O.getCapabilities()),isMobile:()=>O.isMobile(),isIOS:()=>O.isIOS(),isAndroid:()=>O.isAndroid(),getLocale:()=>O.getLocale(),getTimezone:()=>O.getTimezone()},kn=yn,En={getCurrentPosition:(e)=>h(()=>M.getCurrentPosition(e)),watchPosition:(e,t)=>M.watchPosition(e,t),clearWatch:(e)=>M.clearWatch(e),startRecording:(e)=>h(()=>M.startRecording(e)),pauseRecording:()=>h(()=>M.pauseRecording()),resumeRecording:()=>h(()=>M.resumeRecording()),stopRecording:()=>h(()=>M.stopRecording()),getRecordingState:()=>h(()=>M.getRecordingState()),readRecording:()=>h(()=>M.readRecording())},Tn={show:(e)=>h(()=>te.show(e)),schedule:(e)=>h(()=>te.schedule(e)),cancelAll:()=>h(()=>te.cancelAll()),setBadge:(e)=>h(()=>te.setBadge(e))},Ln={check:(e)=>h(()=>W.check(e)),request:(e)=>h(()=>W.request(e)),checkMultiple:(e)=>h(()=>W.checkMultiple(e)),requestMultiple:(e)=>h(()=>W.requestMultiple(e)),openSettings:()=>h(()=>W.openSettings())},Rn={set:(e,t)=>h(()=>ne.set(e,t)),get:(e)=>h(()=>ne.get(e)),delete:(e)=>h(()=>ne.delete(e)),clear:()=>h(()=>ne.clear())},Mn={share:(e)=>h(()=>mt.share(e)),isAvailable:()=>mt.isAvailable()},Pn={request:()=>h(()=>vn.request())},oe={impact:(e)=>Promise.resolve().then(()=>ee.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ee.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ee.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ee.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=T("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function gt(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 Cn={async getInitialURL(){if(!await I())return null;return gt(await dt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=dt.onLink?.((o,i)=>{let a=gt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(ae()?.craft)r();else I().then(r);return()=>{n=!0,t?.()}}},mo={isAvailable:()=>re.isAvailable(),set:(e,t)=>re.set(e,t),remove:(e)=>re.remove(e),clear:()=>re.clear()},On={enable:()=>h(()=>pt.enable()),disable:()=>h(()=>pt.disable())},In={isAvailable:()=>Q.isAvailable(),get:()=>h(()=>Q.get()),set:(e)=>h(()=>Q.set(e)),restore:()=>h(()=>Q.restore())},Nn={isAvailable:()=>we.isAvailable(),speak:(e,t)=>h(()=>we.speak(e,t)),stop:()=>h(()=>we.stop())},Hn={getStatus:()=>h(()=>ft.getStatus()),onChange:(e)=>le(()=>ft.onChange(e))},_n={register:()=>h(()=>Se.register()),onToken:(e)=>Se.onToken(e),onNotification:(e)=>le(()=>Se.onNotification(e))},Dn={requestAuthorization:(e,t)=>h(()=>U.requestAuthorization(e,t)),getData:(e,t)=>h(()=>U.getData(e,t)),saveWorkout:(e)=>h(()=>U.saveWorkout(e)),getWorkouts:(e)=>h(()=>U.getWorkouts(e)),getDailyStatistics:(e,t)=>h(()=>U.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>b("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSleepIntervals:(e)=>b("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),supports:(e)=>T(`health.${e}`)!==null},Bn={start:(e)=>h(()=>xe.start(e)),update:(e)=>h(()=>xe.update(e)),end:()=>h(()=>xe.end())},Fn={send:(e)=>h(()=>z.send(e)),updateContext:(e)=>h(()=>z.updateContext(e)),isReachable:()=>h(()=>z.isReachable()),onMessage:(e)=>z.onMessage(e),onReachabilityChange:(e)=>z.onReachabilityChange(e)},go=xn;function ae(){return S()}function ie(){let e=ae()?.craft;if(!e||typeof e!=="object")return null;if(!("platform"in e)||e.platform!=="ios"&&e.platform!=="android")return null;let t="capabilities"in e?e.capabilities:void 0,n=t&&typeof t==="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).filter(([,r])=>typeof r==="boolean")):{};return{platform:e.platform,capabilities:n}}function Ae(){return ie()!==null}function Kn(e=2000){if(Ae()||se())return Promise.resolve(!0);let t=ae();if(!t||!(t.craft||t.webkit?.messageHandlers?.craft))return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(Ae())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function $n(e){let t=ae();if(!t)return()=>{};if(ie()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!ie())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function qn(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 ho={get nativeBridge(){return ie()},biometrics:Sn,camera:wn,device:An,haptics:oe,lifecycle:kn,location:En,notifications:Tn,permissions:Ln,secureStorage:Rn,share:Mn,appReview:Pn,deepLinks:Cn,keepAwake:On,brightness:In,speech:Nn,network:Hn,pushNotifications:_n,health:Dn,liveActivities:Bn,watchConnectivity:Fn,dialog:_,contextMenu:me,browser:_e,symbols:De,statusBar:j,chrome:D,refresh:P,background:B,clipboard:Be,db:Fe,files:Ke,shortcuts:$e,widgets:qe,orientation:Ue,auth:We,storeKit:ze,isNativeMobile:Ae,whenNative:Kn,onReady:$n,withFeedback:qn};export{Un as BRIDGE_WAIT_MS,Dr as INDOOR_CHECK_AFTER_S,eo as MAX_SPOTLIGHT_SLOTS_PER_KIND,Lr as ROUTE_GAP_S,Wr as SHEET_FLICK_VELOCITY,ve as TAB_BAR_COVER_EVENT,h as afterBridge,Pn as appReview,Xt as applyAppearance,We as auth,xr as backLabelFor,B as background,Sn as biometrics,Y as bridgePending,In as brightness,_e as browser,b as callNative,wn as camera,Bt as canGoBack,D as chrome,Be as clipboard,Xn as confirmAction,me as contextMenu,so as coverTabBar,S as craftHost,yt as craftRoot,Pr as createRouteRecorder,no as createSpotlightIndex,je as currentAppearance,Fe as db,Kt as deepLinkPath,Cn as deepLinks,An as device,_ as dialog,yr as enterNavTrail,Ke as files,qt as fixDistance,rr as focusSegment,Er as followDeepLinks,ie as getNativeMobileBridge,vr as goBack,Ar as goBackToTabRoot,ao as handleTabReselect,oe as haptics,se as hasNativeMobileHost,Dn as health,Br as indoorVerdict,Qr as installNativeChrome,or as installPressables,Ae as isNativeMobile,zt as isShown,On as keepAwake,_t as largeTitleMetrics,kn as lifecycle,jr as liftToBody,Bn as liveActivities,En as location,Yr as lockBackground,lo as mirrorTabBar,ho as mobile,wt as nativeFunction,T as nativeFunctionNow,hn as nativeTabs,Sr as navTrail,Hn as network,Ot as normalizeAppearance,gt as normalizeDeepLinkURL,Tn as notifications,gr as observeLargeTitle,er as observeLongPress,qr as observeNativeRefresh,Nt as observePageScroll,mr as observePullToRefresh,tr as observeSegmentScrub,zr as observeSheetDrag,Ge as onAppearance,dr as onBackgroundRefresh,R as onCraftEvent,cr as onMemoryWarning,$n as onMobileReady,lr as onResume,ur as onSilentPush,ro as onSpotlightTap,Ue as orientation,Rr as paceLabel,Qt as pageBackground,Zt as pageIsDark,F as pageScrollTop,Ir as pauseSessionClock,Ln as permissions,Lt as placeMenu,rn as placeSpotlightItem,Pe as presentActionSheet,Re as presentAlert,ce as presentChoice,Me as presentConfirm,Ce as presentContextMenu,Gr as presentPageAsCard,wr as previousScreenPath,Ht as pullDistance,_n as pushNotifications,sn as readSpotlightEntries,it as readSpotlightKinds,gn as readTabLinks,P as refresh,on as removeSpotlightItem,hr as resolveScrollHost,Nr as resumeSessionClock,Ze as routeStats,bn as routerHandlesTabs,Vt as rubberBand,Rn as secureStorage,Ct as segmentAt,nr as segmentForKey,Hr as sessionClockElapsed,Gt as settleSheet,Mn as share,jt as sheetStops,$e as shortcuts,Jn as showContextMenuFor,mo as snapshots,Nn as speech,Mr as speedLabel,go as splash,K as spotlightAction,at as spotlightActions,to as spotlightActivityTypes,un as spotlightBridge,q as spotlightKind,an as spotlightRoute,nn as spotlightSlot,st as spotlightTitle,Or as startSessionClock,j as statusBar,ze as storeKit,le as subscribeWhenReady,De as symbols,mn as tabBar,fe as toNativeRect,kr as trailEntryFor,Tt as trapFocus,Fr as typedDistanceKm,Ut as usableFixes,Vn as useActionSheet,Fn as watchConnectivity,I as whenBridgeReady,Kn as whenNativeMobile,qe as widgets,qn as withNativeFeedback};
55
+ `;function Te(){return S()?.document}function Et(e){if(e.getElementById(Ee))return;let t=e.createElement("style");t.id=Ee,t.textContent=kt,(e.head??e.documentElement).appendChild(t)}var Tt=0;function A(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}var Le='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Lt(e,t){if(t.key!=="Tab")return;let n=Array.from(e.querySelectorAll(Le));if(n.length===0){t.preventDefault();return}let r=n[0],o=n[n.length-1],i=e.ownerDocument.activeElement;if(t.shiftKey&&(i===r||!e.contains(i)))t.preventDefault(),o.focus();else if(!t.shiftKey&&(i===o||!e.contains(i)))t.preventDefault(),r.focus()}function Re(e,t,n,r){Et(e);let o=S(),i=e.activeElement,a=A(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(A(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,m=(h)=>{if(l)return;l=!0,a.classList.remove("is-open"),e.removeEventListener("keydown",p,!0),setTimeout(()=>{if(a.remove(),i&&typeof i.focus==="function")i.focus()},260),s(h)},p=(h)=>{if(h.key==="Escape"){h.preventDefault(),m(r());return}Lt(c,h)},c=n({root:a,settle:m});a.appendChild(c),e.body.appendChild(a),e.addEventListener("keydown",p,!0);let f=o;(typeof f?.requestAnimationFrame==="function"?(h)=>f.requestAnimationFrame(()=>f.requestAnimationFrame(h)):(h)=>setTimeout(h,16))(()=>{if(!l)a.classList.add("is-open")}),(c.querySelector("[data-native-autofocus]")??c.querySelector(Le))?.focus()})}function ue(e){let t=Te();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Tt}`,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 Re(t,e.variant,({root:a,settle:s})=>{let l=(u)=>u.style==="cancel"?null:u.id,m=A(t,"div","native-dialog-panel");m.setAttribute("role","alertdialog"),m.setAttribute("aria-modal","true"),m.tabIndex=-1;let p=A(t,"div","native-dialog-group");if(e.title||e.message){let u=A(t,"div","native-dialog-header");if(e.title){let d=A(t,"p","native-dialog-title",e.title);d.id=`${n}-title`,u.appendChild(d),m.setAttribute("aria-labelledby",d.id)}if(e.message){let d=A(t,"p","native-dialog-message",e.message);d.id=`${n}-message`,u.appendChild(d),m.setAttribute("aria-describedby",d.id)}p.appendChild(u)}let c=A(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)c.classList.add("is-row");for(let u of o){let d=A(t,"button",`native-dialog-action${u.style==="destructive"?" is-destructive":""}${u.style==="cancel"?" is-cancel":""}`,u.title);d.type="button",d.setAttribute("data-action-id",u.id),d.addEventListener("click",()=>s(l(u))),c.appendChild(d)}if(p.appendChild(c),m.appendChild(p),i){let u=A(t,"div","native-dialog-group"),d=A(t,"button","native-dialog-action is-cancel",i.title);d.type="button",d.setAttribute("data-action-id",i.id),d.addEventListener("click",()=>s(null)),u.appendChild(d),m.appendChild(u)}let f=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")f?.addEventListener("click",()=>s(null));return m},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Pe(e){await ue({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Me(e){return await ue({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 Ce(e){return ue({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Rt(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,m=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,p=e.x+e.width/2>n.width/2?"right":"left";return{top:m,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function Oe(e){let t=Te();if(!t?.body)return Promise.resolve(null);let n=S();return Re(t,"menu",({root:r,settle:o})=>{let i=A(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(A(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=A(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(A(t,"span","native-menu-label",a.title)),a.icon){let l=A(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=Rt(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 _e=()=>!0,E=()=>!1,L=()=>null;function Ne(){return S()?.navigator??(typeof navigator>"u"?void 0:navigator)}function me(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 D={alert:(e)=>b("dialog.alert",[e],()=>Pe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>b("dialog.confirm",[e],()=>Me(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?me(e.anchor):void 0},n=await b("dialog.actionSheet",[t],()=>Ce(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Jn(){return(e)=>D.actionSheet(e)}async function Qn(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return D.confirm(e);return await D.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 ge={show:async(e)=>{let t={title:e.title,anchor:me(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 b("contextMenu.show",[t],()=>Oe(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Zn(e,t){return ge.show({...t,anchor:me(e.getBoundingClientRect())})}function Pt(e,t){let n=S();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 De={open:async(e,t={})=>{let n=await b("browser.open",[e,t],()=>Pt(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)}}},de=new Map,pe=new Map;function Ie(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var Be={isAvailable:()=>T("symbols.image")!==null,image:(e,t={})=>{let n=Ie(e,t),r=de.get(n);if(r)return r;let o=b("symbols.image",[e,t],L).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,L).then((i)=>(pe.set(n,i),i));return de.set(n,o),o},cached:(e,t={})=>pe.get(Ie(e,t)),clearCache:()=>{de.clear(),pe.clear()}},V={setStyle:(e)=>b("statusBar.setStyle",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},B={setUnderPageColor:(e)=>b("chrome.setUnderPageColor",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>b("chrome.setKeyboardAccessory",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},C={isAvailable:()=>T("refresh.enable")!==null,enable:(e)=>b("refresh.enable",[e??{}],E,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>b("refresh.disable",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>b("refresh.end",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>P("craftRefresh",()=>e())},F={complete:(e)=>b("background.complete",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},Fe={write:(e)=>b("clipboard.write",[e],async()=>{let t=Ne()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(_e,E)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>b("clipboard.read",[],async()=>{let e=Ne()?.clipboard;if(!e?.readText)return null;return e.readText().catch(L)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},Ke={isAvailable:()=>T("db.query")!==null,query:(e,t=[])=>b("db.query",[e,t],L).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>b("db.execute",[e,t],L).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 fe(e,t){let n=S()?.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 Mt(e){let t=S()?.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 $e={openPDF:(e,t=0)=>b("openPDF",[e,t],()=>{let n=S();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>b("takeScreenshot",[],L,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>b("scanQRCode",[],L).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},L),pickFile:(e=[])=>b("pickFile",[e],()=>Mt(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}},L),saveFile:(e,t,n)=>b("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return fe(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=fe(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>b("downloadFile",[e,t],()=>fe(e,t)).then((n)=>typeof n==="string"?n:null)},qe={set:(e)=>b("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],E).then((t)=>t!==!1),clear:()=>b("shortcuts.clear",[],E).then((e)=>e!==!1),onShortcut:(e)=>P("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},Ue={update:(e)=>b("widget.update",[e],E).then((t)=>t!==!1),reload:()=>b("widget.reload",[],E).then((e)=>e!==!1)},Ct={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function He(){return S()?.screen?.orientation}var We={lock:(e)=>b("lockOrientation",[e],()=>{let t=He();return t?.lock?t.lock(Ct[e]).then(_e,E):!1}).then((t)=>t!==!1),unlock:()=>b("unlockOrientation",[],()=>(He()?.unlock?.(),!0)).then((e)=>e!==!1)},ze={signInWithApple:(e={})=>b("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],L).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},Ye={isAvailable:()=>T("iap.purchase")!==null,products:(e)=>b("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>b("iap.purchase",[e],L).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>b("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};function nr(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=(f)=>{let u=f;if(u.button!==void 0&&u.button!==0)return;a=!1,i={x:u.clientX,y:u.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},m=(f)=>{if(!i)return;let u=f;if(Math.hypot(u.clientX-i.x,u.clientY-i.y)>r)s()},p=(f)=>{if(!a)return;a=!1,f.preventDefault(),f.stopPropagation()},c=(f)=>f.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",m),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",c),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",m),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",c)}}function Ot(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 rr(e,t){let n=null,r=null,o=!1,i=0,a=(u)=>{let d=e.getBoundingClientRect();return Ot(u,{left:d.left+2,width:d.width-4},t.count())},s=(u)=>{let d=u;if(d.button!==void 0&&d.button!==0)return;let h=a(d.clientX);if(h!==t.selected())return;n=h,i=h,o=!1,r=d.pointerId;try{e.setPointerCapture?.(d.pointerId)}catch{}t.onPress?.(!0)},l=(u)=>{if(n===null)return;let d=a(u.clientX);if(d===i)return;o=!0,i=d,t.onScrub(d)},m=(u)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),u&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},p=(u)=>{if(!o)return;o=!1,u.preventDefault(),u.stopPropagation()},c=()=>m(!0),f=()=>m(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",f),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",f),e.removeEventListener("click",p,!0)}}function or(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 ir(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function ar(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=T("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})}function he(e){let t=S();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function je(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function Ge(){let e=S()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:je(e?.getAttribute("data-craft-reduce-motion"))||he("(prefers-reduced-motion: reduce)"),reduceTransparency:je(e?.getAttribute("data-craft-reduce-transparency"))||he("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||he("(prefers-color-scheme: dark)")?"dark":"light"}}function Nt(e){let t=Ge(),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 Ve(e,t={}){if(t.immediate!==!1)e(Ge());return P("craftAppearance",(n)=>e(Nt(n)))}function ur(e){return P("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function dr(e){return P("craftMemoryWarning",()=>e())}function Xe(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>F.complete(!0),()=>F.complete(!1))}}function pr(e){let t=Xe(e);return P("craftSilentPush",(n)=>t(n.payload??{}))}function fr(e){let t=Xe(()=>e());return P("craftBackgroundRefresh",()=>t(void 0))}import{haptics as It}from"craft-native/mobile";function be(){if(typeof window>"u")return;return window}function K(e=be()){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 Ht(e,t=be()){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(K(t))})};return e(K(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function _t(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 hr(e){let t=e.host??be();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(h)=>setTimeout(h,16),s=null,l=(h)=>{s=null,e.onPull?.(h,o,{bounce:Math.min(h,Math.max(0,-K(t)))})},m=(h)=>{let x=s!==null;if(s=h,x)return;a(()=>{if(s!==null)l(s)})},p=(h)=>{let x=h.touches?.[0];return x?x.clientY:null},c=(h)=>{if(i||K(t)>0)return;r=p(h),o=!1},f=(h)=>{if(r===null)return;let x=p(h);if(x===null)return;let H=_t(K(t),x-r);if(!o&&H>=n)o=!0,Promise.resolve(It.impact("medium")).catch(()=>{});else if(o&&H<n*0.8)o=!1;m(H)},u=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)}},d=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",f,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("touchcancel",d),()=>{s=null,t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",f),t.removeEventListener("touchend",u),t.removeEventListener("touchcancel",d)}}function Dt(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 br(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Ht((o)=>{let i=Dt(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 vr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Ze(){if(typeof window>"u")return;return window}var Je="__stxPushed",Bt="__stxScroll";function Ft(e=Ze()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(Je in n)return n[Je]===!0;return!(Bt in n)}function xr(e=Ze()){if(!Ft(e))return!1;return e.history.back(),!0}function Sr(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 wr(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function Ar(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Kt(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function kr(){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 Kt(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Er(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 Tr(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function $t(e,t=qt()){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 qt(){if(typeof window>"u")return;return window.location?.origin}var Qe="stacks-mobile-deep-link";function Lr(e,t){let n=(r)=>{let o=$t(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Qe)===r)return;sessionStorage.setItem(Qe,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Pr=30;function Ut(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 Wt(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 et(e,t={}){let n=Wt(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let c of n){let f=o[o.length-1],u=s?(c.timestamp-s.timestamp)/1000:0;if(s=c,!f){o.push({fix:c,cumM:0});continue}if(u>30){o.push({fix:c,cumM:i});continue}let d=(c.timestamp-f.fix.timestamp)/1000,h=Ut(f.fix,c),x=Math.min(10,Math.max(3,f.fix.accuracy,c.accuracy));if(h<x)continue;if(i+=h,d>0&&h/d>=0.5)a+=d;o.push({fix:c,cumM:i})}let l=o[o.length-1],m=null,p=null;if(l&&n.at(-1).timestamp-l.fix.timestamp<=r*1000){let c=l.fix.timestamp-r*1000,f=o.find((h)=>h.fix.timestamp>=c)??l,u=l.cumM-f.cumM,d=(l.fix.timestamp-f.fix.timestamp)/1000;if(u>=20&&d>0)p=u/d,m=d/(u/1000)}return{distanceM:i,movingS:a,paceSPerKm:m,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:p,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function Mr(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 Cr(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var tt={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function Or(e){let t=e.location,n=e.intervalMs??3000,r=tt,o=null,i=()=>typeof document<"u"&&document.visibilityState==="hidden",a=0,s=null,l=Promise.resolve(),m=null,p=!1;function c(h){let x=l.then(h);return l=x.then(()=>{},()=>{}),x}function f(){if(s)return s;let h=a;return s=(async()=>{let x=await t.readRecording();if(h===a&&!p)r=et(x,e),e.onUpdate?.(r);return r})().finally(()=>{s=null}),s}function u(){if(d(),p)return;o=setInterval(()=>{if(!i())f().catch(()=>{})},n)}function d(){if(o)clearInterval(o);o=null}return{get stats(){return r},start(){return m=null,c(async()=>{if(await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),a++,r={...tt},!p)e.onUpdate?.(r);return u(),r})},attach(){return c(async()=>{let h=await t.getRecordingState();if(!h?.active)return null;if(await f().catch(()=>{}),!h.paused)u();return h})},pause(){return c(async()=>{await t.pauseRecording(),d(),await f().catch(()=>{})})},resume(){return c(async()=>{await t.resumeRecording(),u()})},stop(){if(m)return m;return m=c(async()=>{d(),a++;let x=(await t.stopRecording())?.locations??[];if(r=et(x,e),!p)e.onUpdate?.(r);return x}).catch((h)=>{throw m=null,h}),m},dispose(){p=!0,a++,d()},refresh:f}}function Ir(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Hr(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function _r(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function Dr(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 Fr=150;function zt(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 X(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Kr(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?X(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:X(n.map((s)=>s.latitude),0.5),longitude:X(n.map((s)=>s.longitude),0.5)};i=X(n.map((s)=>zt(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 $r(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 Z=new Set,nt=!1,J=null;function Yt(e){return e.isConnected&&e.getClientRects().length>0}function rt(){return[...Z].find((e)=>Yt(e.element))}function Q(){let e=rt(),t=Boolean(e);if(t===nt)return;if(nt=t,t)C.enable(e?.tintColor?{tintColor:e.tintColor}:{});else C.disable()}function jt(){let e=rt();if(!e){C.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>C.end())}function Wr(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};Z.add(n);let r=e.ownerDocument?.defaultView;if(!J){let o=C.onRefresh(jt),i=()=>Q();r?.addEventListener("stx:load",i),J=()=>{o(),r?.removeEventListener("stx:load",i)}}return Q(),r?.requestAnimationFrame?.(()=>Q()),()=>{if(Z.delete(n),Z.size===0)J?.(),J=null;Q()}}var Yr=0.5;function Gt(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 Vt(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 Xt(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function jr(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Gt(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let c=p;if(c.button!==void 0&&c.button!==0)return;if(c.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let f=a().find((u)=>u.name===e.detent())?.y??0;n={y:c.clientY,base:f,pointerId:c.pointerId},o=f,r=[{y:f,t:c.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(c.pointerId)}catch{}},l=(p)=>{if(!n)return;let c=p,f=n.base+c.clientY-n.y;o=f<0?-Xt(-f):f,r.push({y:o,t:c.timeStamp});while(r.length>2&&c.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let u=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/u))))},m=(p)=>{if(!n)return;let c=p;n=null;let f=r[0],u=Math.max(1,c.timeStamp-f.t),d=(o-f.y)/u;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Vt({y:o,velocity:d,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",m),p.addEventListener("pointercancel",m);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",m),p.removeEventListener("pointercancel",m)}}var ot=0,ve="";function Gr(e){let t=e.ownerDocument,n=[],r=e;while(r.parentElement&&r!==t.body){for(let a of Array.from(r.parentElement.children)){if(a===r||a.hasAttribute("inert")||a.hasAttribute("data-native-dialog"))continue;if(["SCRIPT","STYLE","TEMPLATE","LINK"].includes(a.tagName))continue;if(a.hasAttribute("data-native-sheet")&&a.getAttribute("aria-hidden")==="true")continue;a.setAttribute("inert",""),n.push(a)}r=r.parentElement}let o=t.documentElement;if(ot++===0)ve=o.style.overflow||"",o.style.overflow="hidden";let i=!1;return()=>{if(i)return;i=!0;for(let a of n)a.removeAttribute("inert");if(--ot===0)if(ve)o.style.overflow=ve;else o.style.removeProperty("overflow")}}function Vr(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()}}function Xr(e,t){let n=e.documentElement;if(!t){n.removeAttribute("data-native-sheet-card");return}let r=e.defaultView,o=(r?.scrollY??0)+(r?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(o)}px`),n.setAttribute("data-native-sheet-card","")}function Jt(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 Qt(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 Zt(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&&!Qt(r))return r}return null}function en(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 eo(e,t={}){let n=t.root??e.documentElement;B.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=Zt(e);if(p&&p!==r)r=p,B.setUnderPageColor(p);let c=en(e)?"light":"dark";if(c!==o)o=c,V.setStyle(c)},a=Ve((p)=>{Jt(n,p),i()}),s=e.defaultView,l=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;l?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let m=s?.matchMedia?.("(prefers-color-scheme: dark)");return m?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),m?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var no=64;var tn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,nn=/^(?:0|[1-9]\d*)$/;function at(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,m=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!tn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:m})}return{kinds:t,problems:n}}function U(e,t){return e.find((n)=>n.name===t)??null}function q(e,t,n){let r=U(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function rn(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(!nn.test(o))return null;let i=Number(o);return q(e,r,i)===t?{kind:r,slot:i}:null}function st(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function ro(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()),...st(at(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function lt(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${U(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function on(e,t,n,r,o=Date.now()){let i=U(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((d)=>d.kind===n),s=lt(e,n,r),l=a.find((d)=>d.itemId===r.id)??null,m=l?null:cn(a,i.slots),p=l||m!==null?null:un(a),c=l?.slot??m??p?.slot;if(c===void 0||c===null)return null;let f={kind:n,slot:c,itemId:r.id,title:s,donatedAt:o},u=t.filter((d)=>d.kind!==n||d.slot!==c&&d.itemId!==r.id);return{entries:ct(e,[...u,f]),entry:f,evicted:p,changed:!l||l.title!==s}}function an(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 sn(e,t,n){let r=rn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=U(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function ln(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:m,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||q(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let c=`${a}-slot-${s}`,f=`${a}#${l}`;if(n.has(c)||r.has(f))continue;n.set(c,{kind:a,slot:s,itemId:l,title:typeof m==="string"&&m.trim()?m:lt(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(f)}return ct(e,[...n.values()])}function ct(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 cn(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 un(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function dn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var pn="stacks_spotlight_index",fn=3000;function oo(e){let t=e.onProblem??((v)=>console.warn(`[spotlight] ${v}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:at(e.kinds);for(let v of n.problems)t(v);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??pn,i=e.legacyStorageKeys??[],a=e.timeoutMs??fn,s=e.now??(()=>Date.now()),l=e.bridge??dn,m=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function c(){if(m)return m;m=[];let v=p();if(!v)return m;try{let y=[o,...i].map((w)=>v.getItem(w)).find((w)=>w);m=y?ln(r,JSON.parse(y)):[]}catch{m=[]}return m}function f(v){m=v;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(v));for(let w of i)y.removeItem(w)}catch{}}async function u(v){if(!v)return null;let y;try{return await Promise.race([v,new Promise((w)=>{y=setTimeout(()=>w(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let d=Promise.resolve();function h(v){let y=d.then(v,v);return d=y.catch(()=>{return}),y}async function x(v,y){let w=l()?.register;if(!w||r.length===0)return!1;return h(async()=>{let k=on(r,c(),v,y,s()),O=k&&q(r,v,k.entry.slot);if(!k||!O)return!1;if(!k.changed)return f(k.entries),!0;let _=await u(w(k.entry.title,O))!==null;if(_)f(k.entries);return _})}async function H(v,y){let w=l()?.remove;if(!w)return!1;return h(async()=>{let{entries:k,removed:O}=an(c(),v,y);if(!O)return!1;let _=q(r,v,O.slot),yt=_?await u(w(_))!==null:!1;return f(k),yt})}async function bt(v,y){let w=U(r,v)?.slots;if(!w||!l()?.register)return 0;let k=0;for(let O of[...y].slice(0,w).reverse())if(await x(v,O))k++;return k}async function vt(){let v=l()?.remove;if(!v)return f([]),0;return h(async()=>{let y=0;for(let w of c()){let k=q(r,w.kind,w.slot);if(k&&await u(v(k))!==null)y++}return f([]),y})}return{kinds:r,index:x,sync:bt,remove:H,clear:vt,routeFor:(v)=>sn(r,c(),v),entries:()=>c(),activityTypes:(v)=>st(r).map((y)=>`${v}.${y}`),reset:()=>{m=null}}}var it=["craftShortcut","craftSiriShortcut"];function io(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 it)globalThis.addEventListener(r,n);return()=>{for(let r of it)globalThis.removeEventListener(r,n)}}import{tabBar as mn}from"craft-native/mobile";var gn=mn;function hn(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 bn(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 dt(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function vn(){return typeof dt()?.selectTab==="function"}function lo(e,t={}){let n=(r)=>{if(vn()||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 ut(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var ye="stacks:tab-bar-cover";function co(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(ye))}function uo(e,t={}){let n=t.api??gn;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar], [data-native-covers-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=ut(o?.getPropertyValue("--native-tab-active")||""),a=ut(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:f,selected:u}=bn(hn(e)),d=JSON.stringify({tabs:f,selected:u});if(d===s)return;let h=s&&s!=="hidden"?JSON.parse(s):null;if(h&&u&&JSON.stringify(h.tabs)===JSON.stringify(f))n.select(u);else n.set(f,{selected:u,tint:i,tintDark:a});s=d},m=typeof MutationObserver==="function"?new MutationObserver(l):null;m?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((f)=>{let u=dt();if(u?.selectTab){u.selectTab(f);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((h)=>h.getAttribute("href")===f)?.click()}),c=()=>l();if(typeof window<"u")window.addEventListener("stx:load",c),window.addEventListener("stx:screen-shown",c),window.addEventListener(ye,c);return l(),()=>{if(m?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",c),window.removeEventListener("stx:screen-shown",c),window.removeEventListener(ye,c);n.hide()}}var wn={isAvailable:()=>g(()=>xe.isAvailable()),getBiometricType:()=>g(()=>xe.getBiometricType()),authenticate:(e)=>g(()=>xe.authenticate(e))},An={takePicture:(e)=>g(()=>te.takePicture(e)),pickImage:()=>g(()=>te.pickImage()),pickMultiple:(e)=>g(()=>te.pickMultiple(e)),isAvailable:()=>g(()=>te.isAvailable())},kn={getInfo:()=>g(()=>N.getInfo()),getCapabilities:()=>g(()=>N.getCapabilities()),isMobile:()=>N.isMobile(),isIOS:()=>N.isIOS(),isAndroid:()=>N.isAndroid(),getLocale:()=>N.getLocale(),getTimezone:()=>N.getTimezone()},En=xn,Tn={getCurrentPosition:(e)=>g(()=>M.getCurrentPosition(e)),watchPosition:(e,t)=>M.watchPosition(e,t),clearWatch:(e)=>M.clearWatch(e),startRecording:(e)=>g(()=>M.startRecording(e)),pauseRecording:()=>g(()=>M.pauseRecording()),resumeRecording:()=>g(()=>M.resumeRecording()),stopRecording:()=>g(()=>M.stopRecording()),getRecordingState:()=>g(()=>M.getRecordingState()),readRecording:()=>g(()=>M.readRecording())},Ln={show:(e)=>g(()=>re.show(e)),schedule:(e)=>g(()=>re.schedule(e)),cancelAll:()=>g(()=>re.cancelAll()),setBadge:(e)=>g(()=>re.setBadge(e))},Rn={check:(e)=>g(()=>z.check(e)),request:(e)=>g(()=>z.request(e)),checkMultiple:(e)=>g(()=>z.checkMultiple(e)),requestMultiple:(e)=>g(()=>z.requestMultiple(e)),openSettings:()=>g(()=>z.openSettings())},Pn={set:(e,t)=>g(()=>oe.set(e,t)),get:(e)=>g(()=>oe.get(e)),delete:(e)=>g(()=>oe.delete(e)),clear:()=>g(()=>oe.clear())},Mn={share:(e)=>g(()=>gt.share(e)),isAvailable:()=>gt.isAvailable()},Cn={request:()=>g(()=>yn.request())},ae={impact:(e)=>Promise.resolve().then(()=>ne.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ne.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ne.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ne.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=T("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function ht(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 On={async getInitialURL(){if(!await I())return null;return ht(await pt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=pt.onLink?.((o,i)=>{let a=ht(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(le()?.craft)r();else I().then(r);return()=>{n=!0,t?.()}}},ho={isAvailable:()=>ie.isAvailable(),set:(e,t)=>ie.set(e,t),remove:(e)=>ie.remove(e),clear:()=>ie.clear()},Nn={enable:()=>g(()=>ft.enable()),disable:()=>g(()=>ft.disable())},In={isAvailable:()=>ee.isAvailable(),get:()=>g(()=>ee.get()),set:(e)=>g(()=>ee.set(e)),restore:()=>g(()=>ee.restore())},Hn={isAvailable:()=>R.isAvailable(),supports:(e)=>R.supports(e),getAuthorizationStatus:()=>g(()=>R.getAuthorizationStatus()),requestAuthorization:()=>g(()=>R.requestAuthorization()),getNowPlaying:()=>g(()=>R.getNowPlaying()),play:()=>g(()=>R.play()),pause:()=>g(()=>R.pause()),togglePlayPause:()=>g(()=>R.togglePlayPause()),skipToNext:()=>g(()=>R.skipToNext()),skipToPrevious:(e)=>g(()=>R.skipToPrevious(e)),onChange:(e)=>G(()=>R.onChange(e))},_n={isAvailable:()=>Ae.isAvailable(),speak:(e,t)=>g(()=>Ae.speak(e,t)),stop:()=>g(()=>Ae.stop())},Dn={getStatus:()=>g(()=>mt.getStatus()),onChange:(e)=>G(()=>mt.onChange(e))},Bn={register:()=>g(()=>we.register()),onToken:(e)=>we.onToken(e),onNotification:(e)=>G(()=>we.onNotification(e))},Fn={requestAuthorization:(e,t)=>g(()=>W.requestAuthorization(e,t)),getData:(e,t)=>g(()=>W.getData(e,t)),saveWorkout:(e)=>g(()=>W.saveWorkout(e)),getWorkouts:(e)=>g(()=>W.getWorkouts(e)),getDailyStatistics:(e,t)=>g(()=>W.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>b("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSleepIntervals:(e)=>b("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),supports:(e)=>T(`health.${e}`)!==null},Kn={start:(e)=>g(()=>Se.start(e)),update:(e)=>g(()=>Se.update(e)),end:()=>g(()=>Se.end())},$n={send:(e)=>g(()=>Y.send(e)),updateContext:(e)=>g(()=>Y.updateContext(e)),isReachable:()=>g(()=>Y.isReachable()),onMessage:(e)=>Y.onMessage(e),onReachabilityChange:(e)=>Y.onReachabilityChange(e)},bo=Sn;function le(){return S()}function se(){let e=le()?.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 ke(){return se()!==null}function qn(e=2000){if(ke()||ce())return Promise.resolve(!0);let t=le();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(ke())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Un(e){let t=le();if(!t)return()=>{};if(se()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!se())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Wn(e){await ae.impact("light");try{let t=await e();return await ae.notification("success"),t}catch(t){throw await ae.notification("error"),t}}var vo={get nativeBridge(){return se()},biometrics:wn,camera:An,device:kn,haptics:ae,lifecycle:En,location:Tn,notifications:Ln,permissions:Rn,secureStorage:Pn,share:Mn,appReview:Cn,deepLinks:On,keepAwake:Nn,brightness:In,music:Hn,speech:_n,network:Dn,pushNotifications:Bn,health:Fn,liveActivities:Kn,watchConnectivity:$n,dialog:D,contextMenu:ge,browser:De,symbols:Be,statusBar:V,chrome:B,refresh:C,background:F,clipboard:Fe,db:Ke,files:$e,shortcuts:qe,widgets:Ue,orientation:We,auth:ze,storeKit:Ye,isNativeMobile:ke,whenNative:qn,onReady:Un,withFeedback:Wn};export{zn as BRIDGE_WAIT_MS,Fr as INDOOR_CHECK_AFTER_S,no as MAX_SPOTLIGHT_SLOTS_PER_KIND,Pr as ROUTE_GAP_S,Yr as SHEET_FLICK_VELOCITY,ye as TAB_BAR_COVER_EVENT,g as afterBridge,Cn as appReview,Jt as applyAppearance,ze as auth,wr as backLabelFor,F as background,wn as biometrics,j as bridgePending,In as brightness,De as browser,b as callNative,An as camera,Ft as canGoBack,B as chrome,Fe as clipboard,Qn as confirmAction,ge as contextMenu,co as coverTabBar,S as craftHost,xt as craftRoot,Or as createRouteRecorder,oo as createSpotlightIndex,Ge as currentAppearance,Ke as db,$t as deepLinkPath,On as deepLinks,kn as device,D as dialog,Sr as enterNavTrail,$e as files,Ut as fixDistance,ir as focusSegment,Lr as followDeepLinks,se as getNativeMobileBridge,xr as goBack,Er as goBackToTabRoot,lo as handleTabReselect,ae as haptics,ce as hasNativeMobileHost,Fn as health,Kr as indoorVerdict,eo as installNativeChrome,ar as installPressables,ke as isNativeMobile,Yt as isShown,Nn as keepAwake,Dt as largeTitleMetrics,En as lifecycle,Vr as liftToBody,Kn as liveActivities,Tn as location,Gr as lockBackground,uo as mirrorTabBar,vo as mobile,Hn as music,At as nativeFunction,T as nativeFunctionNow,bn as nativeTabs,Ar as navTrail,Dn as network,Nt as normalizeAppearance,ht as normalizeDeepLinkURL,Ln as notifications,br as observeLargeTitle,nr as observeLongPress,Wr as observeNativeRefresh,Ht as observePageScroll,hr as observePullToRefresh,rr as observeSegmentScrub,jr as observeSheetDrag,Ve as onAppearance,fr as onBackgroundRefresh,P as onCraftEvent,dr as onMemoryWarning,Un as onMobileReady,ur as onResume,pr as onSilentPush,io as onSpotlightTap,We as orientation,Mr as paceLabel,Zt as pageBackground,en as pageIsDark,K as pageScrollTop,Hr as pauseSessionClock,Rn as permissions,Rt as placeMenu,on as placeSpotlightItem,Ce as presentActionSheet,Pe as presentAlert,ue as presentChoice,Me as presentConfirm,Oe as presentContextMenu,Xr as presentPageAsCard,kr as previousScreenPath,_t as pullDistance,Bn as pushNotifications,ln as readSpotlightEntries,at as readSpotlightKinds,hn as readTabLinks,C as refresh,an as removeSpotlightItem,vr as resolveScrollHost,_r as resumeSessionClock,et as routeStats,vn as routerHandlesTabs,Xt as rubberBand,Pn as secureStorage,Ot as segmentAt,or as segmentForKey,Dr as sessionClockElapsed,Vt as settleSheet,Mn as share,Gt as sheetStops,qe as shortcuts,Zn as showContextMenuFor,ho as snapshots,_n as speech,Cr as speedLabel,bo as splash,q as spotlightAction,st as spotlightActions,ro as spotlightActivityTypes,dn as spotlightBridge,U as spotlightKind,sn as spotlightRoute,rn as spotlightSlot,lt as spotlightTitle,Ir as startSessionClock,V as statusBar,Ye as storeKit,G as subscribeWhenReady,Be as symbols,gn as tabBar,me as toNativeRect,Tr as trailEntryFor,Lt as trapFocus,$r as typedDistanceKm,Wt as usableFixes,Jn as useActionSheet,$n as watchConnectivity,I as whenBridgeReady,qn as whenNativeMobile,Ue as widgets,Wn as withNativeFeedback};
package/dist/types.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare interface CraftMobileCapabilities {
22
22
  orientationLock?: boolean
23
23
  deepLinks?: boolean
24
24
  flashlight?: boolean
25
+ music?: boolean
25
26
  network?: boolean
26
27
  deviceInfo?: boolean
27
28
  badge?: boolean
@@ -68,6 +69,7 @@ export declare interface MobileApi {
68
69
  deepLinks: DeepLinksApi
69
70
  keepAwake: KeepAwakeApi
70
71
  brightness: BrightnessApi
72
+ music: MusicApi
71
73
  speech: SpeechApi
72
74
  network: NetworkApi
73
75
  pushNotifications: PushNotificationsApi
@@ -257,6 +259,43 @@ export declare interface SpeechApi {
257
259
  speak: (text: string, options?: SpeechOptions) => Promise<boolean>
258
260
  stop: () => Promise<void>
259
261
  }
262
+ /**
263
+ * What the Music app is playing. The song fields are null without access,
264
+ * with nothing queued, and while another app (Spotify, a podcast) plays; then
265
+ * `otherAudioPlaying` is true.
266
+ */
267
+ export declare interface NowPlaying {
268
+ available: boolean
269
+ authorization: MusicAuthorization
270
+ source: 'appleMusic' | 'simulated' | null
271
+ playbackState: MusicPlaybackState
272
+ isPlaying: boolean
273
+ itemId: string | null
274
+ title: string | null
275
+ artist: string | null
276
+ album: string | null
277
+ duration: number | null
278
+ position: number | null
279
+ artworkDataURL: string | null
280
+ otherAudioPlaying: boolean
281
+ timestamp: number
282
+ }
283
+ export declare interface MusicSkipOptions {
284
+ restartAfter?: number
285
+ }
286
+ export declare interface MusicApi {
287
+ isAvailable: () => boolean
288
+ supports: (method: MusicMethod) => boolean
289
+ getAuthorizationStatus: () => Promise<MusicAuthorization>
290
+ requestAuthorization: () => Promise<MusicAuthorization>
291
+ getNowPlaying: () => Promise<NowPlaying>
292
+ play: () => Promise<NowPlaying>
293
+ pause: () => Promise<NowPlaying>
294
+ togglePlayPause: () => Promise<NowPlaying>
295
+ skipToNext: () => Promise<NowPlaying>
296
+ skipToPrevious: (options?: MusicSkipOptions) => Promise<NowPlaying>
297
+ onChange: (callback: (nowPlaying: NowPlaying) => void) => () => void
298
+ }
260
299
  export declare interface DeepLinksApi {
261
300
  getInitialURL: () => Promise<string | null>
262
301
  onLink: (callback: (url: string, link?: { initial: boolean }) => void) => () => void
@@ -427,6 +466,10 @@ export type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restrict
427
466
  export type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris' | 'none';
428
467
  export type AppState = 'active' | 'inactive' | 'background';
429
468
  export type HapticKind = 'impact' | 'notification' | 'selection';
469
+ /** Whether the person has let the app see their music. `unavailable` off a phone. */
470
+ export type MusicAuthorization = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';
471
+ export type MusicPlaybackState = 'stopped' | 'playing' | 'paused' | 'interrupted' | 'seekingForward' | 'seekingBackward' | 'unknown';
472
+ export type MusicMethod = 'getAuthorizationStatus' | 'requestAuthorization' | 'getNowPlaying' | 'play' | 'pause' | 'togglePlayPause' | 'skipToNext' | 'skipToPrevious' | 'observe';
430
473
  export type HealthDataType = | 'steps'
431
474
  | 'heartRate'
432
475
  | 'activeEnergy'
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.152",
5
+ "version": "0.75.154",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -32,10 +32,10 @@
32
32
  "test": "bun test"
33
33
  },
34
34
  "dependencies": {
35
- "craft-native": ">=0.0.135"
35
+ "craft-native": ">=0.0.144"
36
36
  },
37
37
  "devDependencies": {
38
- "@stacksjs/build": "0.75.152",
38
+ "@stacksjs/build": "0.75.154",
39
39
  "better-dx": "^0.2.24"
40
40
  }
41
41
  }