@stacksjs/mobile 0.75.182 → 0.75.183

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
@@ -355,6 +355,37 @@ The phone-native behaviour a screen expects, kept out of STX templates:
355
355
  The framework's `NativeNavBar`, `NativePullToRefresh`, `NativeSegmentedControl`
356
356
  and `NativeSheet` components are built on these.
357
357
 
358
+ ## Sheets and the overlay stack
359
+
360
+ A bottom sheet's own behaviour lives here: `observeSheetDrag` (dragged by its
361
+ grabber or header between `medium` and `large` detents, flicked away),
362
+ `liftToBody` (out of the page's stacking contexts, before its content loads
363
+ media), `coverTabBar` and `presentPageAsCard`, which is counted, so the page
364
+ stays a card until the last large sheet lets go.
365
+
366
+ What every overlay shares is not here. Holding the page still and inert,
367
+ Escape for whichever layer is on top, the Tab trap and handing focus back are
368
+ stx's overlay stack (`openOverlay` / `closeOverlay` from
369
+ `@stacksjs/components/overlays`, the runtime's `window.stx.overlays`).
370
+ `NativeSheet` and the HTML stand-ins for alerts, action sheets and context
371
+ menus are layers on it, alongside `Dialog`, `Drawer` and `stxConfirm`, so a
372
+ confirmation opened from a sheet, or a sheet opened over a drawer, closes with
373
+ one Escape and leaves the layer under it up and locked. `lockBackground` and
374
+ `trapFocus`, which did this per sheet and fought the stack, are gone; an
375
+ overlay of your own joins the stack instead:
376
+
377
+ ```ts
378
+ import { closeOverlay, openOverlay } from '@stacksjs/components/overlays'
379
+
380
+ openOverlay('route-picker', { panel: () => panelEl, root: sheetEl, zIndex: 70, onEscape: close })
381
+ closeOverlay('route-picker')
382
+ ```
383
+
384
+ `root` is an element lifted into `<body>`: the rest of the page goes inert
385
+ behind it, and stays inert while a dialog opened inside it is on top. With
386
+ `zIndex`, a layer opened later draws above one opened earlier wherever the two
387
+ sit in the document.
388
+
358
389
  ## Native source ownership
359
390
 
360
391
  Stacks applications author TypeScript and STX. Craft distributes reusable Swift
package/dist/index.d.ts CHANGED
@@ -957,13 +957,6 @@ declare function rubberBand(overshoot: number, dimension?: number): number;
957
957
  * animates to wherever `onSettle` puts it.
958
958
  */
959
959
  declare function observeSheetDrag(options: SheetDragOptions): () => void;
960
- /**
961
- * Holds the page still and out of reach behind `keep`: everything outside it
962
- * becomes inert (no taps, no focus, hidden from VoiceOver) and the document
963
- * stops scrolling. Returns the release. Nested sheets count, so the page
964
- * scrolls again only once the last has closed.
965
- */
966
- declare function lockBackground(keep: HTMLElement): () => void;
967
960
  /**
968
961
  * Moves `element` to the end of the body, out of every stacking context and
969
962
  * transform on the way, and returns the way back: to where it was, or out of
@@ -972,8 +965,11 @@ declare function lockBackground(keep: HTMLElement): () => void;
972
965
  declare function liftToBody(element: HTMLElement): () => void;
973
966
  /**
974
967
  * The iOS card presentation: while a large sheet is up, the page behind it
975
- * shrinks back from the screen's edges, centred on what was in view. Undone by
976
- * calling it with `false`.
968
+ * shrinks back from the screen's edges, centred on what was in view.
969
+ *
970
+ * Counted: each call with `true` is let go by one with `false`, and the page
971
+ * stays a card until the last sheet that asked lets go, so a sheet closing
972
+ * over another large one does not flatten the page under it.
977
973
  */
978
974
  declare function presentPageAsCard(doc: Document, on: boolean): void;
979
975
  /** A flick faster than this (CSS pixels a millisecond) moves on to the next stop. */
@@ -994,17 +990,18 @@ declare interface SheetDragOptions {
994
990
  /**
995
991
  * What makes a bottom sheet behave like a UISheetPresentationController:
996
992
  * dragged by its grabber or header, flicked away, resting at a medium or a
997
- * large detent, and holding the page behind it still and out of reach.
993
+ * large detent, lifted out of the page and pressing it back into a card.
994
+ *
995
+ * Holding the page behind a sheet still and out of reach, Escape, the Tab
996
+ * trap and handing focus back are the stx overlay stack's
997
+ * (`@stacksjs/components/overlays`), which NativeSheet joins, so a sheet
998
+ * nests with dialogs, drawers and confirmations instead of competing with
999
+ * them.
998
1000
  */
999
1001
  type SheetDetent = 'medium' | 'large';
1000
1002
  type SheetSettle = SheetDetent | 'dismiss';
1001
1003
 
1002
1004
  // From: src/sheets.ts
1003
- /**
1004
- * Keeps Tab and Shift+Tab inside `container`: called from a keydown listener,
1005
- * it moves focus from one end to the other instead of out of it.
1006
- */
1007
- declare function trapFocus(container: HTMLElement, event: KeyboardEvent): void;
1008
1005
  /**
1009
1006
  * An alert or action sheet drawn in HTML. Resolves with the chosen action's
1010
1007
  * id, or null when it is dismissed or Cancel is chosen.
@@ -1961,6 +1958,6 @@ type HealthSleepStage = 'inBed' | 'awake' | 'asleep' | 'core' | 'deep' | 'rem';
1961
1958
  type HealthReadMethod = 'getWorkouts' | 'getDailyStatistics' | 'getHeartRateSamples' | 'getSleepIntervals' | 'saveMindfulSession' | 'getMindfulSessions'
1962
1959
  | 'startHeartRateUpdates' | 'stopHeartRateUpdates';
1963
1960
 
1964
- export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, 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, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod };
1961
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, presentChoice, presentAlert, presentConfirm, presentActionSheet, placeMenu, presentContextMenu, applyAppearance, pageBackground, pageIsDark, installNativeChrome, NativeChromeOptions, readSpotlightKinds, spotlightKind, spotlightAction, spotlightSlot, spotlightActions, spotlightActivityTypes, spotlightTitle, placeSpotlightItem, removeSpotlightItem, spotlightRoute, readSpotlightEntries, spotlightBridge, createSpotlightIndex, onSpotlightTap, MAX_SPOTLIGHT_SLOTS_PER_KIND, SpotlightKind, SpotlightKindInput, SpotlightItem, SpotlightEntry, SpotlightKindsResult, SpotlightPlacement, SpotlightBridge, SpotlightIndexOptions, SpotlightIndex, readTabLinks, nativeTabs, routerHandlesTabs, handleTabReselect, coverTabBar, mirrorTabBar, tabBar, TAB_BAR_COVER_EVENT, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod };
1965
1962
  export { NativeTab } from 'craft-native/mobile';
1966
1963
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as Dn,biometrics as Le,brightness as le,camera as ce,deepLinks as wt,device as _,haptics as ue,health as J,heartRate as w,keepAwake as kt,lifecycle as _n,liveActivities as Me,location as H,music as O,network as Et,notifications as de,permissions as Z,pushNotifications as Pe,secureStorage as pe,share as Rt,speech as Ce,snapshots as fe,splash as Fn,watchConnectivity as ee}from"craft-native/mobile";var ur=2500;function S(){if(typeof window>"u")return;return window}function be(){let e=S()?.craft;return e&&typeof e==="object"?e:void 0}function Mt(){return typeof navigator>"u"?"":navigator.userAgent||""}function U(){let e=S();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Mt())}function te(){let e=S();if(!e||e.craft)return!1;return U()||Boolean(e.webkit?.messageHandlers?.craft)}function F(e=15000){let t=S();if(t?.craft)return Promise.resolve(!0);if(!t||!te())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 Pt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function L(e){return Pt(be(),e)}async function Ct(e,t=2500){let n=L(e);if(n||!te())return n;return await F(t),L(e)}async function v(e,t,n,r={}){let o=await Ct(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function c(e,t=2500){if(te())await F(t);return e()}function D(e,t=2500){let n,r=!1;if(!te())n=e();else F(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 Ne="native-dialog-styles",Ot=`
1
+ import{appReview as Bn,biometrics as Le,brightness as le,camera as ce,deepLinks as wt,device as D,haptics as ue,health as J,heartRate as A,keepAwake as At,lifecycle as _n,liveActivities as Pe,location as H,music as O,network as kt,notifications as de,permissions as Z,pushNotifications as Me,secureStorage as pe,share as Rt,speech as Ce,snapshots as fe,splash as Dn,watchConnectivity as ee}from"craft-native/mobile";var cr=2500;function S(){if(typeof window>"u")return;return window}function be(){let e=S()?.craft;return e&&typeof e==="object"?e:void 0}function Lt(){return typeof navigator>"u"?"":navigator.userAgent||""}function q(){let e=S();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Lt())}function te(){let e=S();if(!e||e.craft)return!1;return q()||Boolean(e.webkit?.messageHandlers?.craft)}function F(e=15000){let t=S();if(t?.craft)return Promise.resolve(!0);if(!t||!te())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 Pt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function L(e){return Pt(be(),e)}async function Mt(e,t=2500){let n=L(e);if(n||!te())return n;return await F(t),L(e)}async function b(e,t,n,r={}){let o=await Mt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function c(e,t=2500){if(te())await F(t);return e()}function _(e,t=2500){let n,r=!1;if(!te())n=e();else F(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function M(e,t){let n=S();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var Ne="native-dialog-styles",Ct=`
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 Dn,biometrics as Le,brightness as le,camera as ce,deepLinks
52
52
  .native-dialog-group, .native-menu { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--native-dialog-solid, rgb(242 242 247)); }
53
53
  .dark .native-dialog-group, .dark .native-menu { background: var(--native-dialog-solid-dark, rgb(44 44 46)); }
54
54
  }
55
- `;function He(){return S()?.document}function Nt(e){if(e.getElementById(Ne))return;let t=e.createElement("style");t.id=Ne,t.textContent=Ot,(e.head??e.documentElement).appendChild(t)}var Ht=0;function E(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}var Ie='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function It(e,t){if(t.key!=="Tab")return;let n=Array.from(e.querySelectorAll(Ie));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 Be(e,t,n,r){Nt(e);let o=S(),i=e.activeElement,a=E(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(E(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,g=(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(),g(r());return}It(u,h)},u=n({root:a,settle:g});a.appendChild(u),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")}),(u.querySelector("[data-native-autofocus]")??u.querySelector(Ie))?.focus()})}function ve(e){let t=He();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Ht}`,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 Be(t,e.variant,({root:a,settle:s})=>{let l=(d)=>d.style==="cancel"?null:d.id,g=E(t,"div","native-dialog-panel");g.setAttribute("role","alertdialog"),g.setAttribute("aria-modal","true"),g.tabIndex=-1;let p=E(t,"div","native-dialog-group");if(e.title||e.message){let d=E(t,"div","native-dialog-header");if(e.title){let m=E(t,"p","native-dialog-title",e.title);m.id=`${n}-title`,d.appendChild(m),g.setAttribute("aria-labelledby",m.id)}if(e.message){let m=E(t,"p","native-dialog-message",e.message);m.id=`${n}-message`,d.appendChild(m),g.setAttribute("aria-describedby",m.id)}p.appendChild(d)}let u=E(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)u.classList.add("is-row");for(let d of o){let m=E(t,"button",`native-dialog-action${d.style==="destructive"?" is-destructive":""}${d.style==="cancel"?" is-cancel":""}`,d.title);m.type="button",m.setAttribute("data-action-id",d.id),m.addEventListener("click",()=>s(l(d))),u.appendChild(m)}if(p.appendChild(u),g.appendChild(p),i){let d=E(t,"div","native-dialog-group"),m=E(t,"button","native-dialog-action is-cancel",i.title);m.type="button",m.setAttribute("data-action-id",i.id),m.addEventListener("click",()=>s(null)),d.appendChild(m),g.appendChild(d)}let f=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")f?.addEventListener("click",()=>s(null));return g},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function De(e){await ve({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function _e(e){return await ve({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 Fe(e){return ve({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Bt(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,g=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:g,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function We(e){let t=He();if(!t?.body)return Promise.resolve(null);let n=S();return Be(t,"menu",({root:r,settle:o})=>{let i=E(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(E(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=E(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(E(t,"span","native-menu-label",a.title)),a.icon){let l=E(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=Bt(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 qe=()=>!0,T=()=>!1,C=()=>null;function Ke(){return S()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Ae(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 j={alert:(e)=>v("dialog.alert",[e],()=>De(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>v("dialog.confirm",[e],()=>_e(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Ae(e.anchor):void 0},n=await v("dialog.actionSheet",[t],()=>Fe(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function hr(){return(e)=>j.actionSheet(e)}async function br(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return j.confirm(e);return await j.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 we={show:async(e)=>{let t={title:e.title,anchor:Ae(e.anchor),items:e.items.map(({id:r,title:o,symbol:i,destructive:a,disabled:s})=>({id:r,title:o,symbol:i,destructive:a,disabled:s}))},n=await v("contextMenu.show",[t],()=>We(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function vr(e,t){return we.show({...t,anchor:Ae(e.getBoundingClientRect())})}function Dt(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 Ue={open:async(e,t={})=>{let n=await v("browser.open",[e,t],()=>Dt(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)}}},ye=new Map,Se=new Map;function $e(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var je={isAvailable:()=>L("symbols.image")!==null,image:(e,t={})=>{let n=$e(e,t),r=ye.get(n);if(r)return r;let o=v("symbols.image",[e,t],C).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,C).then((i)=>(Se.set(n,i),i));return ye.set(n,o),o},cached:(e,t={})=>Se.get($e(e,t)),clearCache:()=>{ye.clear(),Se.clear()}},ne={setStyle:(e)=>v("statusBar.setStyle",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},Y={setUnderPageColor:(e)=>v("chrome.setUnderPageColor",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>v("chrome.setKeyboardAccessory",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},I={isAvailable:()=>L("refresh.enable")!==null,enable:(e)=>v("refresh.enable",[e??{}],T,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>v("refresh.disable",[],T,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>v("refresh.end",[],T,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>P("craftRefresh",()=>e())},G={complete:(e)=>v("background.complete",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},Ye={write:(e)=>v("clipboard.write",[e],async()=>{let t=Ke()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(qe,T)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>v("clipboard.read",[],async()=>{let e=Ke()?.clipboard;if(!e?.readText)return null;return e.readText().catch(C)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},Ge={isAvailable:()=>L("db.query")!==null,query:(e,t=[])=>v("db.query",[e,t],C).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>v("db.execute",[e,t],C).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 xe(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 _t(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 Ve={openPDF:(e,t=0)=>v("openPDF",[e,t],()=>{let n=S();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>v("takeScreenshot",[],C,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>v("scanQRCode",[],C).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},C),pickFile:(e=[])=>v("pickFile",[e],()=>_t(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}},C),saveFile:(e,t,n)=>v("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return xe(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=xe(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>v("downloadFile",[e,t],()=>xe(e,t)).then((n)=>typeof n==="string"?n:null)},Xe={set:(e)=>v("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],T).then((t)=>t!==!1),clear:()=>v("shortcuts.clear",[],T).then((e)=>e!==!1),onShortcut:(e)=>P("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},Qe={update:(e)=>v("widget.update",[e],T).then((t)=>t!==!1),reload:()=>v("widget.reload",[],T).then((e)=>e!==!1)},Ft={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function ze(){return S()?.screen?.orientation}var Je={lock:(e)=>v("lockOrientation",[e],()=>{let t=ze();return t?.lock?t.lock(Ft[e]).then(qe,T):!1}).then((t)=>t!==!1),unlock:()=>v("unlockOrientation",[],()=>(ze()?.unlock?.(),!0)).then((e)=>e!==!1)},Ze={signInWithApple:(e={})=>v("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],C).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},et={isAvailable:()=>L("iap.purchase")!==null,products:(e)=>v("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>v("iap.purchase",[e],C).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>v("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};var Wt=["authorized","denied","notDetermined","restricted","unsupported"];function re(){let e=be(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function Kt(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function tt(e){return Wt.includes(e)?e:"unsupported"}function $t(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function W(e,t,...n){return c(async()=>{let r=re();if(typeof r?.[e]!=="function")throw Kt();return t(await r[e](...n))})}var nt={isAvailable:()=>typeof re()?.isSupported==="function",supports:(e)=>typeof re()?.[e]==="function",isSupported:()=>c(async()=>{let e=re();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>W("authorization",tt),requestAuthorization:()=>W("requestAuthorization",tt),list:()=>W("list",(e)=>Array.isArray(e)?e.map($t).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return W("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>W("remove",(t)=>t===!0,e),removeAll:()=>W("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function wr(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 d=f;if(d.button!==void 0&&d.button!==0)return;a=!1,i={x:d.clientX,y:d.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},g=(f)=>{if(!i)return;let d=f;if(Math.hypot(d.clientX-i.x,d.clientY-i.y)>r)s()},p=(f)=>{if(!a)return;a=!1,f.preventDefault(),f.stopPropagation()},u=(f)=>f.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",g),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",u),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",g),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",u)}}function zt(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 kr(e,t){let n=null,r=null,o=!1,i=0,a=(d)=>{let m=e.getBoundingClientRect();return zt(d,{left:m.left+2,width:m.width-4},t.count())},s=(d)=>{let m=d;if(m.button!==void 0&&m.button!==0)return;let h=a(m.clientX);if(h!==t.selected())return;n=h,i=h,o=!1,r=m.pointerId;try{e.setPointerCapture?.(m.pointerId)}catch{}t.onPress?.(!0)},l=(d)=>{if(n===null)return;let m=a(d.clientX);if(m===i)return;o=!0,i=m,t.onScrub(m)},g=(d)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),d&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},p=(d)=>{if(!o)return;o=!1,d.preventDefault(),d.stopPropagation()},u=()=>g(!0),f=()=>g(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",f),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",f),e.removeEventListener("click",p,!0)}}function Er(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 Tr(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=L("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as qt}from"@bughq/sdk";import{crashReporter as K}from"craft-native/mobile";var M=null;function Ut(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function rt(){return K.isAvailable()}function jt(e){return async(t)=>{if(!rt())return!e;return K.capture(t)}}var Or={start(e={}){if(M)return M;let t=U()||rt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return M=new qt({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?jt(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!Ut(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)K.addBreadcrumb(i);return i}}),M},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);M?.setUser(t===null?null:{id:t}),await K.setUser(t)},capture(e,t){M?.captureException(e,t)},addBreadcrumb(e){if(M)M.addBreadcrumb(e);else K.addBreadcrumb(e)},async flush(){await Promise.all([M?.flush(),K.flush()])},client(){return M},stop(){M?.close(),M=null}};function ke(e){let t=S();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function ot(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function it(){let e=S()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:ot(e?.getAttribute("data-craft-reduce-motion"))||ke("(prefers-reduced-motion: reduce)"),reduceTransparency:ot(e?.getAttribute("data-craft-reduce-transparency"))||ke("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||ke("(prefers-color-scheme: dark)")?"dark":"light"}}function Yt(e){let t=it(),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 at(e,t={}){if(t.immediate!==!1)e(it());return P("craftAppearance",(n)=>e(Yt(n)))}function Br(e){return P("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function Dr(e){return P("craftMemoryWarning",()=>e())}function st(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>G.complete(!0),()=>G.complete(!1))}}function _r(e){let t=st(e);return P("craftSilentPush",(n)=>t(n.payload??{}))}function Fr(e){let t=st(()=>e());return P("craftBackgroundRefresh",()=>t(void 0))}import{haptics as Gt}from"craft-native/mobile";function Ee(){if(typeof window>"u")return;return window}function V(e=Ee()){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 Vt(e,t=Ee()){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(V(t))})};return e(V(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function Xt(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 $r(e){let t=e.host??Ee();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,-V(t)))})},g=(h)=>{let k=s!==null;if(s=h,k)return;a(()=>{if(s!==null)l(s)})},p=(h)=>{let k=h.touches?.[0];return k?k.clientY:null},u=(h)=>{if(i||V(t)>0)return;r=p(h),o=!1},f=(h)=>{if(r===null)return;let k=p(h);if(k===null)return;let N=Xt(V(t),k-r);if(!o&&N>=n)o=!0,Promise.resolve(Gt.impact("medium")).catch(()=>{});else if(o&&N<n*0.8)o=!1;g(N)},d=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)}},m=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchmove",f,{passive:!0}),t.addEventListener("touchend",d),t.addEventListener("touchcancel",m),()=>{s=null,t.removeEventListener("touchstart",u),t.removeEventListener("touchmove",f),t.removeEventListener("touchend",d),t.removeEventListener("touchcancel",m)}}function Qt(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 zr(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Vt((o)=>{let i=Qt(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 qr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function ut(){if(typeof window>"u")return;return window}var lt="__stxPushed",Jt="__stxScroll";function Zt(e=ut()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(lt in n)return n[lt]===!0;return!(Jt in n)}function jr(e=ut()){if(!Zt(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 Gr(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function Vr(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function en(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Xr(){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 en(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Qr(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 Jr(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function tn(e,t=nn()){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 nn(){if(typeof window>"u")return;return window.location?.origin}var ct="stacks-mobile-deep-link";function Zr(e,t){let n=(r)=>{let o=tn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(ct)===r)return;sessionStorage.setItem(ct,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var to=5000;function rn(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let p=i+a>>1;if(r[p].timestamp<o.timestamp)i=p+1;else a=p}let s=r[i],l=r[i-1],g=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!g||Math.abs(g.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(g.bpm)}})}var on=6371008.8,an=30,sn=an;function ln(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*on*Math.asin(Math.min(1,Math.sqrt(i)))}function cn(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 dt(e,t={}){let n=cn(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let u of n){let f=o[o.length-1],d=s?(u.timestamp-s.timestamp)/1000:0;if(s=u,!f){o.push({fix:u,cumM:0});continue}if(d>sn){o.push({fix:u,cumM:i});continue}let m=(u.timestamp-f.fix.timestamp)/1000,h=ln(f.fix,u),k=Math.min(10,Math.max(3,f.fix.accuracy,u.accuracy));if(h<k)continue;if(i+=h,m>0&&h/m>=0.5)a+=m;o.push({fix:u,cumM:i})}let l=o[o.length-1],g=null,p=null;if(l&&n.at(-1).timestamp-l.fix.timestamp<=r*1000){let u=l.fix.timestamp-r*1000,f=o.find((h)=>h.fix.timestamp>=u)??l,d=l.cumM-f.cumM,m=(l.fix.timestamp-f.fix.timestamp)/1000;if(d>=20&&m>0)p=d/m,g=m/(d/1000)}return{distanceM:i,movingS:a,paceSPerKm:g,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 no(e){if(e==null||e<=0||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function ro(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var pt={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function oo(e){let t=e.location,n=e.intervalMs??3000,r=pt,o=null,i=e.heartRate,a=!1,s=[],l=()=>typeof document<"u"&&document.visibilityState==="hidden",g=0,p=null,u=Promise.resolve(),f=null,d=!1;function m(x){let b=u.then(x);return u=b.then(()=>{},()=>{}),b}function h(){if(p)return p;let x=g;return p=(async()=>{let b=await t.readRecording();if(x===g&&!d)r=dt(b,e),e.onUpdate?.(r);return r})().finally(()=>{p=null}),p}function k(){if(N(),d)return;o=setInterval(()=>{if(!l())h().catch(()=>{})},n)}function N(){if(o)clearInterval(o);o=null}async function z(x){if(!i||!a)return;await x(i).catch(()=>{})}return{get stats(){return r},get heartRate(){return s},start(){return f=null,m(async()=>{if(await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),s=[],a=!!i?.isAvailable(),await z((x)=>x.startRecording()),g++,r={...pt},!d)e.onUpdate?.(r);return k(),r})},attach(){return m(async()=>{let x=await t.getRecordingState();if(!x?.active)return null;if(i?.isAvailable())a=!!(await i.getRecordingState().catch(()=>null))?.active;if(await h().catch(()=>{}),!x.paused)k();return x})},pause(){return m(async()=>{await t.pauseRecording(),await z((x)=>x.pauseRecording()),N(),await h().catch(()=>{})})},resume(){return m(async()=>{await t.resumeRecording(),await z((x)=>x.resumeRecording()),k()})},stop(){if(f)return f;return f=m(async()=>{N(),g++;let b=(await t.stopRecording())?.locations??[];if(i&&a){let y=await i.stopRecording().catch(()=>null);a=!1,s=y?.samples??[],b=rn(b,s)}if(r=dt(b,e),!d)e.onUpdate?.(r);return b}).catch((x)=>{throw f=null,x}),f},dispose(){d=!0,g++,N()},refresh:h}}function ao(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function so(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function lo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function co(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var po=150;function un(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 oe(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function fo(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?oe(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:oe(n.map((s)=>s.latitude),0.5),longitude:oe(n.map((s)=>s.longitude),0.5)};i=oe(n.map((s)=>un(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 mo(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 se=new Set,ft=!1,ie=null;function dn(e){return e.isConnected&&e.getClientRects().length>0}function mt(){return[...se].find((e)=>dn(e.element))}function ae(){let e=mt(),t=Boolean(e);if(t===ft)return;if(ft=t,t)I.enable(e?.tintColor?{tintColor:e.tintColor}:{});else I.disable()}function pn(){let e=mt();if(!e){I.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>I.end())}function bo(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};se.add(n);let r=e.ownerDocument?.defaultView;if(!ie){let o=I.onRefresh(pn),i=()=>ae();r?.addEventListener("stx:load",i),ie=()=>{o(),r?.removeEventListener("stx:load",i)}}return ae(),r?.requestAnimationFrame?.(()=>ae()),()=>{if(se.delete(n),se.size===0)ie?.(),ie=null;ae()}}var yo=0.5;function fn(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 mn(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 gn(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function So(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>fn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let u=p;if(u.button!==void 0&&u.button!==0)return;if(u.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let f=a().find((d)=>d.name===e.detent())?.y??0;n={y:u.clientY,base:f,pointerId:u.pointerId},o=f,r=[{y:f,t:u.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(u.pointerId)}catch{}},l=(p)=>{if(!n)return;let u=p,f=n.base+u.clientY-n.y;o=f<0?-gn(-f):f,r.push({y:o,t:u.timeStamp});while(r.length>2&&u.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let d=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/d))))},g=(p)=>{if(!n)return;let u=p;n=null;let f=r[0],d=Math.max(1,u.timeStamp-f.t),m=(o-f.y)/d;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(mn({y:o,velocity:m,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",g),p.addEventListener("pointercancel",g);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",g),p.removeEventListener("pointercancel",g)}}var gt=0,Re="";function xo(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(gt++===0)Re=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(--gt===0)if(Re)o.style.overflow=Re;else o.style.removeProperty("overflow")}}function Ao(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 wo(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 hn(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 bn(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 vn(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&&!bn(r))return r}return null}function yn(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 To(e,t={}){let n=t.root??e.documentElement;Y.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=vn(e);if(p&&p!==r)r=p,Y.setUnderPageColor(p);let u=yn(e)?"light":"dark";if(u!==o)o=u,ne.setStyle(u)},a=at((p)=>{hn(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 g=s?.matchMedia?.("(prefers-color-scheme: dark)");return g?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),g?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var Mo=64;var Sn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,xn=/^(?:0|[1-9]\d*)$/;function bt(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,g=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Sn.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:g})}return{kinds:t,problems:n}}function Q(e,t){return e.find((n)=>n.name===t)??null}function X(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 An(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(!xn.test(o))return null;let i=Number(o);return X(e,r,i)===t?{kind:r,slot:i}:null}function vt(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function Po(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()),...vt(bt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function yt(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 wn(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((m)=>m.kind===n),s=yt(e,n,r),l=a.find((m)=>m.itemId===r.id)??null,g=l?null:Tn(a,i.slots),p=l||g!==null?null:Ln(a),u=l?.slot??g??p?.slot;if(u===void 0||u===null)return null;let f={kind:n,slot:u,itemId:r.id,title:s,donatedAt:o},d=t.filter((m)=>m.kind!==n||m.slot!==u&&m.itemId!==r.id);return{entries:St(e,[...d,f]),entry:f,evicted:p,changed:!l||l.title!==s}}function kn(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 En(e,t,n){let r=An(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 Rn(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:g,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||X(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let u=`${a}-slot-${s}`,f=`${a}#${l}`;if(n.has(u)||r.has(f))continue;n.set(u,{kind:a,slot:s,itemId:l,title:typeof g==="string"&&g.trim()?g:yt(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(f)}return St(e,[...n.values()])}function St(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 Tn(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 Ln(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Mn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var Pn="stacks_spotlight_index",Cn=3000;function Co(e){let t=e.onProblem??((b)=>console.warn(`[spotlight] ${b}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:bt(e.kinds);for(let b of n.problems)t(b);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??Pn,i=e.legacyStorageKeys??[],a=e.timeoutMs??Cn,s=e.now??(()=>Date.now()),l=e.bridge??Mn,g=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function u(){if(g)return g;g=[];let b=p();if(!b)return g;try{let y=[o,...i].map((A)=>b.getItem(A)).find((A)=>A);g=y?Rn(r,JSON.parse(y)):[]}catch{g=[]}return g}function f(b){g=b;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(b));for(let A of i)y.removeItem(A)}catch{}}async function d(b){if(!b)return null;let y;try{return await Promise.race([b,new Promise((A)=>{y=setTimeout(()=>A(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let m=Promise.resolve();function h(b){let y=m.then(b,b);return m=y.catch(()=>{return}),y}async function k(b,y){let A=l()?.register;if(!A||r.length===0)return!1;return h(async()=>{let R=wn(r,u(),b,y,s()),B=R&&X(r,b,R.entry.slot);if(!R||!B)return!1;if(!R.changed)return f(R.entries),!0;let q=await d(A(R.entry.title,B))!==null;if(q)f(R.entries);return q})}async function N(b,y){let A=l()?.remove;if(!A)return!1;return h(async()=>{let{entries:R,removed:B}=kn(u(),b,y);if(!B)return!1;let q=X(r,b,B.slot),Lt=q?await d(A(q))!==null:!1;return f(R),Lt})}async function z(b,y){let A=Q(r,b)?.slots;if(!A||!l()?.register)return 0;let R=0;for(let B of[...y].slice(0,A).reverse())if(await k(b,B))R++;return R}async function x(){let b=l()?.remove;if(!b)return f([]),0;return h(async()=>{let y=0;for(let A of u()){let R=X(r,A.kind,A.slot);if(R&&await d(b(R))!==null)y++}return f([]),y})}return{kinds:r,index:k,sync:z,remove:N,clear:x,routeFor:(b)=>En(r,u(),b),entries:()=>u(),activityTypes:(b)=>vt(r).map((y)=>`${b}.${y}`),reset:()=>{g=null}}}var ht=["craftShortcut","craftSiriShortcut"];function Oo(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 ht)globalThis.addEventListener(r,n);return()=>{for(let r of ht)globalThis.removeEventListener(r,n)}}import{tabBar as On}from"craft-native/mobile";var Nn=On;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 In(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 At(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function Bn(){return typeof At()?.selectTab==="function"}function Io(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 xt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Te="stacks:tab-bar-cover";function Bo(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(Te))}function Do(e,t={}){let n=t.api??Nn;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=xt(o?.getPropertyValue("--native-tab-active")||""),a=xt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:f,selected:d}=In(Hn(e)),m=JSON.stringify({tabs:f,selected:d});if(m===s)return;let h=s&&s!=="hidden"?JSON.parse(s):null;if(h&&d&&JSON.stringify(h.tabs)===JSON.stringify(f))n.select(d);else n.set(f,{selected:d,tint:i,tintDark:a});s=m},g=typeof MutationObserver==="function"?new MutationObserver(l):null;g?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((f)=>{let d=At();if(d?.selectTab){d.selectTab(f);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((h)=>h.getAttribute("href")===f)?.click()}),u=()=>l();if(typeof window<"u")window.addEventListener("stx:load",u),window.addEventListener("stx:screen-shown",u),window.addEventListener(Te,u);return l(),()=>{if(g?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",u),window.removeEventListener("stx:screen-shown",u),window.removeEventListener(Te,u);n.hide()}}var Wn={isAvailable:()=>c(()=>Le.isAvailable()),getBiometricType:()=>c(()=>Le.getBiometricType()),authenticate:(e)=>c(()=>Le.authenticate(e))},Kn={takePicture:(e)=>c(()=>ce.takePicture(e)),pickImage:()=>c(()=>ce.pickImage()),pickMultiple:(e)=>c(()=>ce.pickMultiple(e)),isAvailable:()=>c(()=>ce.isAvailable())},$n={getInfo:()=>c(()=>_.getInfo()),getCapabilities:()=>c(()=>_.getCapabilities()),isMobile:()=>_.isMobile(),isIOS:()=>_.isIOS(),isAndroid:()=>_.isAndroid(),getLocale:()=>_.getLocale(),getTimezone:()=>_.getTimezone()},zn=_n,qn={getCurrentPosition:(e)=>c(()=>H.getCurrentPosition(e)),watchPosition:(e,t)=>H.watchPosition(e,t),clearWatch:(e)=>H.clearWatch(e),startRecording:(e)=>c(()=>H.startRecording(e)),pauseRecording:()=>c(()=>H.pauseRecording()),resumeRecording:()=>c(()=>H.resumeRecording()),stopRecording:()=>c(()=>H.stopRecording()),getRecordingState:()=>c(()=>H.getRecordingState()),readRecording:()=>c(()=>H.readRecording())},Un={show:(e)=>c(()=>de.show(e)),schedule:(e)=>c(()=>de.schedule(e)),cancelAll:()=>c(()=>de.cancelAll()),setBadge:(e)=>c(()=>de.setBadge(e))},jn={check:(e)=>c(()=>Z.check(e)),request:(e)=>c(()=>Z.request(e)),checkMultiple:(e)=>c(()=>Z.checkMultiple(e)),requestMultiple:(e)=>c(()=>Z.requestMultiple(e)),openSettings:()=>c(()=>Z.openSettings())},Yn={set:(e,t)=>c(()=>pe.set(e,t)),get:(e)=>c(()=>pe.get(e)),delete:(e)=>c(()=>pe.delete(e)),clear:()=>c(()=>pe.clear())},Gn={share:(e)=>c(()=>Rt.share(e)),isAvailable:()=>Rt.isAvailable()},Vn={request:()=>c(()=>Dn.request())},me={impact:(e)=>Promise.resolve().then(()=>ue.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ue.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ue.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ue.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=L("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function Tt(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 Xn={async getInitialURL(){if(!await F())return null;return Tt(await wt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=wt.onLink?.((o,i)=>{let a=Tt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(he()?.craft)r();else F().then(r);return()=>{n=!0,t?.()}}},zo={isAvailable:()=>fe.isAvailable(),set:(e,t)=>fe.set(e,t),remove:(e)=>fe.remove(e),clear:()=>fe.clear()},Qn={enable:()=>c(()=>kt.enable()),disable:()=>c(()=>kt.disable())},Jn={isAvailable:()=>le.isAvailable(),get:()=>c(()=>le.get()),set:(e)=>c(()=>le.set(e)),restore:()=>c(()=>le.restore())},Zn={isAvailable:()=>O.isAvailable(),supports:(e)=>O.supports(e),getAuthorizationStatus:()=>c(()=>O.getAuthorizationStatus()),requestAuthorization:()=>c(()=>O.requestAuthorization()),getNowPlaying:()=>c(()=>O.getNowPlaying()),play:()=>c(()=>O.play()),pause:()=>c(()=>O.pause()),togglePlayPause:()=>c(()=>O.togglePlayPause()),skipToNext:()=>c(()=>O.skipToNext()),skipToPrevious:(e)=>c(()=>O.skipToPrevious(e)),onChange:(e)=>D(()=>O.onChange(e))},er={isAvailable:()=>w.isAvailable(),supports:(e)=>w.supports(e),getState:()=>c(()=>w.getState()),requestAuthorization:()=>c(()=>w.requestAuthorization()),scan:(e)=>c(()=>w.scan(e)),stopScan:()=>c(()=>w.stopScan()),getDevices:()=>c(()=>w.getDevices()),connect:(e)=>c(()=>w.connect(e)),reconnect:()=>c(()=>w.reconnect()),disconnect:(e)=>c(()=>w.disconnect(e)),startRecording:()=>c(()=>w.startRecording()),pauseRecording:()=>c(()=>w.pauseRecording()),resumeRecording:()=>c(()=>w.resumeRecording()),stopRecording:()=>c(()=>w.stopRecording()),getRecordingState:()=>c(()=>w.getRecordingState()),readRecording:(e)=>c(()=>w.readRecording(e)),onReading:(e)=>D(()=>w.onReading(e)),onDevice:(e)=>D(()=>w.onDevice(e)),onState:(e)=>D(()=>w.onState(e))},tr={isAvailable:()=>Ce.isAvailable(),speak:(e,t)=>c(()=>Ce.speak(e,t)),stop:()=>c(()=>Ce.stop())},nr={getStatus:()=>c(()=>Et.getStatus()),onChange:(e)=>D(()=>Et.onChange(e))},rr={register:()=>c(()=>Pe.register()),onToken:(e)=>Pe.onToken(e),onNotification:(e)=>D(()=>Pe.onNotification(e))},or={requestAuthorization:(e,t)=>c(()=>J.requestAuthorization(e,t)),getData:(e,t)=>c(()=>J.getData(e,t)),saveWorkout:(e)=>c(()=>J.saveWorkout(e)),getWorkouts:(e)=>c(()=>J.getWorkouts(e)),getDailyStatistics:(e,t)=>c(()=>J.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>v("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSleepIntervals:(e)=>v("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>v("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>v("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>v("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>v("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>P("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>L(`health.${e}`)!==null},ir={start:(e)=>c(()=>Me.start(e)),update:(e)=>c(()=>Me.update(e)),end:()=>c(()=>Me.end())},ar={send:(e)=>c(()=>ee.send(e)),updateContext:(e)=>c(()=>ee.updateContext(e)),isReachable:()=>c(()=>ee.isReachable()),onMessage:(e)=>ee.onMessage(e),onReachabilityChange:(e)=>ee.onReachabilityChange(e)},qo=Fn;function he(){return S()}function ge(){let e=he()?.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 Oe(){return ge()!==null}function sr(e=2000){if(Oe()||U())return Promise.resolve(!0);let t=he();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(Oe())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function lr(e){let t=he();if(!t)return()=>{};if(ge()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!ge())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function cr(e){await me.impact("light");try{let t=await e();return await me.notification("success"),t}catch(t){throw await me.notification("error"),t}}var Uo={get nativeBridge(){return ge()},biometrics:Wn,camera:Kn,device:$n,haptics:me,lifecycle:zn,location:qn,notifications:Un,permissions:jn,secureStorage:Yn,share:Gn,appReview:Vn,deepLinks:Xn,keepAwake:Qn,brightness:Jn,music:Zn,heartRate:er,scheduledWorkouts:nt,speech:tr,network:nr,pushNotifications:rr,health:or,liveActivities:ir,watchConnectivity:ar,dialog:j,contextMenu:we,browser:Ue,symbols:je,statusBar:ne,chrome:Y,refresh:I,background:G,clipboard:Ye,db:Ge,files:Ve,shortcuts:Xe,widgets:Qe,orientation:Je,auth:Ze,storeKit:et,isNativeMobile:Oe,whenNative:sr,onReady:lr,withFeedback:cr};export{ur as BRIDGE_WAIT_MS,to as HEART_RATE_MATCH_MS,po as INDOOR_CHECK_AFTER_S,Mo as MAX_SPOTLIGHT_SLOTS_PER_KIND,an as ROUTE_GAP_S,yo as SHEET_FLICK_VELOCITY,Te as TAB_BAR_COVER_EVENT,c as afterBridge,Vn as appReview,hn as applyAppearance,rn as attachHeartRate,Ze as auth,Gr as backLabelFor,G as background,Wn as biometrics,te as bridgePending,Jn as brightness,Ue as browser,v as callNative,Kn as camera,Zt as canGoBack,Y as chrome,Ye as clipboard,br as confirmAction,we as contextMenu,Bo as coverTabBar,S as craftHost,be as craftRoot,Or as crashReporting,oo as createRouteRecorder,Co as createSpotlightIndex,it as currentAppearance,Ge as db,tn as deepLinkPath,Xn as deepLinks,$n as device,j as dialog,Yr as enterNavTrail,Ve as files,ln as fixDistance,Rr as focusSegment,Zr as followDeepLinks,ge as getNativeMobileBridge,jr as goBack,Qr as goBackToTabRoot,Io as handleTabReselect,me as haptics,U as hasNativeMobileHost,or as health,er as heartRate,fo as indoorVerdict,To as installNativeChrome,Tr as installPressables,Oe as isNativeMobile,dn as isShown,Qn as keepAwake,Ut as keepBreadcrumb,Qt as largeTitleMetrics,zn as lifecycle,Ao as liftToBody,ir as liveActivities,qn as location,xo as lockBackground,Do as mirrorTabBar,Uo as mobile,Zn as music,Ct as nativeFunction,L as nativeFunctionNow,In as nativeTabs,Vr as navTrail,nr as network,Yt as normalizeAppearance,Tt as normalizeDeepLinkURL,$t as normalizeScheduledWorkout,Un as notifications,zr as observeLargeTitle,wr as observeLongPress,bo as observeNativeRefresh,Vt as observePageScroll,$r as observePullToRefresh,kr as observeSegmentScrub,So as observeSheetDrag,at as onAppearance,Fr as onBackgroundRefresh,P as onCraftEvent,Dr as onMemoryWarning,lr as onMobileReady,Br as onResume,_r as onSilentPush,Oo as onSpotlightTap,Je as orientation,no as paceLabel,vn as pageBackground,yn as pageIsDark,V as pageScrollTop,so as pauseSessionClock,jn as permissions,Bt as placeMenu,wn as placeSpotlightItem,Fe as presentActionSheet,De as presentAlert,ve as presentChoice,_e as presentConfirm,We as presentContextMenu,wo as presentPageAsCard,Xr as previousScreenPath,Xt as pullDistance,rr as pushNotifications,Rn as readSpotlightEntries,bt as readSpotlightKinds,Hn as readTabLinks,I as refresh,kn as removeSpotlightItem,qr as resolveScrollHost,lo as resumeSessionClock,dt as routeStats,Bn as routerHandlesTabs,gn as rubberBand,nt as scheduledWorkouts,Kt as scheduledWorkoutsUnsupported,Yn as secureStorage,zt as segmentAt,Er as segmentForKey,co as sessionClockElapsed,mn as settleSheet,Gn as share,fn as sheetStops,Xe as shortcuts,vr as showContextMenuFor,zo as snapshots,tr as speech,ro as speedLabel,qo as splash,X as spotlightAction,vt as spotlightActions,Po as spotlightActivityTypes,Mn as spotlightBridge,Q as spotlightKind,En as spotlightRoute,An as spotlightSlot,yt as spotlightTitle,ao as startSessionClock,ne as statusBar,et as storeKit,D as subscribeWhenReady,je as symbols,Nn as tabBar,Ae as toNativeRect,Jr as trailEntryFor,It as trapFocus,mo as typedDistanceKm,cn as usableFixes,hr as useActionSheet,ar as watchConnectivity,F as whenBridgeReady,sr as whenNativeMobile,Qe as widgets,cr as withNativeFeedback};
55
+ `;function Ie(){return S()?.document}function Ot(e){if(e.getElementById(Ne))return;let t=e.createElement("style");t.id=Ne,t.textContent=Ct,(e.head??e.documentElement).appendChild(t)}var Nt=0;function R(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function He(){return S()?.stx?.overlays}var Ht=0;function Be(e,t,n,r){Ot(e);let o=S(),i=`native-dialog-layer-${++Ht}`,a=R(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(R(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,f=(u)=>{if(l)return;l=!0,a.classList.remove("is-open"),He()?.close(i),setTimeout(()=>a.remove(),260),s(u)},p=n({root:a,settle:f});a.appendChild(p),e.body.appendChild(a),He()?.open(i,{panel:p,root:a,onEscape:()=>f(r())});let d=o;(typeof d?.requestAnimationFrame==="function"?(u)=>d.requestAnimationFrame(()=>d.requestAnimationFrame(u)):(u)=>setTimeout(u,16))(()=>{if(!l)a.classList.add("is-open")})})}function ve(e){let t=Ie();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Nt}`,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 Be(t,e.variant,({root:a,settle:s})=>{let l=(u)=>u.style==="cancel"?null:u.id,f=R(t,"div","native-dialog-panel");f.setAttribute("role","alertdialog"),f.setAttribute("aria-modal","true"),f.tabIndex=-1;let p=R(t,"div","native-dialog-group");if(e.title||e.message){let u=R(t,"div","native-dialog-header");if(e.title){let m=R(t,"p","native-dialog-title",e.title);m.id=`${n}-title`,u.appendChild(m),f.setAttribute("aria-labelledby",m.id)}if(e.message){let m=R(t,"p","native-dialog-message",e.message);m.id=`${n}-message`,u.appendChild(m),f.setAttribute("aria-describedby",m.id)}p.appendChild(u)}let d=R(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)d.classList.add("is-row");for(let u of o){let m=R(t,"button",`native-dialog-action${u.style==="destructive"?" is-destructive":""}${u.style==="cancel"?" is-cancel":""}`,u.title);m.type="button",m.setAttribute("data-action-id",u.id),m.addEventListener("click",()=>s(l(u))),d.appendChild(m)}if(p.appendChild(d),f.appendChild(p),i){let u=R(t,"div","native-dialog-group"),m=R(t,"button","native-dialog-action is-cancel",i.title);m.type="button",m.setAttribute("data-action-id",i.id),m.addEventListener("click",()=>s(null)),u.appendChild(m),f.appendChild(u)}let g=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")g?.addEventListener("click",()=>s(null));return f},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function _e(e){await ve({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function De(e){return await ve({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 Fe(e){return ve({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function It(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,f=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,p=e.x+e.width/2>n.width/2?"right":"left";return{top:f,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function We(e){let t=Ie();if(!t?.body)return Promise.resolve(null);let n=S();return Be(t,"menu",({root:r,settle:o})=>{let i=R(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(R(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=R(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(R(t,"span","native-menu-label",a.title)),a.icon){let l=R(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=It(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 Ue=()=>!0,T=()=>!1,C=()=>null;function $e(){return S()?.navigator??(typeof navigator>"u"?void 0:navigator)}function we(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 j={alert:(e)=>b("dialog.alert",[e],()=>_e(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>b("dialog.confirm",[e],()=>De(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?we(e.anchor):void 0},n=await b("dialog.actionSheet",[t],()=>Fe(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function gr(){return(e)=>j.actionSheet(e)}async function hr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return j.confirm(e);return await j.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 Ae={show:async(e)=>{let t={title:e.title,anchor:we(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],()=>We(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function br(e,t){return Ae.show({...t,anchor:we(e.getBoundingClientRect())})}function Bt(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 qe={open:async(e,t={})=>{let n=await b("browser.open",[e,t],()=>Bt(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)}}},ye=new Map,Se=new Map;function Ke(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var je={isAvailable:()=>L("symbols.image")!==null,image:(e,t={})=>{let n=Ke(e,t),r=ye.get(n);if(r)return r;let o=b("symbols.image",[e,t],C).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,C).then((i)=>(Se.set(n,i),i));return ye.set(n,o),o},cached:(e,t={})=>Se.get(Ke(e,t)),clearCache:()=>{ye.clear(),Se.clear()}},ne={setStyle:(e)=>b("statusBar.setStyle",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},Y={setUnderPageColor:(e)=>b("chrome.setUnderPageColor",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>b("chrome.setKeyboardAccessory",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},I={isAvailable:()=>L("refresh.enable")!==null,enable:(e)=>b("refresh.enable",[e??{}],T,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>b("refresh.disable",[],T,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>b("refresh.end",[],T,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>M("craftRefresh",()=>e())},G={complete:(e)=>b("background.complete",[e],T,{fallbackOnError:!0}).then((t)=>t!==!1)},Ye={write:(e)=>b("clipboard.write",[e],async()=>{let t=$e()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(Ue,T)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>b("clipboard.read",[],async()=>{let e=$e()?.clipboard;if(!e?.readText)return null;return e.readText().catch(C)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},Ge={isAvailable:()=>L("db.query")!==null,query:(e,t=[])=>b("db.query",[e,t],C).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>b("db.execute",[e,t],C).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 xe(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 _t(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 Ve={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",[],C,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>b("scanQRCode",[],C).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},C),pickFile:(e=[])=>b("pickFile",[e],()=>_t(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}},C),saveFile:(e,t,n)=>b("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return xe(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=xe(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>b("downloadFile",[e,t],()=>xe(e,t)).then((n)=>typeof n==="string"?n:null)},Xe={set:(e)=>b("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],T).then((t)=>t!==!1),clear:()=>b("shortcuts.clear",[],T).then((e)=>e!==!1),onShortcut:(e)=>M("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},Qe={update:(e)=>b("widget.update",[e],T).then((t)=>t!==!1),reload:()=>b("widget.reload",[],T).then((e)=>e!==!1)},Dt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function ze(){return S()?.screen?.orientation}var Je={lock:(e)=>b("lockOrientation",[e],()=>{let t=ze();return t?.lock?t.lock(Dt[e]).then(Ue,T):!1}).then((t)=>t!==!1),unlock:()=>b("unlockOrientation",[],()=>(ze()?.unlock?.(),!0)).then((e)=>e!==!1)},Ze={signInWithApple:(e={})=>b("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],C).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},et={isAvailable:()=>L("iap.purchase")!==null,products:(e)=>b("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>b("iap.purchase",[e],C).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:[])};var Ft=["authorized","denied","notDetermined","restricted","unsupported"];function re(){let e=be(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function Wt(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function tt(e){return Ft.includes(e)?e:"unsupported"}function $t(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function W(e,t,...n){return c(async()=>{let r=re();if(typeof r?.[e]!=="function")throw Wt();return t(await r[e](...n))})}var nt={isAvailable:()=>typeof re()?.isSupported==="function",supports:(e)=>typeof re()?.[e]==="function",isSupported:()=>c(async()=>{let e=re();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>W("authorization",tt),requestAuthorization:()=>W("requestAuthorization",tt),list:()=>W("list",(e)=>Array.isArray(e)?e.map($t).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return W("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>W("remove",(t)=>t===!0,e),removeAll:()=>W("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function wr(e,t){let n=t.delay??500,r=t.tolerance??10,o=null,i=null,a=!1,s=()=>{if(o)clearTimeout(o);if(o=null,i&&!a)t.onPressEnd?.();i=null},l=(g)=>{let u=g;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)},f=(g)=>{if(!i)return;let u=g;if(Math.hypot(u.clientX-i.x,u.clientY-i.y)>r)s()},p=(g)=>{if(!a)return;a=!1,g.preventDefault(),g.stopPropagation()},d=(g)=>g.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",f),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",d),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",d)}}function Kt(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 Ar(e,t){let n=null,r=null,o=!1,i=0,a=(u)=>{let m=e.getBoundingClientRect();return Kt(u,{left:m.left+2,width:m.width-4},t.count())},s=(u)=>{let m=u;if(m.button!==void 0&&m.button!==0)return;let v=a(m.clientX);if(v!==t.selected())return;n=v,i=v,o=!1,r=m.pointerId;try{e.setPointerCapture?.(m.pointerId)}catch{}t.onPress?.(!0)},l=(u)=>{if(n===null)return;let m=a(u.clientX);if(m===i)return;o=!0,i=m,t.onScrub(m)},f=(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()},d=()=>f(!0),g=()=>f(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",g),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",g),e.removeEventListener("click",p,!0)}}function kr(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 Er(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=L("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as zt}from"@bughq/sdk";import{crashReporter as K}from"craft-native/mobile";var P=null;function Ut(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function rt(){return K.isAvailable()}function qt(e){return async(t)=>{if(!rt())return!e;return K.capture(t)}}var Cr={start(e={}){if(P)return P;let t=q()||rt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return P=new zt({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?qt(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!Ut(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)K.addBreadcrumb(i);return i}}),P},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);P?.setUser(t===null?null:{id:t}),await K.setUser(t)},capture(e,t){P?.captureException(e,t)},addBreadcrumb(e){if(P)P.addBreadcrumb(e);else K.addBreadcrumb(e)},async flush(){await Promise.all([P?.flush(),K.flush()])},client(){return P},stop(){P?.close(),P=null}};function ke(e){let t=S();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function ot(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function it(){let e=S()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:ot(e?.getAttribute("data-craft-reduce-motion"))||ke("(prefers-reduced-motion: reduce)"),reduceTransparency:ot(e?.getAttribute("data-craft-reduce-transparency"))||ke("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||ke("(prefers-color-scheme: dark)")?"dark":"light"}}function jt(e){let t=it(),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 at(e,t={}){if(t.immediate!==!1)e(it());return M("craftAppearance",(n)=>e(jt(n)))}function Ir(e){return M("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function Br(e){return M("craftMemoryWarning",()=>e())}function st(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>G.complete(!0),()=>G.complete(!1))}}function _r(e){let t=st(e);return M("craftSilentPush",(n)=>t(n.payload??{}))}function Dr(e){let t=st(()=>e());return M("craftBackgroundRefresh",()=>t(void 0))}import{haptics as Yt}from"craft-native/mobile";function Re(){if(typeof window>"u")return;return window}function V(e=Re()){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 Gt(e,t=Re()){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(V(t))})};return e(V(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function Vt(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 $r(e){let t=e.host??Re();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(v)=>setTimeout(v,16),s=null,l=(v)=>{s=null,e.onPull?.(v,o,{bounce:Math.min(v,Math.max(0,-V(t)))})},f=(v)=>{let k=s!==null;if(s=v,k)return;a(()=>{if(s!==null)l(s)})},p=(v)=>{let k=v.touches?.[0];return k?k.clientY:null},d=(v)=>{if(i||V(t)>0)return;r=p(v),o=!1},g=(v)=>{if(r===null)return;let k=p(v);if(k===null)return;let N=Vt(V(t),k-r);if(!o&&N>=n)o=!0,Promise.resolve(Yt.impact("medium")).catch(()=>{});else if(o&&N<n*0.8)o=!1;f(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)}},m=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",d,{passive:!0}),t.addEventListener("touchmove",g,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("touchcancel",m),()=>{s=null,t.removeEventListener("touchstart",d),t.removeEventListener("touchmove",g),t.removeEventListener("touchend",u),t.removeEventListener("touchcancel",m)}}function Xt(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 Kr(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Gt((o)=>{let i=Xt(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 zr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function ut(){if(typeof window>"u")return;return window}var lt="__stxPushed",Qt="__stxScroll";function Jt(e=ut()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(lt in n)return n[lt]===!0;return!(Qt in n)}function qr(e=ut()){if(!Jt(e))return!1;return e.history.back(),!0}function jr(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 Yr(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function Gr(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Zt(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Vr(){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 Zt(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Xr(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 Qr(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function en(e,t=tn()){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 tn(){if(typeof window>"u")return;return window.location?.origin}var ct="stacks-mobile-deep-link";function Jr(e,t){let n=(r)=>{let o=en(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(ct)===r)return;sessionStorage.setItem(ct,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var eo=5000;function nn(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let p=i+a>>1;if(r[p].timestamp<o.timestamp)i=p+1;else a=p}let s=r[i],l=r[i-1],f=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!f||Math.abs(f.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(f.bpm)}})}var rn=6371008.8,on=30,an=on;function sn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*rn*Math.asin(Math.min(1,Math.sqrt(i)))}function ln(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 dt(e,t={}){let n=ln(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let d of n){let g=o[o.length-1],u=s?(d.timestamp-s.timestamp)/1000:0;if(s=d,!g){o.push({fix:d,cumM:0});continue}if(u>an){o.push({fix:d,cumM:i});continue}let m=(d.timestamp-g.fix.timestamp)/1000,v=sn(g.fix,d),k=Math.min(10,Math.max(3,g.fix.accuracy,d.accuracy));if(v<k)continue;if(i+=v,m>0&&v/m>=0.5)a+=m;o.push({fix:d,cumM:i})}let l=o[o.length-1],f=null,p=null;if(l&&n.at(-1).timestamp-l.fix.timestamp<=r*1000){let d=l.fix.timestamp-r*1000,g=o.find((v)=>v.fix.timestamp>=d)??l,u=l.cumM-g.cumM,m=(l.fix.timestamp-g.fix.timestamp)/1000;if(u>=20&&m>0)p=u/m,f=m/(u/1000)}return{distanceM:i,movingS:a,paceSPerKm:f,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 to(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 no(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var pt={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function ro(e){let t=e.location,n=e.intervalMs??3000,r=pt,o=null,i=e.heartRate,a=!1,s=[],l=()=>typeof document<"u"&&document.visibilityState==="hidden",f=0,p=null,d=Promise.resolve(),g=null,u=!1;function m(x){let h=d.then(x);return d=h.then(()=>{},()=>{}),h}function v(){if(p)return p;let x=f;return p=(async()=>{let h=await t.readRecording();if(x===f&&!u)r=dt(h,e),e.onUpdate?.(r);return r})().finally(()=>{p=null}),p}function k(){if(N(),u)return;o=setInterval(()=>{if(!l())v().catch(()=>{})},n)}function N(){if(o)clearInterval(o);o=null}async function z(x){if(!i||!a)return;await x(i).catch(()=>{})}return{get stats(){return r},get heartRate(){return s},start(){return g=null,m(async()=>{if(await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),s=[],a=!!i?.isAvailable(),await z((x)=>x.startRecording()),f++,r={...pt},!u)e.onUpdate?.(r);return k(),r})},attach(){return m(async()=>{let x=await t.getRecordingState();if(!x?.active)return null;if(i?.isAvailable())a=!!(await i.getRecordingState().catch(()=>null))?.active;if(await v().catch(()=>{}),!x.paused)k();return x})},pause(){return m(async()=>{await t.pauseRecording(),await z((x)=>x.pauseRecording()),N(),await v().catch(()=>{})})},resume(){return m(async()=>{await t.resumeRecording(),await z((x)=>x.resumeRecording()),k()})},stop(){if(g)return g;return g=m(async()=>{N(),f++;let h=(await t.stopRecording())?.locations??[];if(i&&a){let y=await i.stopRecording().catch(()=>null);a=!1,s=y?.samples??[],h=nn(h,s)}if(r=dt(h,e),!u)e.onUpdate?.(r);return h}).catch((x)=>{throw g=null,x}),g},dispose(){u=!0,f++,N()},refresh:v}}function io(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function ao(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function so(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function lo(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var uo=150;function cn(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 oe(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function po(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?oe(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:oe(n.map((s)=>s.latitude),0.5),longitude:oe(n.map((s)=>s.longitude),0.5)};i=oe(n.map((s)=>cn(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 fo(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 se=new Set,ft=!1,ie=null;function un(e){return e.isConnected&&e.getClientRects().length>0}function mt(){return[...se].find((e)=>un(e.element))}function ae(){let e=mt(),t=Boolean(e);if(t===ft)return;if(ft=t,t)I.enable(e?.tintColor?{tintColor:e.tintColor}:{});else I.disable()}function dn(){let e=mt();if(!e){I.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>I.end())}function ho(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};se.add(n);let r=e.ownerDocument?.defaultView;if(!ie){let o=I.onRefresh(dn),i=()=>ae();r?.addEventListener("stx:load",i),ie=()=>{o(),r?.removeEventListener("stx:load",i)}}return ae(),r?.requestAnimationFrame?.(()=>ae()),()=>{if(se.delete(n),se.size===0)ie?.(),ie=null;ae()}}var vo=0.5;function pn(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 fn(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 mn(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function yo(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>pn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let d=p;if(d.button!==void 0&&d.button!==0)return;if(d.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let g=a().find((u)=>u.name===e.detent())?.y??0;n={y:d.clientY,base:g,pointerId:d.pointerId},o=g,r=[{y:g,t:d.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(d.pointerId)}catch{}},l=(p)=>{if(!n)return;let d=p,g=n.base+d.clientY-n.y;o=g<0?-mn(-g):g,r.push({y:o,t:d.timeStamp});while(r.length>2&&d.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))))},f=(p)=>{if(!n)return;let d=p;n=null;let g=r[0],u=Math.max(1,d.timeStamp-g.t),m=(o-g.y)/u;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(fn({y:o,velocity:m,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",f),p.addEventListener("pointercancel",f);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",f),p.removeEventListener("pointercancel",f)}}function So(e){let t=e.ownerDocument;if(e.parentElement===t.body)return()=>{};let n=t.createComment("native-sheet");return e.parentNode?.insertBefore(n,e),t.body.appendChild(e),()=>{if(n.parentNode)n.parentNode.insertBefore(e,n);else e.remove();n.remove()}}var Ee=new WeakMap;function xo(e,t){let n=e.documentElement,r=Ee.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Ee.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Ee.set(e,r+1),r>0)return;let o=e.defaultView,i=(o?.scrollY??0)+(o?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(i)}px`),n.setAttribute("data-native-sheet-card","")}function gn(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 hn(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 bn(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&&!hn(r))return r}return null}function vn(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 Ro(e,t={}){let n=t.root??e.documentElement;Y.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=bn(e);if(p&&p!==r)r=p,Y.setUnderPageColor(p);let d=vn(e)?"light":"dark";if(d!==o)o=d,ne.setStyle(d)},a=at((p)=>{gn(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 f=s?.matchMedia?.("(prefers-color-scheme: dark)");return f?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),f?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var To=64;var yn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Sn=/^(?:0|[1-9]\d*)$/;function ht(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,f=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!yn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:f})}return{kinds:t,problems:n}}function Q(e,t){return e.find((n)=>n.name===t)??null}function X(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 xn(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(!Sn.test(o))return null;let i=Number(o);return X(e,r,i)===t?{kind:r,slot:i}:null}function bt(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function Lo(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()),...bt(ht(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function vt(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 wn(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((m)=>m.kind===n),s=vt(e,n,r),l=a.find((m)=>m.itemId===r.id)??null,f=l?null:En(a,i.slots),p=l||f!==null?null:Tn(a),d=l?.slot??f??p?.slot;if(d===void 0||d===null)return null;let g={kind:n,slot:d,itemId:r.id,title:s,donatedAt:o},u=t.filter((m)=>m.kind!==n||m.slot!==d&&m.itemId!==r.id);return{entries:yt(e,[...u,g]),entry:g,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 kn(e,t,n){let r=xn(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 Rn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:f,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||X(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let d=`${a}-slot-${s}`,g=`${a}#${l}`;if(n.has(d)||r.has(g))continue;n.set(d,{kind:a,slot:s,itemId:l,title:typeof f==="string"&&f.trim()?f:vt(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(g)}return yt(e,[...n.values()])}function yt(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 En(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 Tn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Ln(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var Pn="stacks_spotlight_index",Mn=3000;function Po(e){let t=e.onProblem??((h)=>console.warn(`[spotlight] ${h}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:ht(e.kinds);for(let h of n.problems)t(h);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??Pn,i=e.legacyStorageKeys??[],a=e.timeoutMs??Mn,s=e.now??(()=>Date.now()),l=e.bridge??Ln,f=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function d(){if(f)return f;f=[];let h=p();if(!h)return f;try{let y=[o,...i].map((w)=>h.getItem(w)).find((w)=>w);f=y?Rn(r,JSON.parse(y)):[]}catch{f=[]}return f}function g(h){f=h;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(h));for(let w of i)y.removeItem(w)}catch{}}async function u(h){if(!h)return null;let y;try{return await Promise.race([h,new Promise((w)=>{y=setTimeout(()=>w(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let m=Promise.resolve();function v(h){let y=m.then(h,h);return m=y.catch(()=>{return}),y}async function k(h,y){let w=l()?.register;if(!w||r.length===0)return!1;return v(async()=>{let E=wn(r,d(),h,y,s()),B=E&&X(r,h,E.entry.slot);if(!E||!B)return!1;if(!E.changed)return g(E.entries),!0;let U=await u(w(E.entry.title,B))!==null;if(U)g(E.entries);return U})}async function N(h,y){let w=l()?.remove;if(!w)return!1;return v(async()=>{let{entries:E,removed:B}=An(d(),h,y);if(!B)return!1;let U=X(r,h,B.slot),Tt=U?await u(w(U))!==null:!1;return g(E),Tt})}async function z(h,y){let w=Q(r,h)?.slots;if(!w||!l()?.register)return 0;let E=0;for(let B of[...y].slice(0,w).reverse())if(await k(h,B))E++;return E}async function x(){let h=l()?.remove;if(!h)return g([]),0;return v(async()=>{let y=0;for(let w of d()){let E=X(r,w.kind,w.slot);if(E&&await u(h(E))!==null)y++}return g([]),y})}return{kinds:r,index:k,sync:z,remove:N,clear:x,routeFor:(h)=>kn(r,d(),h),entries:()=>d(),activityTypes:(h)=>bt(r).map((y)=>`${h}.${y}`),reset:()=>{f=null}}}var gt=["craftShortcut","craftSiriShortcut"];function Mo(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 gt)globalThis.addEventListener(r,n);return()=>{for(let r of gt)globalThis.removeEventListener(r,n)}}import{tabBar as Cn}from"craft-native/mobile";var On=Cn;function Nn(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 xt(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function In(){return typeof xt()?.selectTab==="function"}function No(e,t={}){let n=(r)=>{if(In()||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 St(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Te="stacks:tab-bar-cover";function Ho(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(Te))}function Io(e,t={}){let n=t.api??On;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=St(o?.getPropertyValue("--native-tab-active")||""),a=St(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:g,selected:u}=Hn(Nn(e)),m=JSON.stringify({tabs:g,selected:u});if(m===s)return;let v=s&&s!=="hidden"?JSON.parse(s):null;if(v&&u&&JSON.stringify(v.tabs)===JSON.stringify(g))n.select(u);else n.set(g,{selected:u,tint:i,tintDark:a});s=m},f=typeof MutationObserver==="function"?new MutationObserver(l):null;f?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((g)=>{let u=xt();if(u?.selectTab){u.selectTab(g);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((v)=>v.getAttribute("href")===g)?.click()}),d=()=>l();if(typeof window<"u")window.addEventListener("stx:load",d),window.addEventListener("stx:screen-shown",d),window.addEventListener(Te,d);return l(),()=>{if(f?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",d),window.removeEventListener("stx:screen-shown",d),window.removeEventListener(Te,d);n.hide()}}var Fn={isAvailable:()=>c(()=>Le.isAvailable()),getBiometricType:()=>c(()=>Le.getBiometricType()),authenticate:(e)=>c(()=>Le.authenticate(e))},Wn={takePicture:(e)=>c(()=>ce.takePicture(e)),pickImage:()=>c(()=>ce.pickImage()),pickMultiple:(e)=>c(()=>ce.pickMultiple(e)),isAvailable:()=>c(()=>ce.isAvailable())},$n={getInfo:()=>c(()=>D.getInfo()),getCapabilities:()=>c(()=>D.getCapabilities()),isMobile:()=>D.isMobile(),isIOS:()=>D.isIOS(),isAndroid:()=>D.isAndroid(),getLocale:()=>D.getLocale(),getTimezone:()=>D.getTimezone()},Kn=_n,zn={getCurrentPosition:(e)=>c(()=>H.getCurrentPosition(e)),watchPosition:(e,t)=>H.watchPosition(e,t),clearWatch:(e)=>H.clearWatch(e),startRecording:(e)=>c(()=>H.startRecording(e)),pauseRecording:()=>c(()=>H.pauseRecording()),resumeRecording:()=>c(()=>H.resumeRecording()),stopRecording:()=>c(()=>H.stopRecording()),getRecordingState:()=>c(()=>H.getRecordingState()),readRecording:()=>c(()=>H.readRecording())},Un={show:(e)=>c(()=>de.show(e)),schedule:(e)=>c(()=>de.schedule(e)),cancelAll:()=>c(()=>de.cancelAll()),setBadge:(e)=>c(()=>de.setBadge(e))},qn={check:(e)=>c(()=>Z.check(e)),request:(e)=>c(()=>Z.request(e)),checkMultiple:(e)=>c(()=>Z.checkMultiple(e)),requestMultiple:(e)=>c(()=>Z.requestMultiple(e)),openSettings:()=>c(()=>Z.openSettings())},jn={set:(e,t)=>c(()=>pe.set(e,t)),get:(e)=>c(()=>pe.get(e)),delete:(e)=>c(()=>pe.delete(e)),clear:()=>c(()=>pe.clear())},Yn={share:(e)=>c(()=>Rt.share(e)),isAvailable:()=>Rt.isAvailable()},Gn={request:()=>c(()=>Bn.request())},me={impact:(e)=>Promise.resolve().then(()=>ue.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ue.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ue.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ue.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=L("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function Et(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 Vn={async getInitialURL(){if(!await F())return null;return Et(await wt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=wt.onLink?.((o,i)=>{let a=Et(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(he()?.craft)r();else F().then(r);return()=>{n=!0,t?.()}}},$o={isAvailable:()=>fe.isAvailable(),set:(e,t)=>fe.set(e,t),remove:(e)=>fe.remove(e),clear:()=>fe.clear()},Xn={enable:()=>c(()=>At.enable()),disable:()=>c(()=>At.disable())},Qn={isAvailable:()=>le.isAvailable(),get:()=>c(()=>le.get()),set:(e)=>c(()=>le.set(e)),restore:()=>c(()=>le.restore())},Jn={isAvailable:()=>O.isAvailable(),supports:(e)=>O.supports(e),getAuthorizationStatus:()=>c(()=>O.getAuthorizationStatus()),requestAuthorization:()=>c(()=>O.requestAuthorization()),getNowPlaying:()=>c(()=>O.getNowPlaying()),play:()=>c(()=>O.play()),pause:()=>c(()=>O.pause()),togglePlayPause:()=>c(()=>O.togglePlayPause()),skipToNext:()=>c(()=>O.skipToNext()),skipToPrevious:(e)=>c(()=>O.skipToPrevious(e)),onChange:(e)=>_(()=>O.onChange(e))},Zn={isAvailable:()=>A.isAvailable(),supports:(e)=>A.supports(e),getState:()=>c(()=>A.getState()),requestAuthorization:()=>c(()=>A.requestAuthorization()),scan:(e)=>c(()=>A.scan(e)),stopScan:()=>c(()=>A.stopScan()),getDevices:()=>c(()=>A.getDevices()),connect:(e)=>c(()=>A.connect(e)),reconnect:()=>c(()=>A.reconnect()),disconnect:(e)=>c(()=>A.disconnect(e)),startRecording:()=>c(()=>A.startRecording()),pauseRecording:()=>c(()=>A.pauseRecording()),resumeRecording:()=>c(()=>A.resumeRecording()),stopRecording:()=>c(()=>A.stopRecording()),getRecordingState:()=>c(()=>A.getRecordingState()),readRecording:(e)=>c(()=>A.readRecording(e)),onReading:(e)=>_(()=>A.onReading(e)),onDevice:(e)=>_(()=>A.onDevice(e)),onState:(e)=>_(()=>A.onState(e))},er={isAvailable:()=>Ce.isAvailable(),speak:(e,t)=>c(()=>Ce.speak(e,t)),stop:()=>c(()=>Ce.stop())},tr={getStatus:()=>c(()=>kt.getStatus()),onChange:(e)=>_(()=>kt.onChange(e))},nr={register:()=>c(()=>Me.register()),onToken:(e)=>Me.onToken(e),onNotification:(e)=>_(()=>Me.onNotification(e))},rr={requestAuthorization:(e,t)=>c(()=>J.requestAuthorization(e,t)),getData:(e,t)=>c(()=>J.getData(e,t)),saveWorkout:(e)=>c(()=>J.saveWorkout(e)),getWorkouts:(e)=>c(()=>J.getWorkouts(e)),getDailyStatistics:(e,t)=>c(()=>J.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:[]),saveMindfulSession:(e)=>b("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>b("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>b("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>b("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>M("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>L(`health.${e}`)!==null},or={start:(e)=>c(()=>Pe.start(e)),update:(e)=>c(()=>Pe.update(e)),end:()=>c(()=>Pe.end())},ir={send:(e)=>c(()=>ee.send(e)),updateContext:(e)=>c(()=>ee.updateContext(e)),isReachable:()=>c(()=>ee.isReachable()),onMessage:(e)=>ee.onMessage(e),onReachabilityChange:(e)=>ee.onReachabilityChange(e)},Ko=Dn;function he(){return S()}function ge(){let e=he()?.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 Oe(){return ge()!==null}function ar(e=2000){if(Oe()||q())return Promise.resolve(!0);let t=he();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(Oe())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function sr(e){let t=he();if(!t)return()=>{};if(ge()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!ge())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function lr(e){await me.impact("light");try{let t=await e();return await me.notification("success"),t}catch(t){throw await me.notification("error"),t}}var zo={get nativeBridge(){return ge()},biometrics:Fn,camera:Wn,device:$n,haptics:me,lifecycle:Kn,location:zn,notifications:Un,permissions:qn,secureStorage:jn,share:Yn,appReview:Gn,deepLinks:Vn,keepAwake:Xn,brightness:Qn,music:Jn,heartRate:Zn,scheduledWorkouts:nt,speech:er,network:tr,pushNotifications:nr,health:rr,liveActivities:or,watchConnectivity:ir,dialog:j,contextMenu:Ae,browser:qe,symbols:je,statusBar:ne,chrome:Y,refresh:I,background:G,clipboard:Ye,db:Ge,files:Ve,shortcuts:Xe,widgets:Qe,orientation:Je,auth:Ze,storeKit:et,isNativeMobile:Oe,whenNative:ar,onReady:sr,withFeedback:lr};export{cr as BRIDGE_WAIT_MS,eo as HEART_RATE_MATCH_MS,uo as INDOOR_CHECK_AFTER_S,To as MAX_SPOTLIGHT_SLOTS_PER_KIND,on as ROUTE_GAP_S,vo as SHEET_FLICK_VELOCITY,Te as TAB_BAR_COVER_EVENT,c as afterBridge,Gn as appReview,gn as applyAppearance,nn as attachHeartRate,Ze as auth,Yr as backLabelFor,G as background,Fn as biometrics,te as bridgePending,Qn as brightness,qe as browser,b as callNative,Wn as camera,Jt as canGoBack,Y as chrome,Ye as clipboard,hr as confirmAction,Ae as contextMenu,Ho as coverTabBar,S as craftHost,be as craftRoot,Cr as crashReporting,ro as createRouteRecorder,Po as createSpotlightIndex,it as currentAppearance,Ge as db,en as deepLinkPath,Vn as deepLinks,$n as device,j as dialog,jr as enterNavTrail,Ve as files,sn as fixDistance,Rr as focusSegment,Jr as followDeepLinks,ge as getNativeMobileBridge,qr as goBack,Xr as goBackToTabRoot,No as handleTabReselect,me as haptics,q as hasNativeMobileHost,rr as health,Zn as heartRate,po as indoorVerdict,Ro as installNativeChrome,Er as installPressables,Oe as isNativeMobile,un as isShown,Xn as keepAwake,Ut as keepBreadcrumb,Xt as largeTitleMetrics,Kn as lifecycle,So as liftToBody,or as liveActivities,zn as location,Io as mirrorTabBar,zo as mobile,Jn as music,Mt as nativeFunction,L as nativeFunctionNow,Hn as nativeTabs,Gr as navTrail,tr as network,jt as normalizeAppearance,Et as normalizeDeepLinkURL,$t as normalizeScheduledWorkout,Un as notifications,Kr as observeLargeTitle,wr as observeLongPress,ho as observeNativeRefresh,Gt as observePageScroll,$r as observePullToRefresh,Ar as observeSegmentScrub,yo as observeSheetDrag,at as onAppearance,Dr as onBackgroundRefresh,M as onCraftEvent,Br as onMemoryWarning,sr as onMobileReady,Ir as onResume,_r as onSilentPush,Mo as onSpotlightTap,Je as orientation,to as paceLabel,bn as pageBackground,vn as pageIsDark,V as pageScrollTop,ao as pauseSessionClock,qn as permissions,It as placeMenu,wn as placeSpotlightItem,Fe as presentActionSheet,_e as presentAlert,ve as presentChoice,De as presentConfirm,We as presentContextMenu,xo as presentPageAsCard,Vr as previousScreenPath,Vt as pullDistance,nr as pushNotifications,Rn as readSpotlightEntries,ht as readSpotlightKinds,Nn as readTabLinks,I as refresh,An as removeSpotlightItem,zr as resolveScrollHost,so as resumeSessionClock,dt as routeStats,In as routerHandlesTabs,mn as rubberBand,nt as scheduledWorkouts,Wt as scheduledWorkoutsUnsupported,jn as secureStorage,Kt as segmentAt,kr as segmentForKey,lo as sessionClockElapsed,fn as settleSheet,Yn as share,pn as sheetStops,Xe as shortcuts,br as showContextMenuFor,$o as snapshots,er as speech,no as speedLabel,Ko as splash,X as spotlightAction,bt as spotlightActions,Lo as spotlightActivityTypes,Ln as spotlightBridge,Q as spotlightKind,kn as spotlightRoute,xn as spotlightSlot,vt as spotlightTitle,io as startSessionClock,ne as statusBar,et as storeKit,_ as subscribeWhenReady,je as symbols,On as tabBar,we as toNativeRect,Qr as trailEntryFor,fo as typedDistanceKm,ln as usableFixes,gr as useActionSheet,ir as watchConnectivity,F as whenBridgeReady,ar as whenNativeMobile,Qe as widgets,lr as withNativeFeedback};
@@ -23,13 +23,6 @@ export declare function rubberBand(overshoot: number, dimension?: number): numbe
23
23
  * animates to wherever `onSettle` puts it.
24
24
  */
25
25
  export declare function observeSheetDrag(options: SheetDragOptions): () => void;
26
- /**
27
- * Holds the page still and out of reach behind `keep`: everything outside it
28
- * becomes inert (no taps, no focus, hidden from VoiceOver) and the document
29
- * stops scrolling. Returns the release. Nested sheets count, so the page
30
- * scrolls again only once the last has closed.
31
- */
32
- export declare function lockBackground(keep: HTMLElement): () => void;
33
26
  /**
34
27
  * Moves `element` to the end of the body, out of every stacking context and
35
28
  * transform on the way, and returns the way back: to where it was, or out of
@@ -38,8 +31,11 @@ export declare function lockBackground(keep: HTMLElement): () => void;
38
31
  export declare function liftToBody(element: HTMLElement): () => void;
39
32
  /**
40
33
  * The iOS card presentation: while a large sheet is up, the page behind it
41
- * shrinks back from the screen's edges, centred on what was in view. Undone by
42
- * calling it with `false`.
34
+ * shrinks back from the screen's edges, centred on what was in view.
35
+ *
36
+ * Counted: each call with `true` is let go by one with `false`, and the page
37
+ * stays a card until the last sheet that asked lets go, so a sheet closing
38
+ * over another large one does not flatten the page under it.
43
39
  */
44
40
  export declare function presentPageAsCard(doc: Document, on: boolean): void;
45
41
  /** A flick faster than this (CSS pixels a millisecond) moves on to the next stop. */
@@ -60,7 +56,13 @@ export declare interface SheetDragOptions {
60
56
  /**
61
57
  * What makes a bottom sheet behave like a UISheetPresentationController:
62
58
  * dragged by its grabber or header, flicked away, resting at a medium or a
63
- * large detent, and holding the page behind it still and out of reach.
59
+ * large detent, lifted out of the page and pressing it back into a card.
60
+ *
61
+ * Holding the page behind a sheet still and out of reach, Escape, the Tab
62
+ * trap and handing focus back are the stx overlay stack's
63
+ * (`@stacksjs/components/overlays`), which NativeSheet joins, so a sheet
64
+ * nests with dialogs, drawers and confirmations instead of competing with
65
+ * them.
64
66
  */
65
67
  export type SheetDetent = 'medium' | 'large';
66
68
  export type SheetSettle = SheetDetent | 'dismiss';
package/dist/sheets.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * Keeps Tab and Shift+Tab inside `container`: called from a keydown listener,
3
- * it moves focus from one end to the other instead of out of it.
4
- */
5
- export declare function trapFocus(container: HTMLElement, event: KeyboardEvent): void;
6
1
  /**
7
2
  * An alert or action sheet drawn in HTML. Resolves with the chosen action's
8
3
  * id, or null when it is dismissed or Cancel is chosen.
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.182",
5
+ "version": "0.75.183",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bughq/sdk": "^0.3.0",
42
- "@stacksjs/types": "0.75.182",
42
+ "@stacksjs/types": "0.75.183",
43
43
  "craft-native": ">=0.0.179"
44
44
  },
45
45
  "devDependencies": {
46
- "@stacksjs/build": "0.75.182",
46
+ "@stacksjs/build": "0.75.183",
47
47
  "better-dx": "^0.2.24"
48
48
  }
49
49
  }