tempest-react-sdk 0.82.0 → 0.84.0

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.
Files changed (80) hide show
  1. package/README.md +7 -6
  2. package/bin/lib/openapi/generate.hostile.test.mjs +91 -0
  3. package/bin/lib/openapi/generate.mjs +42 -3
  4. package/dist/auth/create-tempest-auth.cjs +1 -1
  5. package/dist/auth/create-tempest-auth.cjs.map +1 -1
  6. package/dist/auth/create-tempest-auth.js +201 -153
  7. package/dist/auth/create-tempest-auth.js.map +1 -1
  8. package/dist/http/resumable-upload.cjs +1 -1
  9. package/dist/http/resumable-upload.cjs.map +1 -1
  10. package/dist/http/resumable-upload.js +124 -75
  11. package/dist/http/resumable-upload.js.map +1 -1
  12. package/dist/http/upload-with-progress.cjs +1 -1
  13. package/dist/http/upload-with-progress.cjs.map +1 -1
  14. package/dist/http/upload-with-progress.js +108 -44
  15. package/dist/http/upload-with-progress.js.map +1 -1
  16. package/dist/payments/PixCheckout.cjs +2 -0
  17. package/dist/payments/PixCheckout.cjs.map +1 -0
  18. package/dist/payments/PixCheckout.js +171 -0
  19. package/dist/payments/PixCheckout.js.map +1 -0
  20. package/dist/payments/PixCheckout.module.cjs +3 -0
  21. package/dist/payments/PixCheckout.module.cjs.map +1 -0
  22. package/dist/payments/PixCheckout.module.js +22 -0
  23. package/dist/payments/PixCheckout.module.js.map +1 -0
  24. package/dist/payments/format.cjs +2 -0
  25. package/dist/payments/format.cjs.map +1 -0
  26. package/dist/payments/format.js +9 -0
  27. package/dist/payments/format.js.map +1 -0
  28. package/dist/payments/mercado-pago.cjs +2 -0
  29. package/dist/payments/mercado-pago.cjs.map +1 -0
  30. package/dist/payments/mercado-pago.js +27 -0
  31. package/dist/payments/mercado-pago.js.map +1 -0
  32. package/dist/payments/outcome.cjs +2 -0
  33. package/dist/payments/outcome.cjs.map +1 -0
  34. package/dist/payments/outcome.js +108 -0
  35. package/dist/payments/outcome.js.map +1 -0
  36. package/dist/payments/types.cjs +2 -0
  37. package/dist/payments/types.cjs.map +1 -0
  38. package/dist/payments/types.js +16 -0
  39. package/dist/payments/types.js.map +1 -0
  40. package/dist/payments/use-mercado-pago-card.cjs +2 -0
  41. package/dist/payments/use-mercado-pago-card.cjs.map +1 -0
  42. package/dist/payments/use-mercado-pago-card.js +120 -0
  43. package/dist/payments/use-mercado-pago-card.js.map +1 -0
  44. package/dist/payments/use-pix-charge.cjs +2 -0
  45. package/dist/payments/use-pix-charge.cjs.map +1 -0
  46. package/dist/payments/use-pix-charge.js +63 -0
  47. package/dist/payments/use-pix-charge.js.map +1 -0
  48. package/dist/query/offline-persistence.cjs +1 -1
  49. package/dist/query/offline-persistence.cjs.map +1 -1
  50. package/dist/query/offline-persistence.js +57 -44
  51. package/dist/query/offline-persistence.js.map +1 -1
  52. package/dist/styles/PixCheckout.css +2 -0
  53. package/dist/styles/component/PixCheckout.css +18 -0
  54. package/dist/styles/manifest.json +6 -0
  55. package/dist/styles/payments.css +18 -0
  56. package/dist/styles.css +1 -1
  57. package/dist/sw/cache.cjs +1 -1
  58. package/dist/sw/cache.cjs.map +1 -1
  59. package/dist/sw/cache.js +82 -32
  60. package/dist/sw/cache.js.map +1 -1
  61. package/dist/sw.d.ts +21 -1
  62. package/dist/tempest-react-sdk.cjs +1 -1
  63. package/dist/tempest-react-sdk.d.ts +748 -10
  64. package/dist/tempest-react-sdk.js +104 -97
  65. package/dist/vite/base-url.cjs +1 -1
  66. package/dist/vite/base-url.cjs.map +1 -1
  67. package/dist/vite/base-url.js +5 -1
  68. package/dist/vite/base-url.js.map +1 -1
  69. package/dist/vite/tempest-pwa-dev-sw.cjs +1 -1
  70. package/dist/vite/tempest-pwa-dev-sw.cjs.map +1 -1
  71. package/dist/vite/tempest-pwa-dev-sw.js +96 -31
  72. package/dist/vite/tempest-pwa-dev-sw.js.map +1 -1
  73. package/dist/vite/tempest-pwa-manifest.cjs +2 -2
  74. package/dist/vite/tempest-pwa-manifest.cjs.map +1 -1
  75. package/dist/vite/tempest-pwa-manifest.js +32 -16
  76. package/dist/vite/tempest-pwa-manifest.js.map +1 -1
  77. package/dist/vite.cjs +1 -1
  78. package/dist/vite.d.ts +63 -12
  79. package/dist/vite.js +4 -4
  80. package/package.json +1 -1
@@ -283,100 +283,107 @@ import { permissionsFromToken as Vo } from "./access/permissions-from-token.js";
283
283
  import { GoogleSignIn as Ho } from "./oauth/GoogleSignIn.js";
284
284
  import { useOAuthCallback as Uo } from "./oauth/use-oauth-callback.js";
285
285
  import { OAuthCallbackError as Wo, exchangeOAuthCallback as Go, readOAuthCallbackParams as Ko } from "./oauth/callback.js";
286
- import { CACHE_TIME as qo, REFETCH_TIME as Jo, STALE_TIME as Yo } from "./query/constants.js";
287
- import { createQueryKeys as Xo } from "./query/create-query-keys.js";
288
- import { shouldRetryQuery as Zo } from "./query/retry-policy.js";
289
- import { QueryProvider as Qo } from "./query/QueryProvider.js";
290
- import { emptyOffsetPage as $o, isCursorPage as es, isOffsetPage as ts } from "./query/pagination.js";
291
- import { usePaginatedQuery as ns } from "./query/use-paginated-query.js";
292
- import { useCursorQuery as rs } from "./query/use-cursor-query.js";
293
- import { useOfflineMutation as is } from "./query/use-offline-mutation.js";
294
- import { removeById as as, upsertById as os } from "./query/optimistic.js";
295
- import { createOfflineStore as ss } from "./offline/create-offline-store.js";
296
- import { persistQueryClientOffline as cs } from "./query/offline-persistence.js";
297
- import { createDataProvider as ls, encodeIdSegment as us } from "./data/create-data-provider.js";
298
- import { TempestDataProvider as ds, useDataProvider as fs } from "./data/data-provider-context.js";
299
- import { listQueryKey as ps, oneQueryKey as ms, useCreate as hs, useDelete as gs, useList as _s, useOne as vs, useUpdate as ys } from "./data/use-resource.js";
300
- import { RouteGuard as bs } from "./router/RouteGuard.js";
301
- import { AppRouter as xs, defineRoutes as Ss } from "./router/AppRouter.js";
302
- import { Await as Cs, BrowserRouter as ws, HashRouter as Ts, IDLE_BLOCKER as Es, IDLE_FETCHER as Ds, IDLE_NAVIGATION as Os, Link as ks, MemoryRouter as As, NavLink as js, Navigate as Ms, NavigationType as Ns, Outlet as Ps, Route as Fs, Router as Is, RouterForm as Ls, RouterProvider as Rs, Routes as zs, ScrollRestoration as Bs, createBrowserRouter as Vs, createHashRouter as Hs, createMemoryRouter as Us, createPath as Ws, createRoutesFromChildren as Gs, createRoutesFromElements as Ks, createSearchParams as qs, data as Js, generatePath as Ys, isRouteErrorResponse as Xs, matchPath as Zs, matchRoutes as Qs, parsePath as $s, redirect as ec, redirectDocument as tc, renderMatches as nc, replace as rc, resolvePath as ic, useActionData as ac, useAsyncError as oc, useAsyncValue as sc, useBeforeUnload as cc, useBlocker as lc, useFetcher as uc, useFetchers as dc, useFormAction as fc, useHref as pc, useInRouterContext as mc, useLinkClickHandler as hc, useLoaderData as gc, useLocation as _c, useMatch as vc, useMatches as yc, useNavigate as bc, useNavigation as xc, useNavigationType as Sc, useOutlet as Cc, useOutletContext as wc, useParams as Tc, useResolvedPath as Ec, useRevalidator as Dc, useRouteError as Oc, useRouteLoaderData as kc, useRoutes as Ac, useSearchParams as jc, useSubmit as Mc, useViewTransitionState as Nc } from "./router/index.js";
303
- import { createStore as Pc } from "./store/create-store.js";
304
- import { createSelectors as Fc } from "./store/create-selectors.js";
305
- import { ThemeProvider as Ic, useTheme as Lc } from "./theme/ThemeProvider.js";
306
- import { ErrorBoundary as Rc } from "./error-boundary/ErrorBoundary.js";
307
- import { AppProviders as zc } from "./app/AppProviders.js";
308
- import { createEventStream as Bc } from "./sse/create-event-stream.js";
309
- import { useEventStream as Vc } from "./sse/use-event-stream.js";
310
- import { createTicketEventStream as Hc, isRetriableTicketError as Uc, useTicketEventStream as Wc } from "./sse/ticket-event-stream.js";
311
- import { isPushSupported as Gc, urlBase64ToUint8Array as Kc } from "./push/utils.js";
312
- import { WebPushClient as qc, WebPushPermissionDeniedError as Jc, WebPushUnsubscribeError as Yc, WebPushUnsupportedError as Xc } from "./push/web-push-client.js";
313
- import { usePushSubscription as Zc } from "./push/use-push-subscription.js";
314
- import { installNotificationClickHandler as Qc, installPushHandler as $c, installSkipWaitingListener as el } from "./sw/create-push-handler.js";
315
- import { DEFAULT_CREDENTIAL_HEADERS as tl } from "./sw/credential-headers.js";
316
- import { createPartialResponse as nl, installPrecache as rl, installRuntimeCache as il } from "./sw/cache.js";
317
- import { BACKGROUND_SYNC_CREDENTIALS_MESSAGE as al, clearBackgroundSyncQueue as ol, installBackgroundSync as sl, provideBackgroundSyncCredentials as cl } from "./sw/background-sync.js";
318
- import { registerPeriodicSync as ll } from "./sw/periodic-sync.js";
319
- import { clearCaches as ul, inspectCaches as dl } from "./sw/cache-inspect.js";
320
- import { clearSessionData as fl } from "./sw/session-data.js";
321
- import { createAudioPlayer as pl, playAudio as ml, stopAudio as hl } from "./audio/audio-player.js";
322
- import { useAudio as gl } from "./audio/use-audio.js";
323
- import { createSfxPool as _l } from "./audio/sfx-pool.js";
324
- import { useSfxPool as vl } from "./audio/use-sfx-pool.js";
325
- import { DEFAULT_MAX_GAIN as yl, createAudioBus as bl } from "./audio/audio-bus.js";
326
- import { useAudioBus as xl } from "./audio/use-audio-bus.js";
327
- import { DEFAULT_VOICE_CHAIN as Sl, createVoiceChain as Cl, isVoiceChainIdle as wl, monitorVoiceChain as Tl } from "./audio/voice-chain.js";
328
- import { measureNoiseFloor as El, suggestGateThreshold as Dl } from "./audio/noise-floor.js";
329
- import { monitorVoiceActivity as Ol } from "./audio/voice-activity.js";
330
- import { createVideoRecorder as kl, isVideoRecordingSupported as Al, pickVideoMimeType as jl } from "./capture/video-recorder.js";
331
- import { useVideoRecorder as Ml } from "./capture/use-video-recorder.js";
332
- import { isScreenCaptureSupported as Nl, useScreenCapture as Pl } from "./capture/use-screen-capture.js";
333
- import { isSpeechRecognitionSupported as Fl, useSpeechRecognition as Il } from "./capture/use-speech-recognition.js";
334
- import { createOfflineDatabase as Ll } from "./offline/create-offline-database.js";
335
- import { createOfflineSync as Rl } from "./offline/create-offline-sync.js";
336
- import { higherVersionWins as zl, lastWriteWins as Bl } from "./offline/conflict.js";
337
- import { useErrorHandler as Vl } from "./error-boundary/use-error-handler.js";
338
- import { validateForm as Hl } from "./forms/validate-form.js";
339
- import { useViaCEP as Ul } from "./forms/use-viacep.js";
340
- import { Controller as Wl, FormProvider as Gl, useFieldArray as Kl, useForm as ql, useFormContext as Jl, useFormState as Yl, useWatch as Xl } from "./forms/index.js";
341
- import { HEARTBEAT_CLOSE_CODE as Zl, isRejectionCloseCode as Ql } from "./ws/resilience.js";
342
- import { createWebSocket as $l } from "./ws/create-web-socket.js";
343
- import { useWebSocket as eu } from "./ws/use-web-socket.js";
344
- import { setTunedLocalDescription as tu, tuneOpus as nu } from "./webrtc/opus-sdp.js";
345
- import { setSenderBitrate as ru } from "./webrtc/sender-bitrate.js";
346
- import { createLinkStatsSampler as iu, readAvailableOutgoingKbps as au, readQualityLimitation as ou, readRelayed as su, readRoundTripMs as cu } from "./webrtc/link-stats.js";
347
- import { useLinkStats as lu } from "./webrtc/use-link-stats.js";
348
- import { resolveDegradation as uu, scaleForRoom as du } from "./webrtc/mesh-quality.js";
349
- import { createPeerMesh as fu } from "./webrtc/peer-mesh.js";
350
- import { clampLatitude as pu, isCoordinate as mu, isValidLatitude as hu, isValidLongitude as gu, normalizeLongitude as _u } from "./geo/types.js";
351
- import { EARTH_RADIUS_KM as vu, bearingDeg as yu, haversineKm as bu, pathLengthKm as xu, toRadians as Su } from "./geo/distance.js";
352
- import { DEFAULT_CAR_SPEED_KMH as Cu, DEFAULT_CIRCUITY_FACTOR as wu, DEFAULT_MODE_DURATION_FACTORS as Tu, estimateTravel as Eu } from "./geo/estimate.js";
353
- import { boundingBox as Du, boundsCenter as Ou, expandBounds as ku } from "./geo/bounds.js";
354
- import { fitProjection as Au, projectMercator as ju, unprojectMercator as Mu } from "./geo/projection.js";
355
- import { createOSRMBackend as Nu } from "./geo/routing.js";
356
- import { createPositionTracker as Pu } from "./geo/create-position-tracker.js";
357
- import { usePositionTracker as Fu } from "./geo/use-position-tracker.js";
358
- import { TrajectoryMap as Iu } from "./geo/TrajectoryMap.js";
359
- import { applyTheme as Lu, readThemeToken as Ru } from "./theme/apply-theme.js";
360
- import { contrastRatio as zu, createColorScale as Bu, hexToOklch as Vu, hexToRgb as Hu, hexToRgbaString as Uu, oklchToHex as Wu, readableForeground as Gu, relativeLuminance as Ku, rgbToHex as qu } from "./theme/color.js";
361
- import { createTheme as Ju, themeContrast as Yu } from "./theme/create-theme.js";
362
- import { createInverseSurface as Xu } from "./theme/inverse-surface.js";
363
- import { getThemePreset as Zu, themePresets as Qu } from "./theme/theme-presets.js";
364
- import { getInitialTheme as $u, themeInitScript as ed } from "./theme/initial-theme.js";
365
- import { consoleSink as td, createLogger as nd } from "./logger/logger.js";
366
- import { TelemetryProvider as rd, useTelemetry as id } from "./telemetry/TelemetryProvider.js";
367
- import { consoleTelemetryAdapter as ad } from "./telemetry/console-adapter.js";
368
- import { createSentryTelemetryAdapter as od } from "./telemetry/sentry-adapter.js";
369
- import { createPostHogTelemetryAdapter as sd } from "./telemetry/posthog-adapter.js";
370
- import { describeAppError as cd } from "./telemetry/describe-app-error.js";
371
- import { createAppErrorReporter as ld } from "./telemetry/app-error-reporter.js";
372
- import { createAppErrorTelemetryAdapter as ud } from "./telemetry/app-error-adapter.js";
373
- import { FeatureFlagsProvider as dd, useFeatureFlag as fd, useFlagValue as pd } from "./feature-flags/FeatureFlagsProvider.js";
374
- import { createInMemoryFlags as md } from "./feature-flags/in-memory-adapter.js";
375
- import { createGrowthBookFeatureFlagsAdapter as hd } from "./feature-flags/growthbook-adapter.js";
376
- import { createLaunchDarklyFeatureFlagsAdapter as gd } from "./feature-flags/launchdarkly-adapter.js";
377
- import { DIVERGING_STEP_COUNT as _d, ORDINAL_START_STEP as vd, SEQUENTIAL_STEP_COUNT as yd, divergingScale as bd, scaleSteps as xd, sequentialScale as Sd } from "./charts/scales.js";
378
- import { cachedResponseBytes as Cd } from "./perf/cache-size.js";
379
- import { readDeviceProfile as wd } from "./perf/device.js";
380
- import { formatDurationMs as Td } from "./perf/format.js";
381
- import { createInferenceProfiler as Ed } from "./perf/profiler.js";
382
- export { q as ABSENT_TEXT, ta as AIChat, Qi as AIChatComposer, ea as AIChatTurn, Ii as ALL_BARCODE_FORMATS, Gn as ALL_OPTION_VALUE, A as API_ERROR_OFFLINE_KEY, j as API_ERROR_VALIDATION_KEY, Ti as AUDIO_MIME_CANDIDATES, Io as AccessControlProvider, t as Accordion, n as Alert, i as AppBar, zc as AppProviders, xs as AppRouter, s as AppShell, c as AspectRatio, Ci as AudioPlayer, Fi as AudioRecorder, fe as AuthForm, vo as AuthGuard, we as AuthPage, Te as Avatar, Ee as AvatarGroup, Cs as Await, al as BACKGROUND_SYNC_CREDENTIALS_MESSAGE, a as BREAKPOINTS, De as Badge, Oe as Banner, oa as BarList, Wi as BarcodeScanner, ke as BottomNavigation, je as BottomSheet, Me as Breadcrumbs, ws as BrowserRouter, f as Button, p as ButtonSlot, qo as CACHE_TIME, ne as CEPInput, re as CNPJInput, ie as CPFInput, ei as Calendar, zo as Can, Ne as Card, oi as Carousel, Pe as Center, bi as Chat, vi as ChatBubble, yi as ChatComposer, F as Checkbox, Fe as ChipInput, Rr as ClickOutside, Mr as CodeBlock, Jr as Collapsible, Le as Combobox, Zr as Command, zr as ConditionalWrapper, ze as ConfirmDialog, qe as Container, Yr as ContextMenu, Wl as Controller, jr as CopyButton, M as DEFAULT_API_ERROR_STRINGS, se as DEFAULT_AUTH_FORM_LABELS, Li as DEFAULT_BARCODE_FORMATS, Cu as DEFAULT_CAR_SPEED_KMH, uo as DEFAULT_CHUNK_SIZE, wu as DEFAULT_CIRCUITY_FACTOR, tl as DEFAULT_CREDENTIAL_HEADERS, to as DEFAULT_CSRF_COOKIE_NAME, no as DEFAULT_CSRF_HEADER_NAME, yl as DEFAULT_MAX_GAIN, Tu as DEFAULT_MODE_DURATION_FACTORS, Sr as DEFAULT_PLAYBACK_RATES, Co as DEFAULT_PUB_KEY_CRED_PARAMS, Tt as DEFAULT_PUSH_TO_TALK_KEY, Sl as DEFAULT_VOICE_CHAIN, _d as DIVERGING_STEP_COUNT, Hr as DataList, si as DataTable, Be as DatePicker, ri as DateRangePicker, Ur as DescriptionList, m as Divider, Ve as Drawer, He as DropdownMenu, Ue as Dropzone, vu as EARTH_RADIUS_KM, We as EmptyState, Rc as ErrorBoundary, Ge as ErrorState, I as ErrorText, ce as FORGOT_PASSWORD_FIELDS, dd as FeatureFlagsProvider, Ke as FileUpload, da as FilterBar, ma as FilterPanel, li as FloatingActionButton, Br as For, xe as ForgotPasswordForm, h as Form, g as FormActions, V as FormField, Gl as FormProvider, _ as FormRow, v as FormSection, Ho as GoogleSignIn, Je as Grid, Zl as HEARTBEAT_CLOSE_CODE, Ts as HashRouter, zn as Hide, Xr as HoverCard, E as I18nProvider, Es as IDLE_BLOCKER, Ds as IDLE_FETCHER, Os as IDLE_NAVIGATION, Vr as Image, gr as ImageCropper, L as Input, rt as InstallBanner, it as InstallButton, xn as Kanban, Cn as Kbd, le as LOGIN_FIELDS, qr as Label, mi as Lightbox, ks as Link, ci as ListTile, ye as LoginForm, $i as Markdown, ra as Masonry, As as MemoryRouter, ai as Menubar, Re as Modal, wn as ModalsProvider, Pr as Money, ae as MoneyInput, ni as MultiSelect, Dn as NProgressBar, js as NavLink, En as Navbar, Ms as Navigate, ii as NavigationMenu, ui as NavigationRail, Ns as NavigationType, br as NotificationCenter, Wo as OAuthCallbackError, vd as ORDINAL_START_STEP, hn as OfflineIndicator, Ps as Outlet, Et as PUSH_TO_TALK_KEYS, jn as Page, Mn as Pagination, wo as PasskeyError, R as PasswordInput, oe as PhoneInput, B as PinInput, Nn as Popover, Ie as Portal, Pn as Progress, Dr as QRCapacityError, Ar as QRCode, Qo as QueryProvider, Jo as REFETCH_TIME, ue as RESET_PASSWORD_FIELDS, Fn as Radio, In as RadioGroup, Ln as RangeSlider, Rn as RatingStars, fi as RefreshIndicator, Nr as RelativeTime, Se as ResetPasswordForm, $r as Resizable, fo as ResumableUploadSupersededError, Lr as Reveal, Fs as Route, bs as RouteGuard, Is as Router, Ls as RouterForm, Rs as RouterProvider, zs as Routes, yd as SEQUENTIAL_STEP_COUNT, de as SIGN_UP_FIELDS, Yo as STALE_TIME, Vn as SafeArea, vr as Scheduler, Qr as ScrollArea, Bs as ScrollRestoration, Hn as SearchBar, kn as Section, An as SectionHeader, Un as SegmentedControl, Wn as Select, x as SessionSupersededError, Bn as Show, Xn as Sidebar, be as SignUpForm, hi as SignaturePad, Zn as Skeleton, ti as Slider, Qn as Spacer, _r as Sparkline, $n as Spinner, Ye as Stack, er as Stat, tr as Stepper, or as StepperInput, sr as Switch, yn as SyncStatusBadge, lr as Table, ur as Tabs, cr as Tag, rd as TelemetryProvider, S as TempestApiError, ds as TempestDataProvider, dr as Textarea, Ic as ThemeProvider, di as TimePicker, fr as Timeline, mr as ToastProvider, Wr as Toggle, Gr as ToggleGroup, Kr as ToggleGroupItem, pr as Tooltip, ia as Tour, Iu as TrajectoryMap, na as Transfer, Fr as TreeView, Ir as TruncateText, bn as UpdatePrompt, Cr as VideoPlayer, wr as VirtualList, Er as VirtualTable, vn as VisuallyHidden, qc as WebPushClient, Jc as WebPushPermissionDeniedError, Yc as WebPushUnsubscribeError, Xc as WebPushUnsupportedError, pi as Wizard, Yn as activeNavKey, Gi as aiChatStrings, jt as announce, fa as applyFilters, Sn as applyKanbanMove, Lu as applyTheme, Fa as assertNever, pe as authEmail, me as authPassword, To as base64UrlToBytes, yu as bearingDeg, Ni as blobToWav, Du as boundingBox, Ou as boundsCenter, $a as buildApiUrl, aa as buildBarListRows, Xe as buildOpenInChromeIntent, Eo as bytesToBase64Url, Cd as cachedResponseBytes, xa as camelCase, Sa as capitalize, Da as chunk, nr as clamp, pu as clampLatitude, Do as classifyPasskeyError, Mt as clearAnnouncer, ol as clearBackgroundSyncQueue, ul as clearCaches, fl as clearSessionData, e as cn, Tr as compareValues, _a as compressToString, va as compressedStorage, ya as compressedStorageCodec, td as consoleSink, ad as consoleTelemetryAdapter, zu as contrastRatio, ao as createApiClient, ld as createAppErrorReporter, ud as createAppErrorTelemetryAdapter, bl as createAudioBus, pl as createAudioPlayer, Ei as createAudioRecorder, _o as createAuthStore, Ri as createBarcodeDetector, Vs as createBrowserRouter, Bu as createColorScale, ls as createDataProvider, Bc as createEventStream, hd as createGrowthBookFeatureFlagsAdapter, Hs as createHashRouter, T as createI18n, md as createInMemoryFlags, Ed as createInferenceProfiler, Xu as createInverseSurface, ha as createJsonStorage, gd as createLaunchDarklyFeatureFlagsAdapter, ki as createLevelMeter, iu as createLinkStatsSampler, po as createLocalUploadStorage, nd as createLogger, wi as createMediaRecorder, Us as createMemoryRouter, Nu as createOSRMBackend, Ll as createOfflineDatabase, ss as createOfflineStore, Rl as createOfflineSync, nl as createPartialResponse, Oo as createPasskeyClient, Ws as createPath, fu as createPeerMesh, Pu as createPositionTracker, sd as createPostHogTelemetryAdapter, Xo as createQueryKeys, So as createRefreshQueue, mo as createResumableUpload, Bo as createRoleAccessControl, Gs as createRoutesFromChildren, Ks as createRoutesFromElements, qs as createSearchParams, Fc as createSelectors, od as createSentryTelemetryAdapter, _l as createSfxPool, Pc as createStore, Fo as createTempestAuth, Ju as createTheme, Hc as createTicketEventStream, kl as createVideoRecorder, Cl as createVoiceChain, $l as createWebSocket, ro as csrfHeaders, Js as data, Ba as debounce, yo as decodeJWT, ba as decompressFromString, ja as deepMerge, nt as defaultInstallHint, Ss as defineRoutes, N as describeApiError, cd as describeAppError, sa as describeFilter, bd as divergingScale, Za as downloadCsv, $o as emptyOffsetPage, us as encodeIdSegment, Or as encodeQR, Pi as encodeWav, z as estimatePasswordStrength, sn as estimateStorage, Eu as estimateTravel, Go as exchangeOAuthCallback, ku as expandBounds, ca as filtersFromSearchParams, pa as filtersToQueryParams, la as filtersToSearchParams, Au as fitProjection, he as forgotPasswordSchema, rr as formatBytes, H as formatCEP, U as formatCNPJ, J as formatCPF, ir as formatCompactNumber, Y as formatCurrency, X as formatDate, Z as formatDateForInput, Q as formatDateTime, $ as formatDateTimeForInput, Td as formatDurationMs, ee as formatPercent, te as formatPhone, lo as generateIdempotencyKey, Ys as generatePath, $u as getInitialTheme, zi as getSupportedBarcodeFormats, Zu as getThemePreset, Oa as groupBy, bu as haversineKm, Vu as hexToOklch, Hu as hexToRgb, Uu as hexToRgbaString, zl as higherVersionWins, dl as inspectCaches, sl as installBackgroundSync, Qc as installNotificationClickHandler, rl as installPrecache, $c as installPushHandler, il as installRuntimeCache, el as installSkipWaitingListener, Ze as isAndroid, Qe as isAndroidWithoutPromptApi, C as isApiError, xi as isAudioOutputSelectionSupported, Di as isAudioRecordingSupported, Bi as isBarcodeDetectionSupported, ko as isConditionalMediationAvailable, mu as isCoordinate, es as isCursorPage, Ia as isDefined, Ma as isEmpty, Ct as isFullscreenSupported, Ki as isGenerating, $e as isIOS, bo as isJWTExpired, ji as isMediaCaptureSupported, La as isNumber, ts as isOffsetPage, Ao as isPasskeySupported, Ra as isPlainObject, jo as isPlatformAuthenticatorAvailable, Gc as isPushSupported, Ql as isRejectionCloseCode, w as isRetriableStatus, Uc as isRetriableTicketError, Xs as isRouteErrorResponse, Nl as isScreenCaptureSupported, Ja as isShareSupported, Fl as isSpeechRecognitionSupported, et as isStandalone, za as isString, eo as isTrustedCredentialTarget, hu as isValidLatitude, gu as isValidLongitude, Al as isVideoRecordingSupported, wl as isVoiceChainIdle, Ca as kebabCase, qi as lastAssistantId, Bl as lastWriteWins, xo as lazyWithRetry, ps as listQueryKey, ge as loginSchema, Zs as matchPath, Qs as matchRoutes, kr as matrixToPath, El as measureNoiseFloor, Va as memoizeOne, Ol as monitorVoiceActivity, Tl as monitorVoiceChain, un as moveItem, Vi as normalizeBarcode, _u as normalizeLongitude, On as nprogress, Wu as oklchToHex, Na as omit, Ha as once, ms as oneQueryKey, ua as operatorsFor, $s as parsePath, oo as parseResponse, xu as pathLengthKm, ar as percentOf, Vo as permissionsFromToken, cs as persistQueryClientOffline, Pa as pick, Oi as pickAudioMimeType, jl as pickVideoMimeType, ml as playAudio, wa as pluralize, ju as projectMercator, cl as provideBackgroundSyncCredentials, Dt as pushToTalkKeyLabel, Ka as randomId, ka as range, au as readAvailableOutgoingKbps, wd as readDeviceProfile, Ko as readOAuthCallbackParams, ou as readQualityLimitation, su as readRelayed, cu as readRoundTripMs, Ru as readThemeToken, Gu as readableForeground, gi as receiptLabel, ec as redirect, tc as redirectDocument, ll as registerPeriodicSync, nn as registerServiceWorker, Ku as relativeLuminance, yr as relativeTime, as as removeById, nc as renderMatches, rc as replace, cn as requestPersistentStorage, _e as resetPasswordSchema, uu as resolveDegradation, ic as resolvePath, _i as resolveReceiptState, io as retry, qu as rgbToHex, Ji as roleLabel, l as safeAttachmentUrl, u as safeImageUrl, d as safeLinkUrl, du as scaleForRoom, xd as scaleSteps, Sd as sequentialScale, Si as setAudioOutput, r as setDevBuild, ru as setSenderBitrate, tu as setTunedLocalDescription, Ya as share, Xa as shareOrDownloadBlob, Zo as shouldRetryQuery, ve as signUpSchema, rn as skipWaiting, Wa as sleep, Ta as slugify, hl as stopAudio, ga as storage, Dl as suggestGateThreshold, Yi as tailSignature, Yu as themeContrast, ed as themeInitScript, Qu as themePresets, Ua as throttle, Qa as toCsv, Kn as toOptions, Su as toRadians, Ea as truncate, nu as tuneOpus, Xi as turnTime, Aa as uniqueBy, W as unmask, Mu as unprojectMercator, an as unregisterAllServiceWorkers, ho as uploadFingerprint, co as uploadPresignedPost, so as uploadWithProgress, os as upsertById, Kc as urlBase64ToUint8Array, Lo as useAccessControl, ac as useActionData, Nt as useAnnounce, mt as useAsync, oc as useAsyncError, sc as useAsyncValue, gl as useAudio, xl as useAudioBus, Ai as useAudioRecorder, Ui as useBarcodeScanner, xt as useBeforeInstallPrompt, cc as useBeforeUnload, lc as useBlocker, o as useBreakpoint, Ro as useCan, Qt as useClickOutside, st as useClientFilter, yt as useClipboard, Gt as useCountdown, Wt as useCounter, hs as useCreate, rs as useCursorQuery, fs as useDataProvider, at as useDebounce, ct as useDeepMemo, gs as useDelete, P as useDescribeApiError, Ht as useDisclosure, qt as useDocumentTitle, gt as useDocumentVisibility, ut as useDraftFilters, Vl as useErrorHandler, dt as useEventListener, Vc as useEventStream, Jt as useFavicon, fd as useFeatureFlag, uc as useFetcher, dc as useFetchers, Kl as useFieldArray, pd as useFlagValue, Ae as useFocusTrap, ql as useForm, fc as useFormAction, Jl as useFormContext, Yl as useFormState, wt as useFullscreen, kt as useGeolocation, Bt as useHover, pc as useHref, D as useI18n, St as useIdle, mc as useInRouterContext, tt as useInstallPrompt, _t as useIntersectionObserver, It as useInterval, $t as useIsFirstRender, bt as useKeyboardShortcut, lt as useLatestRef, hc as useLinkClickHandler, lu as useLinkStats, _s as useList, Ut as useListState, gc as useLoaderData, ft as useLocalStorage, _c as useLocation, Vt as useLongPress, tn as useLongPressHandlers, Yt as useMap, vc as useMatch, yc as useMatches, mn as useMediaDevices, pn as useMediaPermission, Ce as useMediaQuery, Mi as useMicrophone, Tn as useModals, bc as useNavigate, xc as useNavigation, Sc as useNavigationType, xr as useNotificationInbox, Uo as useOAuthCallback, en as useObjectUrl, is as useOfflineMutation, gn as useOfflineSync, vs as useOne, ht as useOnline, O as useOptionalI18n, Cc as useOutlet, wc as useOutletContext, ns as usePaginatedQuery, ot as usePagination, Tc as useParams, Mo as usePasskeyCapabilities, No as usePasskeyRegistration, Po as usePasskeySignIn, go as usePoll, Fu as usePositionTracker, Ft as usePrevious, Zc as usePushSubscription, Ot as usePushToTalk, Zt as useQueue, vt as useResizeObserver, Ec as useResolvedPath, Dc as useRevalidator, Oc as useRouteError, kc as useRouteLoaderData, Ac as useRoutes, Pl as useScreenCapture, At as useScrollLock, fn as useScrollOverflow, jc as useSearchParams, on as useServiceWorkerUpdate, Xt as useSet, vl as useSfxPool, dn as useSortable, Il as useSpeechRecognition, Pt as useStableCallback, ln as useStorageEstimate, Mc as useSubmit, _n as useSyncStatus, id as useTelemetry, Lc as useTheme, Rt as useThrottle, Wc as useTicketEventStream, Lt as useTimeout, hr as useToast, pt as useToggle, Hi as useTorch, k as useTranslate, Kt as useTypewriter, ys as useUpdate, Ul as useViaCEP, Ml as useVideoRecorder, Nc as useViewTransitionState, Xl as useWatch, eu as useWebSocket, zt as useWindowSize, b as useZodForm, G as validateCNPJ, K as validateCPF, Hl as validateForm, Zi as visibleTurns, qn as withAllOption, Jn as withEmptyOption, Ga as withTimeout, qa as writeXlsx, y as zodResolver };
286
+ import { isFinalPaymentStatus as qo } from "./payments/types.js";
287
+ import { CARD_STATUS_DETAIL_MESSAGES as Jo, describeCardCharge as Yo } from "./payments/outcome.js";
288
+ import { MERCADO_PAGO_SCRIPT_URL as Xo, loadMercadoPago as Zo } from "./payments/mercado-pago.js";
289
+ import { useMercadoPagoCard as Qo } from "./payments/use-mercado-pago-card.js";
290
+ import { usePixCharge as $o } from "./payments/use-pix-charge.js";
291
+ import { formatPixRemaining as es } from "./payments/format.js";
292
+ import { PixCheckout as ts } from "./payments/PixCheckout.js";
293
+ import { CACHE_TIME as ns, REFETCH_TIME as rs, STALE_TIME as is } from "./query/constants.js";
294
+ import { createQueryKeys as as } from "./query/create-query-keys.js";
295
+ import { shouldRetryQuery as os } from "./query/retry-policy.js";
296
+ import { QueryProvider as ss } from "./query/QueryProvider.js";
297
+ import { emptyOffsetPage as cs, isCursorPage as ls, isOffsetPage as us } from "./query/pagination.js";
298
+ import { usePaginatedQuery as ds } from "./query/use-paginated-query.js";
299
+ import { useCursorQuery as fs } from "./query/use-cursor-query.js";
300
+ import { useOfflineMutation as ps } from "./query/use-offline-mutation.js";
301
+ import { removeById as ms, upsertById as hs } from "./query/optimistic.js";
302
+ import { createOfflineStore as gs } from "./offline/create-offline-store.js";
303
+ import { persistQueryClientOffline as _s } from "./query/offline-persistence.js";
304
+ import { createDataProvider as vs, encodeIdSegment as ys } from "./data/create-data-provider.js";
305
+ import { TempestDataProvider as bs, useDataProvider as xs } from "./data/data-provider-context.js";
306
+ import { listQueryKey as Ss, oneQueryKey as Cs, useCreate as ws, useDelete as Ts, useList as Es, useOne as Ds, useUpdate as Os } from "./data/use-resource.js";
307
+ import { RouteGuard as ks } from "./router/RouteGuard.js";
308
+ import { AppRouter as As, defineRoutes as js } from "./router/AppRouter.js";
309
+ import { Await as Ms, BrowserRouter as Ns, HashRouter as Ps, IDLE_BLOCKER as Fs, IDLE_FETCHER as Is, IDLE_NAVIGATION as Ls, Link as Rs, MemoryRouter as zs, NavLink as Bs, Navigate as Vs, NavigationType as Hs, Outlet as Us, Route as Ws, Router as Gs, RouterForm as Ks, RouterProvider as qs, Routes as Js, ScrollRestoration as Ys, createBrowserRouter as Xs, createHashRouter as Zs, createMemoryRouter as Qs, createPath as $s, createRoutesFromChildren as ec, createRoutesFromElements as tc, createSearchParams as nc, data as rc, generatePath as ic, isRouteErrorResponse as ac, matchPath as oc, matchRoutes as sc, parsePath as cc, redirect as lc, redirectDocument as uc, renderMatches as dc, replace as fc, resolvePath as pc, useActionData as mc, useAsyncError as hc, useAsyncValue as gc, useBeforeUnload as _c, useBlocker as vc, useFetcher as yc, useFetchers as bc, useFormAction as xc, useHref as Sc, useInRouterContext as Cc, useLinkClickHandler as wc, useLoaderData as Tc, useLocation as Ec, useMatch as Dc, useMatches as Oc, useNavigate as kc, useNavigation as Ac, useNavigationType as jc, useOutlet as Mc, useOutletContext as Nc, useParams as Pc, useResolvedPath as Fc, useRevalidator as Ic, useRouteError as Lc, useRouteLoaderData as Rc, useRoutes as zc, useSearchParams as Bc, useSubmit as Vc, useViewTransitionState as Hc } from "./router/index.js";
310
+ import { createStore as Uc } from "./store/create-store.js";
311
+ import { createSelectors as Wc } from "./store/create-selectors.js";
312
+ import { ThemeProvider as Gc, useTheme as Kc } from "./theme/ThemeProvider.js";
313
+ import { ErrorBoundary as qc } from "./error-boundary/ErrorBoundary.js";
314
+ import { AppProviders as Jc } from "./app/AppProviders.js";
315
+ import { createEventStream as Yc } from "./sse/create-event-stream.js";
316
+ import { useEventStream as Xc } from "./sse/use-event-stream.js";
317
+ import { createTicketEventStream as Zc, isRetriableTicketError as Qc, useTicketEventStream as $c } from "./sse/ticket-event-stream.js";
318
+ import { isPushSupported as el, urlBase64ToUint8Array as tl } from "./push/utils.js";
319
+ import { WebPushClient as nl, WebPushPermissionDeniedError as rl, WebPushUnsubscribeError as il, WebPushUnsupportedError as al } from "./push/web-push-client.js";
320
+ import { usePushSubscription as ol } from "./push/use-push-subscription.js";
321
+ import { installNotificationClickHandler as sl, installPushHandler as cl, installSkipWaitingListener as ll } from "./sw/create-push-handler.js";
322
+ import { DEFAULT_CREDENTIAL_HEADERS as ul } from "./sw/credential-headers.js";
323
+ import { createPartialResponse as dl, installPrecache as fl, installRuntimeCache as pl } from "./sw/cache.js";
324
+ import { BACKGROUND_SYNC_CREDENTIALS_MESSAGE as ml, clearBackgroundSyncQueue as hl, installBackgroundSync as gl, provideBackgroundSyncCredentials as _l } from "./sw/background-sync.js";
325
+ import { registerPeriodicSync as vl } from "./sw/periodic-sync.js";
326
+ import { clearCaches as yl, inspectCaches as bl } from "./sw/cache-inspect.js";
327
+ import { clearSessionData as xl } from "./sw/session-data.js";
328
+ import { createAudioPlayer as Sl, playAudio as Cl, stopAudio as wl } from "./audio/audio-player.js";
329
+ import { useAudio as Tl } from "./audio/use-audio.js";
330
+ import { createSfxPool as El } from "./audio/sfx-pool.js";
331
+ import { useSfxPool as Dl } from "./audio/use-sfx-pool.js";
332
+ import { DEFAULT_MAX_GAIN as Ol, createAudioBus as kl } from "./audio/audio-bus.js";
333
+ import { useAudioBus as Al } from "./audio/use-audio-bus.js";
334
+ import { DEFAULT_VOICE_CHAIN as jl, createVoiceChain as Ml, isVoiceChainIdle as Nl, monitorVoiceChain as Pl } from "./audio/voice-chain.js";
335
+ import { measureNoiseFloor as Fl, suggestGateThreshold as Il } from "./audio/noise-floor.js";
336
+ import { monitorVoiceActivity as Ll } from "./audio/voice-activity.js";
337
+ import { createVideoRecorder as Rl, isVideoRecordingSupported as zl, pickVideoMimeType as Bl } from "./capture/video-recorder.js";
338
+ import { useVideoRecorder as Vl } from "./capture/use-video-recorder.js";
339
+ import { isScreenCaptureSupported as Hl, useScreenCapture as Ul } from "./capture/use-screen-capture.js";
340
+ import { isSpeechRecognitionSupported as Wl, useSpeechRecognition as Gl } from "./capture/use-speech-recognition.js";
341
+ import { createOfflineDatabase as Kl } from "./offline/create-offline-database.js";
342
+ import { createOfflineSync as ql } from "./offline/create-offline-sync.js";
343
+ import { higherVersionWins as Jl, lastWriteWins as Yl } from "./offline/conflict.js";
344
+ import { useErrorHandler as Xl } from "./error-boundary/use-error-handler.js";
345
+ import { validateForm as Zl } from "./forms/validate-form.js";
346
+ import { useViaCEP as Ql } from "./forms/use-viacep.js";
347
+ import { Controller as $l, FormProvider as eu, useFieldArray as tu, useForm as nu, useFormContext as ru, useFormState as iu, useWatch as au } from "./forms/index.js";
348
+ import { HEARTBEAT_CLOSE_CODE as ou, isRejectionCloseCode as su } from "./ws/resilience.js";
349
+ import { createWebSocket as cu } from "./ws/create-web-socket.js";
350
+ import { useWebSocket as lu } from "./ws/use-web-socket.js";
351
+ import { setTunedLocalDescription as uu, tuneOpus as du } from "./webrtc/opus-sdp.js";
352
+ import { setSenderBitrate as fu } from "./webrtc/sender-bitrate.js";
353
+ import { createLinkStatsSampler as pu, readAvailableOutgoingKbps as mu, readQualityLimitation as hu, readRelayed as gu, readRoundTripMs as _u } from "./webrtc/link-stats.js";
354
+ import { useLinkStats as vu } from "./webrtc/use-link-stats.js";
355
+ import { resolveDegradation as yu, scaleForRoom as bu } from "./webrtc/mesh-quality.js";
356
+ import { createPeerMesh as xu } from "./webrtc/peer-mesh.js";
357
+ import { clampLatitude as Su, isCoordinate as Cu, isValidLatitude as wu, isValidLongitude as Tu, normalizeLongitude as Eu } from "./geo/types.js";
358
+ import { EARTH_RADIUS_KM as Du, bearingDeg as Ou, haversineKm as ku, pathLengthKm as Au, toRadians as ju } from "./geo/distance.js";
359
+ import { DEFAULT_CAR_SPEED_KMH as Mu, DEFAULT_CIRCUITY_FACTOR as Nu, DEFAULT_MODE_DURATION_FACTORS as Pu, estimateTravel as Fu } from "./geo/estimate.js";
360
+ import { boundingBox as Iu, boundsCenter as Lu, expandBounds as Ru } from "./geo/bounds.js";
361
+ import { fitProjection as zu, projectMercator as Bu, unprojectMercator as Vu } from "./geo/projection.js";
362
+ import { createOSRMBackend as Hu } from "./geo/routing.js";
363
+ import { createPositionTracker as Uu } from "./geo/create-position-tracker.js";
364
+ import { usePositionTracker as Wu } from "./geo/use-position-tracker.js";
365
+ import { TrajectoryMap as Gu } from "./geo/TrajectoryMap.js";
366
+ import { applyTheme as Ku, readThemeToken as qu } from "./theme/apply-theme.js";
367
+ import { contrastRatio as Ju, createColorScale as Yu, hexToOklch as Xu, hexToRgb as Zu, hexToRgbaString as Qu, oklchToHex as $u, readableForeground as ed, relativeLuminance as td, rgbToHex as nd } from "./theme/color.js";
368
+ import { createTheme as rd, themeContrast as id } from "./theme/create-theme.js";
369
+ import { createInverseSurface as ad } from "./theme/inverse-surface.js";
370
+ import { getThemePreset as od, themePresets as sd } from "./theme/theme-presets.js";
371
+ import { getInitialTheme as cd, themeInitScript as ld } from "./theme/initial-theme.js";
372
+ import { consoleSink as ud, createLogger as dd } from "./logger/logger.js";
373
+ import { TelemetryProvider as fd, useTelemetry as pd } from "./telemetry/TelemetryProvider.js";
374
+ import { consoleTelemetryAdapter as md } from "./telemetry/console-adapter.js";
375
+ import { createSentryTelemetryAdapter as hd } from "./telemetry/sentry-adapter.js";
376
+ import { createPostHogTelemetryAdapter as gd } from "./telemetry/posthog-adapter.js";
377
+ import { describeAppError as _d } from "./telemetry/describe-app-error.js";
378
+ import { createAppErrorReporter as vd } from "./telemetry/app-error-reporter.js";
379
+ import { createAppErrorTelemetryAdapter as yd } from "./telemetry/app-error-adapter.js";
380
+ import { FeatureFlagsProvider as bd, useFeatureFlag as xd, useFlagValue as Sd } from "./feature-flags/FeatureFlagsProvider.js";
381
+ import { createInMemoryFlags as Cd } from "./feature-flags/in-memory-adapter.js";
382
+ import { createGrowthBookFeatureFlagsAdapter as wd } from "./feature-flags/growthbook-adapter.js";
383
+ import { createLaunchDarklyFeatureFlagsAdapter as Td } from "./feature-flags/launchdarkly-adapter.js";
384
+ import { DIVERGING_STEP_COUNT as Ed, ORDINAL_START_STEP as Dd, SEQUENTIAL_STEP_COUNT as Od, divergingScale as kd, scaleSteps as Ad, sequentialScale as jd } from "./charts/scales.js";
385
+ import { cachedResponseBytes as Md } from "./perf/cache-size.js";
386
+ import { readDeviceProfile as Nd } from "./perf/device.js";
387
+ import { formatDurationMs as Pd } from "./perf/format.js";
388
+ import { createInferenceProfiler as Fd } from "./perf/profiler.js";
389
+ export { q as ABSENT_TEXT, ta as AIChat, Qi as AIChatComposer, ea as AIChatTurn, Ii as ALL_BARCODE_FORMATS, Gn as ALL_OPTION_VALUE, A as API_ERROR_OFFLINE_KEY, j as API_ERROR_VALIDATION_KEY, Ti as AUDIO_MIME_CANDIDATES, Io as AccessControlProvider, t as Accordion, n as Alert, i as AppBar, Jc as AppProviders, As as AppRouter, s as AppShell, c as AspectRatio, Ci as AudioPlayer, Fi as AudioRecorder, fe as AuthForm, vo as AuthGuard, we as AuthPage, Te as Avatar, Ee as AvatarGroup, Ms as Await, ml as BACKGROUND_SYNC_CREDENTIALS_MESSAGE, a as BREAKPOINTS, De as Badge, Oe as Banner, oa as BarList, Wi as BarcodeScanner, ke as BottomNavigation, je as BottomSheet, Me as Breadcrumbs, Ns as BrowserRouter, f as Button, p as ButtonSlot, ns as CACHE_TIME, Jo as CARD_STATUS_DETAIL_MESSAGES, ne as CEPInput, re as CNPJInput, ie as CPFInput, ei as Calendar, zo as Can, Ne as Card, oi as Carousel, Pe as Center, bi as Chat, vi as ChatBubble, yi as ChatComposer, F as Checkbox, Fe as ChipInput, Rr as ClickOutside, Mr as CodeBlock, Jr as Collapsible, Le as Combobox, Zr as Command, zr as ConditionalWrapper, ze as ConfirmDialog, qe as Container, Yr as ContextMenu, $l as Controller, jr as CopyButton, M as DEFAULT_API_ERROR_STRINGS, se as DEFAULT_AUTH_FORM_LABELS, Li as DEFAULT_BARCODE_FORMATS, Mu as DEFAULT_CAR_SPEED_KMH, uo as DEFAULT_CHUNK_SIZE, Nu as DEFAULT_CIRCUITY_FACTOR, ul as DEFAULT_CREDENTIAL_HEADERS, to as DEFAULT_CSRF_COOKIE_NAME, no as DEFAULT_CSRF_HEADER_NAME, Ol as DEFAULT_MAX_GAIN, Pu as DEFAULT_MODE_DURATION_FACTORS, Sr as DEFAULT_PLAYBACK_RATES, Co as DEFAULT_PUB_KEY_CRED_PARAMS, Tt as DEFAULT_PUSH_TO_TALK_KEY, jl as DEFAULT_VOICE_CHAIN, Ed as DIVERGING_STEP_COUNT, Hr as DataList, si as DataTable, Be as DatePicker, ri as DateRangePicker, Ur as DescriptionList, m as Divider, Ve as Drawer, He as DropdownMenu, Ue as Dropzone, Du as EARTH_RADIUS_KM, We as EmptyState, qc as ErrorBoundary, Ge as ErrorState, I as ErrorText, ce as FORGOT_PASSWORD_FIELDS, bd as FeatureFlagsProvider, Ke as FileUpload, da as FilterBar, ma as FilterPanel, li as FloatingActionButton, Br as For, xe as ForgotPasswordForm, h as Form, g as FormActions, V as FormField, eu as FormProvider, _ as FormRow, v as FormSection, Ho as GoogleSignIn, Je as Grid, ou as HEARTBEAT_CLOSE_CODE, Ps as HashRouter, zn as Hide, Xr as HoverCard, E as I18nProvider, Fs as IDLE_BLOCKER, Is as IDLE_FETCHER, Ls as IDLE_NAVIGATION, Vr as Image, gr as ImageCropper, L as Input, rt as InstallBanner, it as InstallButton, xn as Kanban, Cn as Kbd, le as LOGIN_FIELDS, qr as Label, mi as Lightbox, Rs as Link, ci as ListTile, ye as LoginForm, Xo as MERCADO_PAGO_SCRIPT_URL, $i as Markdown, ra as Masonry, zs as MemoryRouter, ai as Menubar, Re as Modal, wn as ModalsProvider, Pr as Money, ae as MoneyInput, ni as MultiSelect, Dn as NProgressBar, Bs as NavLink, En as Navbar, Vs as Navigate, ii as NavigationMenu, ui as NavigationRail, Hs as NavigationType, br as NotificationCenter, Wo as OAuthCallbackError, Dd as ORDINAL_START_STEP, hn as OfflineIndicator, Us as Outlet, Et as PUSH_TO_TALK_KEYS, jn as Page, Mn as Pagination, wo as PasskeyError, R as PasswordInput, oe as PhoneInput, B as PinInput, ts as PixCheckout, Nn as Popover, Ie as Portal, Pn as Progress, Dr as QRCapacityError, Ar as QRCode, ss as QueryProvider, rs as REFETCH_TIME, ue as RESET_PASSWORD_FIELDS, Fn as Radio, In as RadioGroup, Ln as RangeSlider, Rn as RatingStars, fi as RefreshIndicator, Nr as RelativeTime, Se as ResetPasswordForm, $r as Resizable, fo as ResumableUploadSupersededError, Lr as Reveal, Ws as Route, ks as RouteGuard, Gs as Router, Ks as RouterForm, qs as RouterProvider, Js as Routes, Od as SEQUENTIAL_STEP_COUNT, de as SIGN_UP_FIELDS, is as STALE_TIME, Vn as SafeArea, vr as Scheduler, Qr as ScrollArea, Ys as ScrollRestoration, Hn as SearchBar, kn as Section, An as SectionHeader, Un as SegmentedControl, Wn as Select, x as SessionSupersededError, Bn as Show, Xn as Sidebar, be as SignUpForm, hi as SignaturePad, Zn as Skeleton, ti as Slider, Qn as Spacer, _r as Sparkline, $n as Spinner, Ye as Stack, er as Stat, tr as Stepper, or as StepperInput, sr as Switch, yn as SyncStatusBadge, lr as Table, ur as Tabs, cr as Tag, fd as TelemetryProvider, S as TempestApiError, bs as TempestDataProvider, dr as Textarea, Gc as ThemeProvider, di as TimePicker, fr as Timeline, mr as ToastProvider, Wr as Toggle, Gr as ToggleGroup, Kr as ToggleGroupItem, pr as Tooltip, ia as Tour, Gu as TrajectoryMap, na as Transfer, Fr as TreeView, Ir as TruncateText, bn as UpdatePrompt, Cr as VideoPlayer, wr as VirtualList, Er as VirtualTable, vn as VisuallyHidden, nl as WebPushClient, rl as WebPushPermissionDeniedError, il as WebPushUnsubscribeError, al as WebPushUnsupportedError, pi as Wizard, Yn as activeNavKey, Gi as aiChatStrings, jt as announce, fa as applyFilters, Sn as applyKanbanMove, Ku as applyTheme, Fa as assertNever, pe as authEmail, me as authPassword, To as base64UrlToBytes, Ou as bearingDeg, Ni as blobToWav, Iu as boundingBox, Lu as boundsCenter, $a as buildApiUrl, aa as buildBarListRows, Xe as buildOpenInChromeIntent, Eo as bytesToBase64Url, Md as cachedResponseBytes, xa as camelCase, Sa as capitalize, Da as chunk, nr as clamp, Su as clampLatitude, Do as classifyPasskeyError, Mt as clearAnnouncer, hl as clearBackgroundSyncQueue, yl as clearCaches, xl as clearSessionData, e as cn, Tr as compareValues, _a as compressToString, va as compressedStorage, ya as compressedStorageCodec, ud as consoleSink, md as consoleTelemetryAdapter, Ju as contrastRatio, ao as createApiClient, vd as createAppErrorReporter, yd as createAppErrorTelemetryAdapter, kl as createAudioBus, Sl as createAudioPlayer, Ei as createAudioRecorder, _o as createAuthStore, Ri as createBarcodeDetector, Xs as createBrowserRouter, Yu as createColorScale, vs as createDataProvider, Yc as createEventStream, wd as createGrowthBookFeatureFlagsAdapter, Zs as createHashRouter, T as createI18n, Cd as createInMemoryFlags, Fd as createInferenceProfiler, ad as createInverseSurface, ha as createJsonStorage, Td as createLaunchDarklyFeatureFlagsAdapter, ki as createLevelMeter, pu as createLinkStatsSampler, po as createLocalUploadStorage, dd as createLogger, wi as createMediaRecorder, Qs as createMemoryRouter, Hu as createOSRMBackend, Kl as createOfflineDatabase, gs as createOfflineStore, ql as createOfflineSync, dl as createPartialResponse, Oo as createPasskeyClient, $s as createPath, xu as createPeerMesh, Uu as createPositionTracker, gd as createPostHogTelemetryAdapter, as as createQueryKeys, So as createRefreshQueue, mo as createResumableUpload, Bo as createRoleAccessControl, ec as createRoutesFromChildren, tc as createRoutesFromElements, nc as createSearchParams, Wc as createSelectors, hd as createSentryTelemetryAdapter, El as createSfxPool, Uc as createStore, Fo as createTempestAuth, rd as createTheme, Zc as createTicketEventStream, Rl as createVideoRecorder, Ml as createVoiceChain, cu as createWebSocket, ro as csrfHeaders, rc as data, Ba as debounce, yo as decodeJWT, ba as decompressFromString, ja as deepMerge, nt as defaultInstallHint, js as defineRoutes, N as describeApiError, _d as describeAppError, Yo as describeCardCharge, sa as describeFilter, kd as divergingScale, Za as downloadCsv, cs as emptyOffsetPage, ys as encodeIdSegment, Or as encodeQR, Pi as encodeWav, z as estimatePasswordStrength, sn as estimateStorage, Fu as estimateTravel, Go as exchangeOAuthCallback, Ru as expandBounds, ca as filtersFromSearchParams, pa as filtersToQueryParams, la as filtersToSearchParams, zu as fitProjection, he as forgotPasswordSchema, rr as formatBytes, H as formatCEP, U as formatCNPJ, J as formatCPF, ir as formatCompactNumber, Y as formatCurrency, X as formatDate, Z as formatDateForInput, Q as formatDateTime, $ as formatDateTimeForInput, Pd as formatDurationMs, ee as formatPercent, te as formatPhone, es as formatPixRemaining, lo as generateIdempotencyKey, ic as generatePath, cd as getInitialTheme, zi as getSupportedBarcodeFormats, od as getThemePreset, Oa as groupBy, ku as haversineKm, Xu as hexToOklch, Zu as hexToRgb, Qu as hexToRgbaString, Jl as higherVersionWins, bl as inspectCaches, gl as installBackgroundSync, sl as installNotificationClickHandler, fl as installPrecache, cl as installPushHandler, pl as installRuntimeCache, ll as installSkipWaitingListener, Ze as isAndroid, Qe as isAndroidWithoutPromptApi, C as isApiError, xi as isAudioOutputSelectionSupported, Di as isAudioRecordingSupported, Bi as isBarcodeDetectionSupported, ko as isConditionalMediationAvailable, Cu as isCoordinate, ls as isCursorPage, Ia as isDefined, Ma as isEmpty, qo as isFinalPaymentStatus, Ct as isFullscreenSupported, Ki as isGenerating, $e as isIOS, bo as isJWTExpired, ji as isMediaCaptureSupported, La as isNumber, us as isOffsetPage, Ao as isPasskeySupported, Ra as isPlainObject, jo as isPlatformAuthenticatorAvailable, el as isPushSupported, su as isRejectionCloseCode, w as isRetriableStatus, Qc as isRetriableTicketError, ac as isRouteErrorResponse, Hl as isScreenCaptureSupported, Ja as isShareSupported, Wl as isSpeechRecognitionSupported, et as isStandalone, za as isString, eo as isTrustedCredentialTarget, wu as isValidLatitude, Tu as isValidLongitude, zl as isVideoRecordingSupported, Nl as isVoiceChainIdle, Ca as kebabCase, qi as lastAssistantId, Yl as lastWriteWins, xo as lazyWithRetry, Ss as listQueryKey, Zo as loadMercadoPago, ge as loginSchema, oc as matchPath, sc as matchRoutes, kr as matrixToPath, Fl as measureNoiseFloor, Va as memoizeOne, Ll as monitorVoiceActivity, Pl as monitorVoiceChain, un as moveItem, Vi as normalizeBarcode, Eu as normalizeLongitude, On as nprogress, $u as oklchToHex, Na as omit, Ha as once, Cs as oneQueryKey, ua as operatorsFor, cc as parsePath, oo as parseResponse, Au as pathLengthKm, ar as percentOf, Vo as permissionsFromToken, _s as persistQueryClientOffline, Pa as pick, Oi as pickAudioMimeType, Bl as pickVideoMimeType, Cl as playAudio, wa as pluralize, Bu as projectMercator, _l as provideBackgroundSyncCredentials, Dt as pushToTalkKeyLabel, Ka as randomId, ka as range, mu as readAvailableOutgoingKbps, Nd as readDeviceProfile, Ko as readOAuthCallbackParams, hu as readQualityLimitation, gu as readRelayed, _u as readRoundTripMs, qu as readThemeToken, ed as readableForeground, gi as receiptLabel, lc as redirect, uc as redirectDocument, vl as registerPeriodicSync, nn as registerServiceWorker, td as relativeLuminance, yr as relativeTime, ms as removeById, dc as renderMatches, fc as replace, cn as requestPersistentStorage, _e as resetPasswordSchema, yu as resolveDegradation, pc as resolvePath, _i as resolveReceiptState, io as retry, nd as rgbToHex, Ji as roleLabel, l as safeAttachmentUrl, u as safeImageUrl, d as safeLinkUrl, bu as scaleForRoom, Ad as scaleSteps, jd as sequentialScale, Si as setAudioOutput, r as setDevBuild, fu as setSenderBitrate, uu as setTunedLocalDescription, Ya as share, Xa as shareOrDownloadBlob, os as shouldRetryQuery, ve as signUpSchema, rn as skipWaiting, Wa as sleep, Ta as slugify, wl as stopAudio, ga as storage, Il as suggestGateThreshold, Yi as tailSignature, id as themeContrast, ld as themeInitScript, sd as themePresets, Ua as throttle, Qa as toCsv, Kn as toOptions, ju as toRadians, Ea as truncate, du as tuneOpus, Xi as turnTime, Aa as uniqueBy, W as unmask, Vu as unprojectMercator, an as unregisterAllServiceWorkers, ho as uploadFingerprint, co as uploadPresignedPost, so as uploadWithProgress, hs as upsertById, tl as urlBase64ToUint8Array, Lo as useAccessControl, mc as useActionData, Nt as useAnnounce, mt as useAsync, hc as useAsyncError, gc as useAsyncValue, Tl as useAudio, Al as useAudioBus, Ai as useAudioRecorder, Ui as useBarcodeScanner, xt as useBeforeInstallPrompt, _c as useBeforeUnload, vc as useBlocker, o as useBreakpoint, Ro as useCan, Qt as useClickOutside, st as useClientFilter, yt as useClipboard, Gt as useCountdown, Wt as useCounter, ws as useCreate, fs as useCursorQuery, xs as useDataProvider, at as useDebounce, ct as useDeepMemo, Ts as useDelete, P as useDescribeApiError, Ht as useDisclosure, qt as useDocumentTitle, gt as useDocumentVisibility, ut as useDraftFilters, Xl as useErrorHandler, dt as useEventListener, Xc as useEventStream, Jt as useFavicon, xd as useFeatureFlag, yc as useFetcher, bc as useFetchers, tu as useFieldArray, Sd as useFlagValue, Ae as useFocusTrap, nu as useForm, xc as useFormAction, ru as useFormContext, iu as useFormState, wt as useFullscreen, kt as useGeolocation, Bt as useHover, Sc as useHref, D as useI18n, St as useIdle, Cc as useInRouterContext, tt as useInstallPrompt, _t as useIntersectionObserver, It as useInterval, $t as useIsFirstRender, bt as useKeyboardShortcut, lt as useLatestRef, wc as useLinkClickHandler, vu as useLinkStats, Es as useList, Ut as useListState, Tc as useLoaderData, ft as useLocalStorage, Ec as useLocation, Vt as useLongPress, tn as useLongPressHandlers, Yt as useMap, Dc as useMatch, Oc as useMatches, mn as useMediaDevices, pn as useMediaPermission, Ce as useMediaQuery, Qo as useMercadoPagoCard, Mi as useMicrophone, Tn as useModals, kc as useNavigate, Ac as useNavigation, jc as useNavigationType, xr as useNotificationInbox, Uo as useOAuthCallback, en as useObjectUrl, ps as useOfflineMutation, gn as useOfflineSync, Ds as useOne, ht as useOnline, O as useOptionalI18n, Mc as useOutlet, Nc as useOutletContext, ds as usePaginatedQuery, ot as usePagination, Pc as useParams, Mo as usePasskeyCapabilities, No as usePasskeyRegistration, Po as usePasskeySignIn, $o as usePixCharge, go as usePoll, Wu as usePositionTracker, Ft as usePrevious, ol as usePushSubscription, Ot as usePushToTalk, Zt as useQueue, vt as useResizeObserver, Fc as useResolvedPath, Ic as useRevalidator, Lc as useRouteError, Rc as useRouteLoaderData, zc as useRoutes, Ul as useScreenCapture, At as useScrollLock, fn as useScrollOverflow, Bc as useSearchParams, on as useServiceWorkerUpdate, Xt as useSet, Dl as useSfxPool, dn as useSortable, Gl as useSpeechRecognition, Pt as useStableCallback, ln as useStorageEstimate, Vc as useSubmit, _n as useSyncStatus, pd as useTelemetry, Kc as useTheme, Rt as useThrottle, $c as useTicketEventStream, Lt as useTimeout, hr as useToast, pt as useToggle, Hi as useTorch, k as useTranslate, Kt as useTypewriter, Os as useUpdate, Ql as useViaCEP, Vl as useVideoRecorder, Hc as useViewTransitionState, au as useWatch, lu as useWebSocket, zt as useWindowSize, b as useZodForm, G as validateCNPJ, K as validateCPF, Zl as validateForm, Zi as visibleTurns, qn as withAllOption, Jn as withEmptyOption, Ga as withTimeout, qa as writeXlsx, y as zodResolver };
@@ -1,2 +1,2 @@
1
- function e(e){return e.endsWith(`/`)?e:`${e}/`}exports.basePrefix=e;
1
+ function e(e){return e.endsWith(`/`)?e:`${e}/`}function t(t,n){let r=e(t),i=n.split(/[?#]/)[0];return r!==`/`&&i.startsWith(r)?i.slice(r.length):i.replace(/^\/+/,``)}exports.basePrefix=e,exports.toOutputFile=t;
2
2
  //# sourceMappingURL=base-url.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-url.cjs","names":["basePrefix","base"],"sources":["../../src/vite/base-url.ts"],"sourcesContent":["/**\n * The resolved Vite `base` as a prefix that always ends in a slash.\n *\n * One rule, three call sites: the manifest prefixes the URLs it precaches, and\n * the dev middleware matches the paths the browser asks for. They have to agree\n * by definition — when they drift, dev serves `/app/sw.js` while the manifest\n * precached `/sw.js`, and the symptom only appears on a subpath deploy, which is\n * the least exercised configuration there is.\n *\n * @param base - Vite's resolved `base`, with or without a trailing slash.\n * @returns The same base, guaranteed to end in `/`.\n */\nexport function basePrefix(base: string): string {\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n"],"mappings":"AAYA,SAAgBA,EAAW,EAAsB,CAC7C,OAAOC,EAAK,SAAS,GAAG,EAAIA,EAAO,GAAGA,EAAK,EAC/C,C"}
1
+ {"version":3,"file":"base-url.cjs","names":["basePrefix","base","toOutputFile","prefix","path","url"],"sources":["../../src/vite/base-url.ts"],"sourcesContent":["/**\n * The resolved Vite `base` as a prefix that always ends in a slash.\n *\n * One rule, three call sites: the manifest prefixes the URLs it precaches, and\n * the dev middleware matches the paths the browser asks for. They have to agree\n * by definition — when they drift, dev serves `/app/sw.js` while the manifest\n * precached `/sw.js`, and the symptom only appears on a subpath deploy, which is\n * the least exercised configuration there is.\n *\n * @param base - Vite's resolved `base`, with or without a trailing slash.\n * @returns The same base, guaranteed to end in `/`.\n */\nexport function basePrefix(base: string): string {\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n\n/**\n * The output file a root-absolute URL resolves to, relative to `outDir`.\n *\n * Emitted files are named relative to the build output, while the options that\n * point at them (`swUrl`, `additionalUrls`) are URLs that may or may not carry\n * the base. Both spellings land on the same file, so a check that a URL was\n * emitted does not depend on which one the config used.\n *\n * @param base - Vite's resolved `base`.\n * @param url - A root-absolute URL, with or without the base.\n * @returns The path of the file under `outDir`, without a leading slash.\n */\nexport function toOutputFile(base: string, url: string): string {\n const prefix = basePrefix(base);\n const path = url.split(/[?#]/)[0];\n if (prefix !== \"/\" && path.startsWith(prefix)) return path.slice(prefix.length);\n return path.replace(/^\\/+/, \"\");\n}\n"],"mappings":"AAYA,SAAgBA,EAAW,EAAsB,CAC7C,OAAOC,EAAK,SAAS,GAAG,EAAIA,EAAO,GAAGA,EAAK,EAC/C,CAcA,SAAgBC,EAAa,EAAc,EAAqB,CAC5D,IAAMC,EAASH,EAAWC,CAAI,EACxBG,EAAOC,EAAI,MAAM,MAAM,CAAC,CAAC,GAE/B,OADIF,IAAW,KAAOC,EAAK,WAAWD,CAAM,EAAUC,EAAK,MAAMD,EAAO,MAAM,EACvEC,EAAK,QAAQ,OAAQ,EAAE,CAClC,C"}
@@ -2,7 +2,11 @@
2
2
  function e(e) {
3
3
  return e.endsWith("/") ? e : `${e}/`;
4
4
  }
5
+ function t(t, n) {
6
+ let r = e(t), i = n.split(/[?#]/)[0];
7
+ return r !== "/" && i.startsWith(r) ? i.slice(r.length) : i.replace(/^\/+/, "");
8
+ }
5
9
  //#endregion
6
- export { e as basePrefix };
10
+ export { e as basePrefix, t as toOutputFile };
7
11
 
8
12
  //# sourceMappingURL=base-url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-url.js","names":["basePrefix","base"],"sources":["../../src/vite/base-url.ts"],"sourcesContent":["/**\n * The resolved Vite `base` as a prefix that always ends in a slash.\n *\n * One rule, three call sites: the manifest prefixes the URLs it precaches, and\n * the dev middleware matches the paths the browser asks for. They have to agree\n * by definition — when they drift, dev serves `/app/sw.js` while the manifest\n * precached `/sw.js`, and the symptom only appears on a subpath deploy, which is\n * the least exercised configuration there is.\n *\n * @param base - Vite's resolved `base`, with or without a trailing slash.\n * @returns The same base, guaranteed to end in `/`.\n */\nexport function basePrefix(base: string): string {\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n"],"mappings":";AAYA,SAAgBA,EAAW,GAAsB;CAC7C,OAAOC,EAAK,SAAS,GAAG,IAAIA,IAAO,GAAGA,EAAK;AAC/C"}
1
+ {"version":3,"file":"base-url.js","names":["basePrefix","base","toOutputFile","prefix","path","url"],"sources":["../../src/vite/base-url.ts"],"sourcesContent":["/**\n * The resolved Vite `base` as a prefix that always ends in a slash.\n *\n * One rule, three call sites: the manifest prefixes the URLs it precaches, and\n * the dev middleware matches the paths the browser asks for. They have to agree\n * by definition — when they drift, dev serves `/app/sw.js` while the manifest\n * precached `/sw.js`, and the symptom only appears on a subpath deploy, which is\n * the least exercised configuration there is.\n *\n * @param base - Vite's resolved `base`, with or without a trailing slash.\n * @returns The same base, guaranteed to end in `/`.\n */\nexport function basePrefix(base: string): string {\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n\n/**\n * The output file a root-absolute URL resolves to, relative to `outDir`.\n *\n * Emitted files are named relative to the build output, while the options that\n * point at them (`swUrl`, `additionalUrls`) are URLs that may or may not carry\n * the base. Both spellings land on the same file, so a check that a URL was\n * emitted does not depend on which one the config used.\n *\n * @param base - Vite's resolved `base`.\n * @param url - A root-absolute URL, with or without the base.\n * @returns The path of the file under `outDir`, without a leading slash.\n */\nexport function toOutputFile(base: string, url: string): string {\n const prefix = basePrefix(base);\n const path = url.split(/[?#]/)[0];\n if (prefix !== \"/\" && path.startsWith(prefix)) return path.slice(prefix.length);\n return path.replace(/^\\/+/, \"\");\n}\n"],"mappings":";AAYA,SAAgBA,EAAW,GAAsB;CAC7C,OAAOC,EAAK,SAAS,GAAG,IAAIA,IAAO,GAAGA,EAAK;AAC/C;AAcA,SAAgBC,EAAa,GAAc,GAAqB;CAC5D,IAAMC,IAASH,EAAWC,CAAI,GACxBG,IAAOC,EAAI,MAAM,MAAM,CAAC,CAAC;CAE/B,OADIF,MAAW,OAAOC,EAAK,WAAWD,CAAM,IAAUC,EAAK,MAAMD,EAAO,MAAM,IACvEC,EAAK,QAAQ,QAAQ,EAAE;AAClC"}
@@ -1,2 +1,2 @@
1
- const e=require("./base-url.cjs");let t=require("node:path");function n(e){return async(t,n,r)=>{let i=(t.url??``).split(`?`)[0];if(e.matches(i,e.swUrl))try{let t=await e.buildWorker();n.setHeader(`Content-Type`,`application/javascript`),n.setHeader(`Service-Worker-Allowed`,`/`),n.setHeader(`Cache-Control`,`no-cache`),n.end(t)}catch(e){n.statusCode=500,n.end(`// SW dev build failed:\n// ${String(e)}`)}else e.matches(i,e.manifestUrl)?(n.setHeader(`Content-Type`,`application/json`),n.setHeader(`Cache-Control`,`no-cache`),n.end(JSON.stringify({version:`dev`,urls:[]}))):r()}}function r(r={}){let{swSrc:i=`src/sw.ts`,swUrl:a=`/sw.js`,manifestUrl:o=`/precache-manifest.json`,enabled:s=!0}=r,c=process.cwd(),l=`/`;function u(t,n){if(t===n)return!0;let r=e.basePrefix(l);return r!==`/`&&t===`${r}${n.replace(/^\//,``)}`}let d=null,f=null;async function p(){return d||(d=await(await import(`esbuild`)).context({entryPoints:[(0,t.resolve)(c,i)],bundle:!0,format:`iife`,platform:`browser`,target:`es2020`,write:!1,absWorkingDir:c,logLevel:`silent`}),d)}function m(){if(f)return f;let e=(async()=>{let e=(await(await p()).rebuild()).outputFiles?.[0]?.text;if(e===void 0)throw Error(`esbuild produced no service-worker output`);return e})();f=e;let t=()=>{f=null};return e.then(t,t),e}async function h(){let e=d;d=null,f=null,await e?.dispose()}return{name:`tempest-pwa-dev-sw`,apply:`serve`,async buildEnd(){await h()},configResolved(e){c=e.root??process.cwd(),l=e.base??`/`},configureServer(e){s&&(e.httpServer?.once(`close`,()=>void h()),e.middlewares.use(n({swUrl:a,manifestUrl:o,matches:u,buildWorker:m})))}}}exports.tempestPwaDevSw=r;
1
+ const e=require("./base-url.cjs");let t=require("node:path");var n=`tempest-pwa-dev-sw`;function r(e){return`/* tempest-precache-version: ${e} */\n`}function i(e,t){let n=e[t];if(n?.type!==`asset`)return;let r=typeof n.source==`string`?n.source:new TextDecoder().decode(n.source);try{let e=JSON.parse(r);return typeof e.version==`string`?e.version:void 0}catch{return}}function a(e){return async(t,n,r)=>{let i=(t.url??``).split(`?`)[0];if(e.matches(i,e.swUrl))try{let t=await e.buildWorker();n.setHeader(`Content-Type`,`application/javascript`),n.setHeader(`Service-Worker-Allowed`,`/`),n.setHeader(`Cache-Control`,`no-cache`),n.end(t)}catch(e){n.statusCode=500,n.end(`// SW dev build failed:\n// ${String(e)}`)}else e.matches(i,e.manifestUrl)?(n.setHeader(`Content-Type`,`application/json`),n.setHeader(`Cache-Control`,`no-cache`),n.end(JSON.stringify({version:`dev`,urls:[]}))):r()}}function o(o={}){let{swSrc:s=`src/sw.ts`,swUrl:c=`/sw.js`,manifestUrl:l=`/precache-manifest.json`,enabled:u=!0,build:d=!0}=o,f=process.cwd(),p=`/`,m=!1,h=`production`,g,_,v=!0,y=`warn`;function b(t,n){if(t===n)return!0;let r=e.basePrefix(p);return r!==`/`&&t===`${r}${n.replace(/^\//,``)}`}let x=null,S=null;async function C(){return x||(x=await(await import(`esbuild`)).context({entryPoints:[(0,t.resolve)(f,s)],bundle:!0,format:`iife`,platform:`browser`,target:`es2020`,write:!1,absWorkingDir:f,logLevel:`silent`}),x)}function w(){if(S)return S;let e=(async()=>{let e=(await(await C()).rebuild()).outputFiles?.[0]?.text;if(e===void 0)throw Error(`esbuild produced no service-worker output`);return e})();S=e;let t=()=>{S=null};return e.then(t,t),e}async function T(){let e=x;x=null,S=null,await e?.dispose()}async function E(){let e=await(await import(`vite`)).build({configFile:!1,root:f,mode:h,envDir:g,envPrefix:_,publicDir:!1,logLevel:y,build:{write:!1,emptyOutDir:!1,copyPublicDir:!1,sourcemap:!1,minify:v,lib:{entry:(0,t.resolve)(f,s),formats:[`iife`],name:`sw`,fileName:()=>`sw.js`}}}),n=Array.isArray(e)?e:[e];for(let{output:e=[]}of n){let t=e.find(e=>e.type===`chunk`&&e.isEntry);if(t?.code!==void 0)return t.code}throw Error(`the build produced no service-worker chunk`)}return{name:n,api:{swUrl:c,build:d},async buildEnd(){await T()},configResolved(e){f=e.root??process.cwd(),p=e.base??`/`,m=e.command===`build`&&!e.build?.ssr,h=e.mode??`production`,g=e.envDir,_=e.envPrefix,v=e.build?.minify??!0,y=e.logLevel===`silent`||e.logLevel===`error`?e.logLevel:`warn`},configureServer(e){u&&(e.httpServer?.once(`close`,()=>void T()),e.middlewares.use(a({swUrl:c,manifestUrl:l,matches:b,buildWorker:w})))},generateBundle:{order:`post`,async handler(t,n){if(!m||!d)return;let a;try{a=await E()}catch(e){this.error(`[tempest-pwa-dev-sw] could not bundle the service worker "${s}" into ${c}: ${e instanceof Error?e.message:String(e)}. Fix the entry, point \`swSrc\` at it, or pass \`build: false\` if another step bundles the worker.`)}let o=i(n,e.toOutputFile(p,l));this.emitFile({type:`asset`,fileName:e.toOutputFile(p,c),source:o===void 0?a:r(o)+a})}}}}exports.PWA_WORKER_PLUGIN_NAME=n,exports.precacheVersionBanner=r,exports.tempestPwaDevSw=o;
2
2
  //# sourceMappingURL=tempest-pwa-dev-sw.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tempest-pwa-dev-sw.cjs","names":["basePrefix","resolve","require_base_url","node_path","createDevSwMiddleware","url","req","deps","source","res","error","next","tempestPwaDevSw","options","root","base","matches","target","prefix","context","pending","ensureContext","swSrc","buildWorker","run","text","clear","disposeContext","current","config","enabled","server"],"sources":["../../src/vite/tempest-pwa-dev-sw.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\nimport { basePrefix } from \"./base-url\";\nimport type { TempestVitePlugin } from \"./tempest-pwa-manifest\";\n\n/** Options for {@link tempestPwaDevSw}. */\nexport interface TempestPwaDevSwOptions {\n /** Service-worker entry, relative to the project root. Default `src/sw.ts`. */\n swSrc?: string;\n /**\n * URL the worker is served at (must match `registerServiceWorker`).\n * Default `/sw.js`.\n *\n * Write it relative to the site root; requests are matched against both the\n * bare path and the path prefixed with the resolved Vite `base`, so a\n * project served from a subpath is handled without extra configuration.\n */\n swUrl?: string;\n /**\n * Dev URL of the precache manifest. Default `/precache-manifest.json`.\n * Matched the same way as {@link TempestPwaDevSwOptions.swUrl}.\n */\n manifestUrl?: string;\n /** Serve the worker in dev. Default `true`; set `false` to opt out. */\n enabled?: boolean;\n}\n\n/**\n * The dev middleware: serve the compiled worker, and a placeholder manifest.\n *\n * Extracted from the plugin so the request handling reads on its own — the\n * plugin body is then only wiring. The manifest is deliberately empty in dev:\n * precaching a set of URLs Vite rewrites on every change would serve stale\n * modules, and the worker's runtime routes still work without it.\n *\n * @param deps - The two URLs, the path matcher and the incremental build.\n * @returns A connect-style middleware.\n */\nfunction createDevSwMiddleware(deps: {\n swUrl: string;\n manifestUrl: string;\n matches: (url: string, target: string) => boolean;\n buildWorker: () => Promise<string>;\n}): (\n req: { url?: string },\n res: {\n statusCode?: number;\n setHeader: (name: string, value: string) => void;\n end: (body: string) => void;\n },\n next: () => void,\n) => Promise<void> {\n return async (req, res, next) => {\n const url = (req.url ?? \"\").split(\"?\")[0];\n\n if (deps.matches(url, deps.swUrl)) {\n try {\n const source = await deps.buildWorker();\n res.setHeader(\"Content-Type\", \"application/javascript\");\n res.setHeader(\"Service-Worker-Allowed\", \"/\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(source);\n } catch (error) {\n res.statusCode = 500;\n res.end(`// SW dev build failed:\\n// ${String(error)}`);\n }\n return;\n }\n\n if (deps.matches(url, deps.manifestUrl)) {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(JSON.stringify({ version: \"dev\", urls: [] }));\n return;\n }\n\n next();\n };\n}\n\n/**\n * Dev-server plugin that makes the service worker available under `npm run dev`.\n *\n * The production worker is bundled at build time (`vite.sw.config.ts`), so in\n * dev there is no `/sw.js` to register. This plugin compiles `swSrc` on the fly\n * with esbuild — through one incremental context, not a cold build per request —\n * and serves it as a classic worker, plus an empty `precache-manifest.json` (there are no hashed build assets to precache in\n * dev — push and runtime caching still work). It closes the \"SW in dev\" gap\n * that otherwise only `vite-plugin-pwa`'s `devOptions` covered.\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig, tempestPwaDevSw } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({ plugins: [tempestPwaDevSw()] });\n */\nexport function tempestPwaDevSw(options: TempestPwaDevSwOptions = {}): TempestVitePlugin {\n const {\n swSrc = \"src/sw.ts\",\n swUrl = \"/sw.js\",\n manifestUrl = \"/precache-manifest.json\",\n enabled = true,\n } = options;\n\n let root = process.cwd();\n let base = \"/\";\n\n /**\n * Whether a request path addresses `target`.\n *\n * Both the bare path and the base-prefixed one are accepted. Which of the\n * two arrives depends on where this middleware lands relative to Vite's own\n * base handling, and a project served from a subpath would otherwise never\n * match — the browser asks for `/app/sw.js` while the option says `/sw.js`.\n */\n function matches(url: string, target: string): boolean {\n if (url === target) return true;\n const prefix = basePrefix(base);\n if (prefix === \"/\") return false;\n return url === `${prefix}${target.replace(/^\\//, \"\")}`;\n }\n\n /**\n * The slice of esbuild's incremental API this plugin uses.\n *\n * Typed structurally rather than imported: `esbuild` is not a dependency of\n * this package. It is resolved at runtime from the app's own tree, where Vite\n * already brings it, so importing its types would add a build-time dependency\n * the runtime does not have.\n */\n interface BuildContext {\n rebuild(): Promise<{ outputFiles?: readonly { text: string }[] }>;\n dispose(): Promise<void>;\n }\n\n let context: BuildContext | null = null;\n let pending: Promise<string> | null = null;\n\n /**\n * The incremental build context, created on the first request that needs it.\n *\n * Lazy because a project that never registers a worker should not pay for an\n * esbuild child process, and because `apply: \"serve\"` still loads this module\n * in a build.\n *\n * @returns The context, reused across requests.\n */\n async function ensureContext(): Promise<BuildContext> {\n if (context) return context;\n const esbuild = (await import(\"esbuild\")) as unknown as {\n context(options: Record<string, unknown>): Promise<BuildContext>;\n };\n context = await esbuild.context({\n entryPoints: [resolve(root, swSrc)],\n bundle: true,\n format: \"iife\",\n platform: \"browser\",\n target: \"es2020\",\n write: false,\n absWorkingDir: root,\n logLevel: \"silent\",\n });\n return context;\n }\n\n /**\n * Bundle the worker, reusing the previous graph.\n *\n * `esbuild.build()` per request was a cold bundle every time, and the request\n * count is not one per session: `Cache-Control: no-cache` guarantees one per\n * page load, and Chrome re-fetches the worker script on every navigation and\n * on its own update checks. `rebuild()` reuses the graph and only redoes what\n * changed on disk.\n *\n * Single-flight, because those requests arrive in bursts and esbuild does not\n * promise anything about concurrent `rebuild()` calls on one context. Callers\n * that land while a bundle is in flight share its result, which is the right\n * answer anyway — they asked for the same file at the same moment.\n *\n * @returns The bundled worker source.\n */\n function buildWorker(): Promise<string> {\n if (pending) return pending;\n\n const run = (async (): Promise<string> => {\n const ctx = await ensureContext();\n const result = await ctx.rebuild();\n const text = result.outputFiles?.[0]?.text;\n if (text === undefined) throw new Error(\"esbuild produced no service-worker output\");\n return text;\n })();\n\n pending = run;\n const clear = (): void => {\n pending = null;\n };\n run.then(clear, clear);\n return run;\n }\n\n /**\n * Tear the context down, releasing esbuild's child process.\n *\n * Idempotent, because it is wired to both the dev server closing and the\n * plugin's `buildEnd`. Without it, restarting the dev server leaks one esbuild\n * process per restart.\n */\n async function disposeContext(): Promise<void> {\n const current = context;\n context = null;\n pending = null;\n await current?.dispose();\n }\n\n const plugin: Plugin = {\n name: \"tempest-pwa-dev-sw\",\n apply: \"serve\",\n async buildEnd() {\n await disposeContext();\n },\n configResolved(config) {\n root = config.root ?? process.cwd();\n base = config.base ?? \"/\";\n },\n configureServer(server) {\n if (!enabled) return;\n\n server.httpServer?.once(\"close\", () => void disposeContext());\n\n server.middlewares.use(\n createDevSwMiddleware({ swUrl, manifestUrl, matches, buildWorker }),\n );\n },\n };\n\n return plugin as TempestVitePlugin;\n}\n"],"mappings":"A,6DAsCA,SAASI,EAAsB,EAaZ,CACf,OAAO,MAAO,EAAK,EAAK,IAAS,CAC7B,IAAMC,GAAOC,EAAI,KAAO,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,GAEvC,GAAIC,EAAK,QAAQF,EAAKE,EAAK,KAAK,EAC5B,GAAI,CACA,IAAMC,EAAS,MAAMD,EAAK,YAAY,EACtCE,EAAI,UAAU,eAAgB,wBAAwB,EACtDA,EAAI,UAAU,yBAA0B,GAAG,EAC3CA,EAAI,UAAU,gBAAiB,UAAU,EACzCA,EAAI,IAAID,CAAM,CAClB,OAASE,EAAO,CACZ,EAAI,WAAa,IACjBD,EAAI,IAAI,+BAA+B,OAAOC,CAAK,GAAG,CAC1D,MAIAH,EAAK,QAAQF,EAAKE,EAAK,WAAW,GAClCE,EAAI,UAAU,eAAgB,kBAAkB,EAChDA,EAAI,UAAU,gBAAiB,UAAU,EACzCA,EAAI,IAAI,KAAK,UAAU,CAAE,QAAS,MAAO,KAAM,CAAC,CAAE,CAAC,CAAC,GAIxDE,EAAK,CACT,CACJ,CAkBA,SAAgBC,EAAgB,EAAkC,CAAC,EAAsB,CACrF,GAAM,CACF,QAAQ,YACR,QAAQ,SACR,cAAc,0BACd,UAAU,IACVC,EAEAC,EAAO,QAAQ,IAAI,EACnBC,EAAO,IAUX,SAASC,EAAQ,EAAa,EAAyB,CACnD,GAAIX,IAAQY,EAAQ,MAAO,GAC3B,IAAMC,EAASlB,EAAAA,WAAWe,CAAI,EAE9B,OADIG,IAAW,KACRb,IAAQ,GAAGa,IAASD,EAAO,QAAQ,MAAO,EAAE,GACvD,CAeA,IAAIE,EAA+B,KAC/BC,EAAkC,KAWtC,eAAeC,GAAuC,CAelD,OAdIF,IAIJ,EAAU,MAAM,MAHO,OAAO,WAAA,CAGN,QAAQ,CAC5B,YAAa,EAAA,EAAClB,EAAAA,QAAAA,CAAQa,EAAMQ,CAAK,CAAC,EAClC,OAAQ,GACR,OAAQ,OACR,SAAU,UACV,OAAQ,SACR,MAAO,GACP,cAAeR,EACf,SAAU,QACd,CAAC,EACMK,EACX,CAkBA,SAASI,GAA+B,CACpC,GAAIH,EAAS,OAAOA,EAEpB,IAAMI,GAAO,SAA6B,CAGtC,IAAMC,GAAO,MADQ,MADHJ,EAAc,EAAA,CACP,QAAQ,EAAA,CACb,cAAc,EAAE,EAAE,KACtC,GAAII,IAAS,IAAA,GAAW,MAAU,MAAM,2CAA2C,EACnF,OAAOA,CACX,EAAA,CAAG,EAEH,EAAUD,EACV,IAAME,MAAoB,CACtB,EAAU,IACd,EAEA,OADAF,EAAI,KAAKE,EAAOA,CAAK,EACdF,CACX,CASA,eAAeG,GAAgC,CAC3C,IAAMC,EAAUT,EAChB,EAAU,KACV,EAAU,KACV,MAAMS,GAAS,QAAQ,CAC3B,CAuBA,MAAO,CApBH,KAAM,qBACN,MAAO,QACP,MAAM,UAAW,CACb,MAAMD,EAAe,CACzB,EACA,eAAe,EAAQ,CACnB,EAAOE,EAAO,MAAQ,QAAQ,IAAI,EAClC,EAAOA,EAAO,MAAQ,GAC1B,EACA,gBAAgB,EAAQ,CACfC,IAELC,EAAO,YAAY,KAAK,YAAe,KAAKJ,EAAe,CAAC,EAE5DI,EAAO,YAAY,IACf3B,EAAsB,CAAE,QAAO,cAAa,UAAS,aAAY,CAAC,CACtE,EACJ,CAGG,CACX,C"}
1
+ {"version":3,"file":"tempest-pwa-dev-sw.cjs","names":["basePrefix","resolve","toOutputFile","require_base_url","node_path","PWA_WORKER_PLUGIN_NAME","precacheVersionBanner","version","readManifestVersion","asset","bundle","fileName","source","parsed","createDevSwMiddleware","url","req","deps","res","error","next","tempestPwaDevSw","options","root","base","isBuild","mode","envDir","envPrefix","minify","logLevel","matches","target","prefix","context","pending","ensureContext","swSrc","buildWorker","run","text","clear","disposeContext","current","bundleWorkerForProduction","result","outputs","entry","output","item","config","enabled","server","build","swUrl","manifestUrl"],"sources":["../../src/vite/tempest-pwa-dev-sw.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\nimport { basePrefix, toOutputFile } from \"./base-url\";\nimport type { TempestVitePlugin } from \"./tempest-pwa-manifest\";\n\n/** Options for {@link tempestPwaDevSw}. */\nexport interface TempestPwaDevSwOptions {\n /** Service-worker entry, relative to the project root. Default `src/sw.ts`. */\n swSrc?: string;\n /**\n * URL the worker is served at (must match `registerServiceWorker`).\n * Default `/sw.js`.\n *\n * Write it relative to the site root; requests are matched against both the\n * bare path and the path prefixed with the resolved Vite `base`, so a\n * project served from a subpath is handled without extra configuration.\n */\n swUrl?: string;\n /**\n * Dev URL of the precache manifest. Default `/precache-manifest.json`.\n * Matched the same way as {@link TempestPwaDevSwOptions.swUrl}.\n */\n manifestUrl?: string;\n /** Serve the worker in dev. Default `true`; set `false` to opt out. */\n enabled?: boolean;\n /**\n * Bundle `swSrc` into the production build as `swUrl`. Default `true`.\n *\n * Set `false` only when another step bundles the worker (a second\n * `vite build --config vite.sw.config.ts`, `vite-plugin-pwa`). That is also\n * what tells {@link tempestPwaManifest} the worker is external, so its\n * missing-worker check stands down.\n */\n build?: boolean;\n}\n\n/** Name of the plugin {@link tempestPwaDevSw} returns, looked up by the manifest plugin. */\nexport const PWA_WORKER_PLUGIN_NAME = \"tempest-pwa-dev-sw\";\n\n/**\n * What {@link tempestPwaDevSw} publishes on its plugin `api`, for sibling plugins.\n *\n * {@link tempestPwaManifest} reads it to know which file the worker lands at and\n * whether this build emits it at all.\n */\nexport interface TempestPwaWorkerApi {\n /** URL the worker is served and emitted at. */\n swUrl: string;\n /** Whether this plugin bundles the worker into the production build. */\n build: boolean;\n}\n\n/**\n * The comment prepended to the production worker, carrying the precache version.\n *\n * The browser installs a new service worker only when the bytes of `sw.js`\n * change. A deploy that touches the app but not `src/sw.ts` would otherwise ship\n * a byte-identical worker: it never reinstalls, `installPrecache` never re-runs,\n * and the offline shell keeps serving the previous deploy. The manifest\n * `version` is a hash of every precached URL, so it changes exactly when the\n * precache does.\n *\n * @param version - The `version` of the emitted precache manifest.\n * @returns A one-line block comment.\n */\nexport function precacheVersionBanner(version: string): string {\n return `/* tempest-precache-version: ${version} */\\n`;\n}\n\n/**\n * The `version` of the precache manifest this build emitted, when there is one.\n *\n * @param bundle - The output bundle, as Rollup/Rolldown hands it to `generateBundle`.\n * @param fileName - Where the manifest was emitted, relative to `outDir`.\n * @returns The version, or `undefined` when the manifest is absent or unreadable.\n */\nfunction readManifestVersion(\n bundle: Record<string, { type?: string; source?: unknown }>,\n fileName: string,\n): string | undefined {\n const asset = bundle[fileName];\n if (asset?.type !== \"asset\") return undefined;\n const source =\n typeof asset.source === \"string\"\n ? asset.source\n : new TextDecoder().decode(asset.source as Uint8Array);\n try {\n const parsed = JSON.parse(source) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The dev middleware: serve the compiled worker, and a placeholder manifest.\n *\n * Extracted from the plugin so the request handling reads on its own — the\n * plugin body is then only wiring. The manifest is deliberately empty in dev:\n * precaching a set of URLs Vite rewrites on every change would serve stale\n * modules, and the worker's runtime routes still work without it.\n *\n * @param deps - The two URLs, the path matcher and the incremental build.\n * @returns A connect-style middleware.\n */\nfunction createDevSwMiddleware(deps: {\n swUrl: string;\n manifestUrl: string;\n matches: (url: string, target: string) => boolean;\n buildWorker: () => Promise<string>;\n}): (\n req: { url?: string },\n res: {\n statusCode?: number;\n setHeader: (name: string, value: string) => void;\n end: (body: string) => void;\n },\n next: () => void,\n) => Promise<void> {\n return async (req, res, next) => {\n const url = (req.url ?? \"\").split(\"?\")[0];\n\n if (deps.matches(url, deps.swUrl)) {\n try {\n const source = await deps.buildWorker();\n res.setHeader(\"Content-Type\", \"application/javascript\");\n res.setHeader(\"Service-Worker-Allowed\", \"/\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(source);\n } catch (error) {\n res.statusCode = 500;\n res.end(`// SW dev build failed:\\n// ${String(error)}`);\n }\n return;\n }\n\n if (deps.matches(url, deps.manifestUrl)) {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.setHeader(\"Cache-Control\", \"no-cache\");\n res.end(JSON.stringify({ version: \"dev\", urls: [] }));\n return;\n }\n\n next();\n };\n}\n\n/**\n * Service-worker plugin: serves `swSrc` under `npm run dev` and bundles it into\n * the production build.\n *\n * In dev there is no `/sw.js` to register. This plugin compiles `swSrc` on the\n * fly with esbuild — through one incremental context, not a cold build per\n * request — and serves it as a classic worker, plus an empty\n * `precache-manifest.json` (there are no hashed build assets to precache in\n * dev — push and runtime caching still work).\n *\n * In `vite build` it bundles the same entry with Vite's own `build()` (IIFE, so\n * it registers as a classic worker, exactly what the old `vite.sw.config.ts`\n * produced) and emits it at `swUrl`. Before 0.83.0 it was serve-only: an app\n * with this plugin and {@link tempestPwaManifest} worked in dev and shipped a\n * production build with no `sw.js` and a zero exit code, so registration\n * 404'd and `navigator.serviceWorker.ready` never resolved. The emitted worker\n * starts with the precache `version` (see {@link precacheVersionBanner}), so\n * every deploy that changes the precache changes the worker bytes and the\n * browser installs it. Pass `build: false` when another step bundles the\n * worker.\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig, tempestPwaDevSw, tempestPwaManifest } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({ plugins: [tempestPwaManifest(), tempestPwaDevSw()] });\n */\nexport function tempestPwaDevSw(options: TempestPwaDevSwOptions = {}): TempestVitePlugin {\n const {\n swSrc = \"src/sw.ts\",\n swUrl = \"/sw.js\",\n manifestUrl = \"/precache-manifest.json\",\n enabled = true,\n build = true,\n } = options;\n\n let root = process.cwd();\n let base = \"/\";\n let isBuild = false;\n let mode = \"production\";\n let envDir: string | false | undefined;\n let envPrefix: string | string[] | undefined;\n let minify: boolean | string = true;\n let logLevel: \"silent\" | \"error\" | \"warn\" = \"warn\";\n\n /**\n * Whether a request path addresses `target`.\n *\n * Both the bare path and the base-prefixed one are accepted. Which of the\n * two arrives depends on where this middleware lands relative to Vite's own\n * base handling, and a project served from a subpath would otherwise never\n * match — the browser asks for `/app/sw.js` while the option says `/sw.js`.\n */\n function matches(url: string, target: string): boolean {\n if (url === target) return true;\n const prefix = basePrefix(base);\n if (prefix === \"/\") return false;\n return url === `${prefix}${target.replace(/^\\//, \"\")}`;\n }\n\n /**\n * The slice of esbuild's incremental API this plugin uses.\n *\n * Typed structurally rather than imported: `esbuild` is not a dependency of\n * this package. It is resolved at runtime from the app's own tree, where Vite\n * already brings it, so importing its types would add a build-time dependency\n * the runtime does not have.\n */\n interface BuildContext {\n rebuild(): Promise<{ outputFiles?: readonly { text: string }[] }>;\n dispose(): Promise<void>;\n }\n\n let context: BuildContext | null = null;\n let pending: Promise<string> | null = null;\n\n /**\n * The incremental build context, created on the first request that needs it.\n *\n * Lazy because a project that never registers a worker should not pay for an\n * esbuild child process, and because `apply: \"serve\"` still loads this module\n * in a build.\n *\n * @returns The context, reused across requests.\n */\n async function ensureContext(): Promise<BuildContext> {\n if (context) return context;\n const esbuild = (await import(\"esbuild\")) as unknown as {\n context(options: Record<string, unknown>): Promise<BuildContext>;\n };\n context = await esbuild.context({\n entryPoints: [resolve(root, swSrc)],\n bundle: true,\n format: \"iife\",\n platform: \"browser\",\n target: \"es2020\",\n write: false,\n absWorkingDir: root,\n logLevel: \"silent\",\n });\n return context;\n }\n\n /**\n * Bundle the worker, reusing the previous graph.\n *\n * `esbuild.build()` per request was a cold bundle every time, and the request\n * count is not one per session: `Cache-Control: no-cache` guarantees one per\n * page load, and Chrome re-fetches the worker script on every navigation and\n * on its own update checks. `rebuild()` reuses the graph and only redoes what\n * changed on disk.\n *\n * Single-flight, because those requests arrive in bursts and esbuild does not\n * promise anything about concurrent `rebuild()` calls on one context. Callers\n * that land while a bundle is in flight share its result, which is the right\n * answer anyway — they asked for the same file at the same moment.\n *\n * @returns The bundled worker source.\n */\n function buildWorker(): Promise<string> {\n if (pending) return pending;\n\n const run = (async (): Promise<string> => {\n const ctx = await ensureContext();\n const result = await ctx.rebuild();\n const text = result.outputFiles?.[0]?.text;\n if (text === undefined) throw new Error(\"esbuild produced no service-worker output\");\n return text;\n })();\n\n pending = run;\n const clear = (): void => {\n pending = null;\n };\n run.then(clear, clear);\n return run;\n }\n\n /**\n * Tear the context down, releasing esbuild's child process.\n *\n * Idempotent, because it is wired to both the dev server closing and the\n * plugin's `buildEnd`. Without it, restarting the dev server leaks one esbuild\n * process per restart.\n */\n async function disposeContext(): Promise<void> {\n const current = context;\n context = null;\n pending = null;\n await current?.dispose();\n }\n\n /**\n * Bundle `swSrc` for production with the host's own Vite.\n *\n * Vite's `build()` rather than esbuild: Vite 8 lists esbuild only as an\n * optional peer, so a fresh app may not have it, while the `vite` running\n * this plugin is always there. The config mirrors the `vite.sw.config.ts`\n * the PWA template used to ship — IIFE lib build, one entry, no app plugins —\n * plus the app's `mode`, `envDir` and `envPrefix`, so `import.meta.env`\n * inside the worker sees the same `VITE_*` values as the page. Its log level\n * is the app's, capped at `warn`, so the nested build adds no size table to\n * the output but a `silent` build stays silent.\n *\n * @returns The bundled worker source.\n */\n async function bundleWorkerForProduction(): Promise<string> {\n const vite = (await import(\"vite\")) as unknown as {\n build(config: Record<string, unknown>): Promise<unknown>;\n };\n const result = await vite.build({\n configFile: false,\n root,\n mode,\n envDir,\n envPrefix,\n publicDir: false,\n logLevel,\n build: {\n write: false,\n emptyOutDir: false,\n copyPublicDir: false,\n sourcemap: false,\n minify,\n lib: {\n entry: resolve(root, swSrc),\n formats: [\"iife\"],\n name: \"sw\",\n fileName: () => \"sw.js\",\n },\n },\n });\n const outputs = (Array.isArray(result) ? result : [result]) as {\n output?: { type: string; isEntry?: boolean; code?: string }[];\n }[];\n for (const { output = [] } of outputs) {\n const entry = output.find((item) => item.type === \"chunk\" && item.isEntry);\n if (entry?.code !== undefined) return entry.code;\n }\n throw new Error(\"the build produced no service-worker chunk\");\n }\n\n const api: TempestPwaWorkerApi = { swUrl, build };\n\n const plugin: Plugin = {\n name: PWA_WORKER_PLUGIN_NAME,\n api,\n async buildEnd() {\n await disposeContext();\n },\n configResolved(config) {\n root = config.root ?? process.cwd();\n base = config.base ?? \"/\";\n isBuild = config.command === \"build\" && !config.build?.ssr;\n mode = config.mode ?? \"production\";\n envDir = config.envDir;\n envPrefix = config.envPrefix;\n minify = config.build?.minify ?? true;\n logLevel =\n config.logLevel === \"silent\" || config.logLevel === \"error\"\n ? config.logLevel\n : \"warn\";\n },\n configureServer(server) {\n if (!enabled) return;\n\n server.httpServer?.once(\"close\", () => void disposeContext());\n\n server.middlewares.use(\n createDevSwMiddleware({ swUrl, manifestUrl, matches, buildWorker }),\n );\n },\n generateBundle: {\n order: \"post\",\n async handler(_outputOptions, bundle) {\n if (!isBuild || !build) return;\n let source: string;\n try {\n source = await bundleWorkerForProduction();\n } catch (error) {\n this.error(\n `[tempest-pwa-dev-sw] could not bundle the service worker \"${swSrc}\" ` +\n `into ${swUrl}: ${error instanceof Error ? error.message : String(error)}. ` +\n \"Fix the entry, point `swSrc` at it, or pass `build: false` if another \" +\n \"step bundles the worker.\",\n );\n }\n const version = readManifestVersion(\n bundle as Record<string, { type?: string; source?: unknown }>,\n toOutputFile(base, manifestUrl),\n );\n this.emitFile({\n type: \"asset\",\n fileName: toOutputFile(base, swUrl),\n source:\n version === undefined ? source : precacheVersionBanner(version) + source,\n });\n },\n },\n };\n\n return plugin as TempestVitePlugin;\n}\n"],"mappings":"A,6DAqCA,IAAaK,EAAyB,qBA4BtC,SAAgBC,EAAsB,EAAyB,CAC3D,MAAO,gCAAgCC,EAAQ,MACnD,CASA,SAASC,EACL,EACA,EACkB,CAClB,IAAMC,EAAQC,EAAOC,GACrB,GAAIF,GAAO,OAAS,QAAS,OAC7B,IAAMG,EACF,OAAOH,EAAM,QAAW,SAClBA,EAAM,OACN,IAAI,YAAY,CAAC,CAAC,OAAOA,EAAM,MAAoB,EAC7D,GAAI,CACA,IAAMI,EAAS,KAAK,MAAMD,CAAM,EAChC,OAAO,OAAOC,EAAO,SAAY,SAAWA,EAAO,QAAU,IAAA,EACjE,MAAQ,CACJ,MACJ,CACJ,CAaA,SAASC,EAAsB,EAaZ,CACf,OAAO,MAAO,EAAK,EAAK,IAAS,CAC7B,IAAMC,GAAOC,EAAI,KAAO,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,GAEvC,GAAIC,EAAK,QAAQF,EAAKE,EAAK,KAAK,EAC5B,GAAI,CACA,IAAML,EAAS,MAAMK,EAAK,YAAY,EACtCC,EAAI,UAAU,eAAgB,wBAAwB,EACtDA,EAAI,UAAU,yBAA0B,GAAG,EAC3CA,EAAI,UAAU,gBAAiB,UAAU,EACzCA,EAAI,IAAIN,CAAM,CAClB,OAASO,EAAO,CACZ,EAAI,WAAa,IACjBD,EAAI,IAAI,+BAA+B,OAAOC,CAAK,GAAG,CAC1D,MAIAF,EAAK,QAAQF,EAAKE,EAAK,WAAW,GAClCC,EAAI,UAAU,eAAgB,kBAAkB,EAChDA,EAAI,UAAU,gBAAiB,UAAU,EACzCA,EAAI,IAAI,KAAK,UAAU,CAAE,QAAS,MAAO,KAAM,CAAC,CAAE,CAAC,CAAC,GAIxDE,EAAK,CACT,CACJ,CA6BA,SAAgBC,EAAgB,EAAkC,CAAC,EAAsB,CACrF,GAAM,CACF,QAAQ,YACR,QAAQ,SACR,cAAc,0BACd,UAAU,GACV,QAAQ,IACRC,EAEAC,EAAO,QAAQ,IAAI,EACnBC,EAAO,IACPC,EAAU,GACVC,EAAO,aACPC,EACAC,EACAC,EAA2B,GAC3BC,EAAwC,OAU5C,SAASC,EAAQ,EAAa,EAAyB,CACnD,GAAIhB,IAAQiB,EAAQ,MAAO,GAC3B,IAAMC,EAASjC,EAAAA,WAAWwB,CAAI,EAE9B,OADIS,IAAW,KACRlB,IAAQ,GAAGkB,IAASD,EAAO,QAAQ,MAAO,EAAE,GACvD,CAeA,IAAIE,EAA+B,KAC/BC,EAAkC,KAWtC,eAAeC,GAAuC,CAelD,OAdIF,IAIJ,EAAU,MAAM,MAHO,OAAO,WAAA,CAGN,QAAQ,CAC5B,YAAa,EAAA,EAACjC,EAAAA,QAAAA,CAAQsB,EAAMc,CAAK,CAAC,EAClC,OAAQ,GACR,OAAQ,OACR,SAAU,UACV,OAAQ,SACR,MAAO,GACP,cAAed,EACf,SAAU,QACd,CAAC,EACMW,EACX,CAkBA,SAASI,GAA+B,CACpC,GAAIH,EAAS,OAAOA,EAEpB,IAAMI,GAAO,SAA6B,CAGtC,IAAMC,GAAO,MADQ,MADHJ,EAAc,EAAA,CACP,QAAQ,EAAA,CACb,cAAc,EAAE,EAAE,KACtC,GAAII,IAAS,IAAA,GAAW,MAAU,MAAM,2CAA2C,EACnF,OAAOA,CACX,EAAA,CAAG,EAEH,EAAUD,EACV,IAAME,MAAoB,CACtB,EAAU,IACd,EAEA,OADAF,EAAI,KAAKE,EAAOA,CAAK,EACdF,CACX,CASA,eAAeG,GAAgC,CAC3C,IAAMC,EAAUT,EAChB,EAAU,KACV,EAAU,KACV,MAAMS,GAAS,QAAQ,CAC3B,CAgBA,eAAeC,GAA6C,CAIxD,IAAMC,EAAS,MAAM,MAHD,OAAO,QAAA,CAGD,MAAM,CAC5B,WAAY,GACZ,OACA,OACA,SACA,YACA,UAAW,GACX,WACA,MAAO,CACH,MAAO,GACP,YAAa,GACb,cAAe,GACf,UAAW,GACX,SACA,IAAK,CACD,OAAA,EAAO5C,EAAAA,QAAAA,CAAQsB,EAAMc,CAAK,EAC1B,QAAS,CAAC,MAAM,EAChB,KAAM,KACN,aAAgB,OACpB,CACJ,CACJ,CAAC,EACKS,EAAW,MAAM,QAAQD,CAAM,EAAIA,EAAS,CAACA,CAAM,EAGzD,IAAK,GAAM,CAAE,SAAS,CAAC,KAAOC,EAAS,CACnC,IAAMC,EAAQC,EAAO,KAAM,GAASC,EAAK,OAAS,SAAWA,EAAK,OAAO,EACzE,GAAIF,GAAO,OAAS,IAAA,GAAW,OAAOA,EAAM,IAChD,CACA,MAAU,MAAM,4CAA4C,CAChE,CA6DA,MAAO,CAxDH,KAAM1C,EACN,IAAA,CAJ+B,QAAO,OAItC,EACA,MAAM,UAAW,CACb,MAAMqC,EAAe,CACzB,EACA,eAAe,EAAQ,CACnB,EAAOQ,EAAO,MAAQ,QAAQ,IAAI,EAClC,EAAOA,EAAO,MAAQ,IACtB,EAAUA,EAAO,UAAY,SAAW,CAACA,EAAO,OAAO,IACvD,EAAOA,EAAO,MAAQ,aACtB,EAASA,EAAO,OAChB,EAAYA,EAAO,UACnB,EAASA,EAAO,OAAO,QAAU,GACjC,EACIA,EAAO,WAAa,UAAYA,EAAO,WAAa,QAC9CA,EAAO,SACP,MACd,EACA,gBAAgB,EAAQ,CACfC,IAELC,EAAO,YAAY,KAAK,YAAe,KAAKV,EAAe,CAAC,EAE5DU,EAAO,YAAY,IACftC,EAAsB,CAAE,QAAO,cAAa,UAAS,aAAY,CAAC,CACtE,EACJ,EACA,eAAgB,CACZ,MAAO,OACP,MAAM,QAAQ,EAAgB,EAAQ,CAClC,GAAI,CAACW,GAAW,CAAC4B,EAAO,OACxB,IAAIzC,EACJ,GAAI,CACA,EAAS,MAAMgC,EAA0B,CAC7C,OAASzB,EAAO,CACZ,KAAK,MACD,6DAA6DkB,EAAM,SACvDiB,EAAM,IAAInC,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EAAE,qGAGjF,CACJ,CACA,IAAMZ,EAAUC,EACZE,EACAR,EAAAA,aAAasB,EAAM+B,CAAW,CAClC,EACA,KAAK,SAAS,CACV,KAAM,QACN,SAAUrD,EAAAA,aAAasB,EAAM8B,CAAK,EAClC,OACI/C,IAAY,IAAA,GAAYK,EAASN,EAAsBC,CAAO,EAAIK,CAC1E,CAAC,CACL,CACJ,CAGG,CACX,C"}