@sentry/react-native 6.10.0 → 6.11.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 (131) hide show
  1. package/RNSentry.podspec +1 -1
  2. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +43 -21
  3. package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +82 -51
  4. package/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java +37 -0
  5. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +16 -6
  8. package/dist/js/NativeRNSentry.d.ts +2 -0
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/index.d.ts +1 -1
  12. package/dist/js/index.d.ts.map +1 -1
  13. package/dist/js/index.js +1 -1
  14. package/dist/js/index.js.map +1 -1
  15. package/dist/js/integrations/appRegistry.d.ts +8 -0
  16. package/dist/js/integrations/appRegistry.d.ts.map +1 -0
  17. package/dist/js/integrations/appRegistry.js +43 -0
  18. package/dist/js/integrations/appRegistry.js.map +1 -0
  19. package/dist/js/integrations/default.d.ts.map +1 -1
  20. package/dist/js/integrations/default.js +5 -1
  21. package/dist/js/integrations/default.js.map +1 -1
  22. package/dist/js/integrations/exports.d.ts +2 -0
  23. package/dist/js/integrations/exports.d.ts.map +1 -1
  24. package/dist/js/integrations/exports.js +2 -0
  25. package/dist/js/integrations/exports.js.map +1 -1
  26. package/dist/js/profiling/integration.d.ts.map +1 -1
  27. package/dist/js/profiling/integration.js +2 -3
  28. package/dist/js/profiling/integration.js.map +1 -1
  29. package/dist/js/profiling/nativeTypes.d.ts +1 -1
  30. package/dist/js/profiling/nativeTypes.d.ts.map +1 -1
  31. package/dist/js/profiling/nativeTypes.js.map +1 -1
  32. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  33. package/dist/js/replay/CustomMask.js +3 -2
  34. package/dist/js/replay/CustomMask.js.map +1 -1
  35. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  36. package/dist/js/tracing/integrations/appStart.js +38 -7
  37. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  38. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts +4 -0
  39. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -0
  40. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +193 -0
  41. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -0
  42. package/dist/js/tracing/ops.d.ts +2 -0
  43. package/dist/js/tracing/ops.d.ts.map +1 -1
  44. package/dist/js/tracing/ops.js +2 -0
  45. package/dist/js/tracing/ops.js.map +1 -1
  46. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  47. package/dist/js/tracing/reactnativeprofiler.js +12 -1
  48. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  49. package/dist/js/tracing/reactnavigation.d.ts +20 -2
  50. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  51. package/dist/js/tracing/reactnavigation.js +68 -40
  52. package/dist/js/tracing/reactnavigation.js.map +1 -1
  53. package/dist/js/tracing/semanticAttributes.d.ts +2 -0
  54. package/dist/js/tracing/semanticAttributes.d.ts.map +1 -1
  55. package/dist/js/tracing/semanticAttributes.js +2 -0
  56. package/dist/js/tracing/semanticAttributes.js.map +1 -1
  57. package/dist/js/tracing/timeToDisplayFallback.d.ts +3 -0
  58. package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -0
  59. package/dist/js/tracing/timeToDisplayFallback.js +21 -0
  60. package/dist/js/tracing/timeToDisplayFallback.js.map +1 -0
  61. package/dist/js/tracing/timetodisplay.d.ts +29 -0
  62. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  63. package/dist/js/tracing/timetodisplay.js +43 -20
  64. package/dist/js/tracing/timetodisplay.js.map +1 -1
  65. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  66. package/dist/js/tracing/timetodisplaynative.js +2 -1
  67. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  68. package/dist/js/tracing/timetodisplaynative.types.d.ts +1 -3
  69. package/dist/js/tracing/timetodisplaynative.types.d.ts.map +1 -1
  70. package/dist/js/tracing/timetodisplaynative.types.js.map +1 -1
  71. package/dist/js/utils/rnlibraries.d.ts +1 -1
  72. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  73. package/dist/js/utils/rnlibraries.js +5 -3
  74. package/dist/js/utils/rnlibraries.js.map +1 -1
  75. package/dist/js/utils/rnlibrariesinterface.d.ts +1 -0
  76. package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -1
  77. package/dist/js/utils/rnlibrariesinterface.js.map +1 -1
  78. package/dist/js/vendor/react-native/index.d.ts +3 -0
  79. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  80. package/dist/js/vendor/react-native/index.js.map +1 -1
  81. package/dist/js/vendor/react-navigation/types.d.ts +27 -0
  82. package/dist/js/vendor/react-navigation/types.d.ts.map +1 -0
  83. package/dist/js/vendor/react-navigation/types.js +3 -0
  84. package/dist/js/vendor/react-navigation/types.js.map +1 -0
  85. package/dist/js/version.d.ts +1 -1
  86. package/dist/js/version.js +1 -1
  87. package/dist/js/version.js.map +1 -1
  88. package/dist/js/wrapper.d.ts +2 -0
  89. package/dist/js/wrapper.d.ts.map +1 -1
  90. package/dist/js/wrapper.js +24 -0
  91. package/dist/js/wrapper.js.map +1 -1
  92. package/ios/RNSentry.mm +15 -6
  93. package/ios/RNSentryFramesTrackerListener.h +7 -3
  94. package/ios/RNSentryOnDrawReporter.h +6 -2
  95. package/ios/RNSentryOnDrawReporter.m +47 -20
  96. package/ios/RNSentryTimeToDisplay.h +7 -0
  97. package/ios/RNSentryTimeToDisplay.m +69 -2
  98. package/ios/RNSentryVersion.m +1 -1
  99. package/package.json +4 -4
  100. package/scripts/sentry-xcode-debug-files.sh +1 -4
  101. package/scripts/sentry-xcode.sh +6 -4
  102. package/sentry.gradle +4 -2
  103. package/src/js/NativeRNSentry.ts +2 -0
  104. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  105. package/ts3.8/dist/js/index.d.ts +1 -1
  106. package/ts3.8/dist/js/integrations/appRegistry.d.ts +8 -0
  107. package/ts3.8/dist/js/integrations/exports.d.ts +2 -0
  108. package/ts3.8/dist/js/profiling/nativeTypes.d.ts +1 -1
  109. package/ts3.8/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts +4 -0
  110. package/ts3.8/dist/js/tracing/ops.d.ts +2 -0
  111. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +20 -2
  112. package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +2 -0
  113. package/ts3.8/dist/js/tracing/timeToDisplayFallback.d.ts +3 -0
  114. package/ts3.8/dist/js/tracing/timetodisplay.d.ts +29 -0
  115. package/ts3.8/dist/js/tracing/timetodisplaynative.types.d.ts +1 -3
  116. package/ts3.8/dist/js/utils/rnlibraries.d.ts +1 -1
  117. package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +1 -0
  118. package/ts3.8/dist/js/vendor/react-native/index.d.ts +3 -0
  119. package/ts3.8/dist/js/vendor/react-navigation/types.d.ts +27 -0
  120. package/ts3.8/dist/js/version.d.ts +1 -1
  121. package/ts3.8/dist/js/wrapper.d.ts +2 -0
  122. package/dist/js/utils/sentryeventemitter.d.ts +0 -24
  123. package/dist/js/utils/sentryeventemitter.d.ts.map +0 -1
  124. package/dist/js/utils/sentryeventemitter.js +0 -82
  125. package/dist/js/utils/sentryeventemitter.js.map +0 -1
  126. package/dist/js/utils/sentryeventemitterfallback.d.ts +0 -19
  127. package/dist/js/utils/sentryeventemitterfallback.d.ts.map +0 -1
  128. package/dist/js/utils/sentryeventemitterfallback.js +0 -78
  129. package/dist/js/utils/sentryeventemitterfallback.js.map +0 -1
  130. package/ts3.8/dist/js/utils/sentryeventemitter.d.ts +0 -24
  131. package/ts3.8/dist/js/utils/sentryeventemitterfallback.d.ts +0 -19
@@ -7,6 +7,74 @@
7
7
  RCTResponseSenderBlock resolveBlock;
8
8
  }
9
9
 
10
+ static NSMutableDictionary<NSString *, NSNumber *> *screenIdToRenderDuration;
11
+ static NSMutableArray<NSString *> *screenIdAge;
12
+ static NSUInteger screenIdCurrentIndex;
13
+
14
+ static NSString *activeSpanId;
15
+
16
+ + (void)initialize
17
+ {
18
+ if (self == [RNSentryTimeToDisplay class]) {
19
+ screenIdToRenderDuration =
20
+ [[NSMutableDictionary alloc] initWithCapacity:TIME_TO_DISPLAY_ENTRIES_MAX_SIZE];
21
+ screenIdAge = [[NSMutableArray alloc] initWithCapacity:TIME_TO_DISPLAY_ENTRIES_MAX_SIZE];
22
+ screenIdCurrentIndex = 0;
23
+
24
+ activeSpanId = nil;
25
+ }
26
+ }
27
+
28
+ + (void)setActiveSpanId:(NSString *)spanId
29
+ {
30
+ activeSpanId = spanId;
31
+ }
32
+
33
+ + (NSNumber *)popTimeToDisplayFor:(NSString *)screenId
34
+ {
35
+ NSNumber *value = screenIdToRenderDuration[screenId];
36
+ [screenIdToRenderDuration removeObjectForKey:screenId];
37
+ return value;
38
+ }
39
+
40
+ + (void)putTimeToInitialDisplayForActiveSpan:(NSNumber *)value
41
+ {
42
+ if (activeSpanId != nil) {
43
+ NSString *prefixedSpanId = [@"ttid-navigation-" stringByAppendingString:activeSpanId];
44
+ [self putTimeToDisplayFor:prefixedSpanId value:value];
45
+ }
46
+ }
47
+
48
+ + (void)putTimeToDisplayFor:(NSString *)screenId value:(NSNumber *)value
49
+ {
50
+ if (!screenId)
51
+ return;
52
+
53
+ // If key already exists, just update the value,
54
+ // this should never happen as TTD is recorded once per navigation
55
+ // We avoid updating the age to avoid the age array shift
56
+ if ([screenIdToRenderDuration objectForKey:screenId]) {
57
+ [screenIdToRenderDuration setObject:value forKey:screenId];
58
+ return;
59
+ }
60
+
61
+ // If we haven't reached capacity yet, just append
62
+ if (screenIdAge.count < TIME_TO_DISPLAY_ENTRIES_MAX_SIZE) {
63
+ [screenIdToRenderDuration setObject:value forKey:screenId];
64
+ [screenIdAge addObject:screenId];
65
+ } else {
66
+ // Remove oldest entry, in most case will already be removed by pop
67
+ NSString *oldestKey = screenIdAge[screenIdCurrentIndex];
68
+ [screenIdToRenderDuration removeObjectForKey:oldestKey];
69
+
70
+ [screenIdToRenderDuration setObject:value forKey:screenId];
71
+ screenIdAge[screenIdCurrentIndex] = screenId;
72
+
73
+ // Update circular index, point to the new oldest
74
+ screenIdCurrentIndex = (screenIdCurrentIndex + 1) % TIME_TO_DISPLAY_ENTRIES_MAX_SIZE;
75
+ }
76
+ }
77
+
10
78
  // Rename requestAnimationFrame to getTimeToDisplay
11
79
  - (void)getTimeToDisplay:(RCTResponseSenderBlock)callback
12
80
  {
@@ -26,8 +94,7 @@
26
94
  - (void)handleDisplayLink:(CADisplayLink *)link
27
95
  {
28
96
  // Get the current time
29
- NSTimeInterval currentTime =
30
- [[NSDate date] timeIntervalSince1970] * 1000.0; // Convert to milliseconds
97
+ NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970];
31
98
 
32
99
  // Ensure the callback is valid and pass the current time back
33
100
  if (resolveBlock) {
@@ -3,4 +3,4 @@
3
3
  NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
4
4
  NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
5
5
  NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6
- NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.10.0";
6
+ NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.11.0";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "6.10.0",
5
+ "version": "6.11.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -65,9 +65,9 @@
65
65
  "react-native": ">=0.65.0"
66
66
  },
67
67
  "dependencies": {
68
- "@sentry/babel-plugin-component-annotate": "3.2.2",
68
+ "@sentry/babel-plugin-component-annotate": "3.3.1",
69
69
  "@sentry/browser": "8.54.0",
70
- "@sentry/cli": "2.42.4",
70
+ "@sentry/cli": "2.43.0",
71
71
  "@sentry/core": "8.54.0",
72
72
  "@sentry/react": "8.54.0",
73
73
  "@sentry/types": "8.54.0",
@@ -81,7 +81,7 @@
81
81
  "@sentry-internal/eslint-config-sdk": "8.54.0",
82
82
  "@sentry-internal/eslint-plugin-sdk": "8.54.0",
83
83
  "@sentry-internal/typescript": "8.54.0",
84
- "@sentry/wizard": "4.4.0",
84
+ "@sentry/wizard": "4.7.0",
85
85
  "@testing-library/react-native": "^12.7.2",
86
86
  "@types/jest": "^29.5.13",
87
87
  "@types/node": "^20.9.3",
@@ -26,12 +26,9 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
26
26
  [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
27
27
  [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
28
28
 
29
- [ -z "$SENTRY_FORCE_FOREGROUND"] && SENTRY_FORCE_FOREGROUND=true
30
-
31
- [[ "$SENTRY_FORCE_FOREGROUND" == true ]] && SENTRY_FORCE_FOREGROUND_FLAG="--force-foreground"
32
29
  [[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
33
30
 
34
- EXTRA_ARGS="$SENTRY_FORCE_FOREGROUND_FLAG $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $INCLUDE_SOURCES_FLAG"
31
+ EXTRA_ARGS="$SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $INCLUDE_SOURCES_FLAG"
35
32
 
36
33
  UPLOAD_DEBUG_FILES="\"$SENTRY_CLI_EXECUTABLE\" debug-files upload $EXTRA_ARGS \"$DWARF_DSYM_FOLDER_PATH\""
37
34
 
@@ -19,16 +19,15 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
19
19
  [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
20
20
  [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
21
21
 
22
- [ -z "$SENTRY_FORCE_FOREGROUND"] && SENTRY_FORCE_FOREGROUND=true
23
-
24
22
  REACT_NATIVE_XCODE=$1
25
23
 
26
- [[ "$SENTRY_FORCE_FOREGROUND" == true ]] && SENTRY_FORCE_FOREGROUND_FLAG="--force-foreground"
27
24
  [[ "$AUTO_RELEASE" == false ]] && [[ -z "$BUNDLE_COMMAND" || "$BUNDLE_COMMAND" != "ram-bundle" ]] && NO_AUTO_RELEASE="--no-auto-release"
28
- ARGS="$SENTRY_FORCE_FOREGROUND_FLAG $NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS"
25
+ ARGS="$NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS"
29
26
 
30
27
  REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $ARGS \"$REACT_NATIVE_XCODE\""
31
28
 
29
+ exitCode=0
30
+
32
31
  if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
33
32
  # 'warning:' triggers a warning in Xcode, 'error:' triggers an error
34
33
  set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
@@ -38,6 +37,7 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
38
37
  else
39
38
  echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
40
39
  echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
40
+ exitCode=1
41
41
  fi
42
42
  set -x -e # re-enable
43
43
  else
@@ -51,3 +51,5 @@ fi
51
51
  if [ -f "$SENTRY_COLLECT_MODULES" ]; then
52
52
  /bin/sh "$SENTRY_COLLECT_MODULES"
53
53
  fi
54
+
55
+ exit $exitCode
package/sentry.gradle CHANGED
@@ -3,7 +3,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
3
3
  import java.util.regex.Matcher
4
4
  import java.util.regex.Pattern
5
5
 
6
- project.ext.shouldSentryAutoUploadNative = { ->
6
+ project.ext.shouldSentryAutoUploadNative = { ->
7
7
  return System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true'
8
8
  }
9
9
 
@@ -17,7 +17,9 @@ project.ext.shouldSentryAutoUpload = { ->
17
17
 
18
18
  def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
19
19
 
20
- gradle.projectsEvaluated {
20
+ // gradle.projectsEvaluated doesn't work with --configure-on-demand
21
+ // the task are create too late and not executed
22
+ project.afterEvaluate {
21
23
  def releases = extractReleasesInfo()
22
24
 
23
25
  if (config.flavorAware && config.sentryProperties) {
@@ -49,6 +49,8 @@ export interface Spec extends TurboModule {
49
49
  getCurrentReplayId(): string | undefined | null;
50
50
  crashedLastRun(): Promise<boolean | undefined | null>;
51
51
  getDataFromUri(uri: string): Promise<number[]>;
52
+ popTimeToDisplayFor(key: string): Promise<number | undefined | null>;
53
+ setActiveSpanId(spanId: string): boolean;
52
54
  }
53
55
 
54
56
  export type NativeStackFrame = {
@@ -44,6 +44,8 @@ export interface Spec extends TurboModule {
44
44
  getCurrentReplayId(): string | undefined | null;
45
45
  crashedLastRun(): Promise<boolean | undefined | null>;
46
46
  getDataFromUri(uri: string): Promise<number[]>;
47
+ popTimeToDisplayFor(key: string): Promise<number | undefined | null>;
48
+ setActiveSpanId(spanId: string): boolean;
47
49
  }
48
50
  export type NativeStackFrame = {
49
51
  platform: string;
@@ -7,7 +7,7 @@ export type { ReactNativeOptions } from './options';
7
7
  export { ReactNativeClient } from './client';
8
8
  export { init, wrap, nativeCrash, flush, close, captureUserFeedback, withScope, crashedLastRun } from './sdk';
9
9
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
10
- export { reactNativeTracingIntegration, getCurrentReactNativeTracingIntegration, getReactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions, } from './tracing';
10
+ export { reactNativeTracingIntegration, getCurrentReactNativeTracingIntegration, getReactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions, createTimeToFullDisplay, createTimeToInitialDisplay, } from './tracing';
11
11
  export type { TimeToDisplayProps } from './tracing';
12
12
  export { Mask, Unmask } from './replay/CustomMask';
13
13
  export { FeedbackWidget } from './feedback/FeedbackWidget';
@@ -0,0 +1,8 @@
1
+ import type { Client, Integration } from '@sentry/core';
2
+ export declare const INTEGRATION_NAME = "AppRegistry";
3
+ export declare const appRegistryIntegration: () => Integration & {
4
+ onRunApplication: (callback: () => void) => void;
5
+ };
6
+ export declare const patchAppRegistryRunApplication: (callbacks: (() => void)[]) => void;
7
+ export declare const getAppRegistryIntegration: (client?: Client | undefined) => ReturnType<typeof appRegistryIntegration> | undefined;
8
+ //# sourceMappingURL=appRegistry.d.ts.map
@@ -20,5 +20,7 @@ export { nativeFramesIntegration, createNativeFramesIntegrations } from '../trac
20
20
  export { stallTrackingIntegration } from '../tracing/integrations/stalltracking';
21
21
  export { userInteractionIntegration } from '../tracing/integrations/userInteraction';
22
22
  export { createReactNativeRewriteFrames } from './rewriteframes';
23
+ export { appRegistryIntegration } from './appRegistry';
24
+ export { timeToDisplayIntegration } from '../tracing/integrations/timeToDisplayIntegration';
23
25
  export { breadcrumbsIntegration, browserApiErrorsIntegration, dedupeIntegration, functionToStringIntegration, globalHandlersIntegration as browserGlobalHandlersIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration as browserLinkedErrorsIntegration, rewriteFramesIntegration, } from '@sentry/react';
24
26
  //# sourceMappingURL=exports.d.ts.map
@@ -30,7 +30,7 @@ export interface NativeProfileEvent {
30
30
  }[];
31
31
  unit: string;
32
32
  }>;
33
- debug_meta: {
33
+ debug_meta?: {
34
34
  images: {
35
35
  type: 'macho';
36
36
  debug_id: string;
@@ -0,0 +1,4 @@
1
+ import type { Integration } from '@sentry/core';
2
+ export declare const INTEGRATION_NAME = "TimeToDisplay";
3
+ export declare const timeToDisplayIntegration: () => Integration;
4
+ //# sourceMappingURL=timeToDisplayIntegration.d.ts.map
@@ -5,4 +5,6 @@ export declare const UI_ACTION = "ui.action";
5
5
  export declare const UI_ACTION_TOUCH = "ui.action.touch";
6
6
  export declare const APP_START_COLD = "app.start.cold";
7
7
  export declare const APP_START_WARM = "app.start.warm";
8
+ export declare const UI_LOAD_INITIAL_DISPLAY = "ui.load.initial_display";
9
+ export declare const UI_LOAD_FULL_DISPLAY = "ui.load.full_display";
8
10
  //# sourceMappingURL=ops.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { Integration } from '@sentry/core';
1
+ import type { Client, Integration } from '@sentry/core';
2
2
  export declare const INTEGRATION_NAME = "ReactNavigation";
3
3
  interface ReactNavigationIntegrationOptions {
4
4
  /**
@@ -22,6 +22,19 @@ interface ReactNavigationIntegrationOptions {
22
22
  * @default true
23
23
  */
24
24
  ignoreEmptyBackNavigationTransactions: boolean;
25
+ /**
26
+ * Enabled measuring Time to Initial Display for routes that are already loaded in memory.
27
+ * (a.k.a., Routes that the navigation integration has already seen.)
28
+ *
29
+ * @default false
30
+ */
31
+ enableTimeToInitialDisplayForPreloadedRoutes: boolean;
32
+ /**
33
+ * Whether to use the dispatched action data to populate the transaction metadata.
34
+ *
35
+ * @default false
36
+ */
37
+ useDispatchedActionData: boolean;
25
38
  }
26
39
  /**
27
40
  * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.
@@ -31,17 +44,22 @@ interface ReactNavigationIntegrationOptions {
31
44
  * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
32
45
  * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.
33
46
  */
34
- export declare const reactNavigationIntegration: ({ routeChangeTimeoutMs, enableTimeToInitialDisplay, ignoreEmptyBackNavigationTransactions, }?: Partial<ReactNavigationIntegrationOptions>) => Integration & {
47
+ export declare const reactNavigationIntegration: ({ routeChangeTimeoutMs, enableTimeToInitialDisplay, ignoreEmptyBackNavigationTransactions, enableTimeToInitialDisplayForPreloadedRoutes, useDispatchedActionData, }?: Partial<ReactNavigationIntegrationOptions>) => Integration & {
35
48
  /**
36
49
  * Pass the ref to the navigation container to register it to the instrumentation
37
50
  * @param navigationContainerRef Ref to a `NavigationContainer`
38
51
  */
39
52
  registerNavigationContainer: (navigationContainerRef: unknown) => void;
53
+ options: ReactNavigationIntegrationOptions;
40
54
  };
41
55
  export interface NavigationRoute {
42
56
  name: string;
43
57
  key: string;
44
58
  params?: Record<string, any>;
45
59
  }
60
+ /**
61
+ * Returns React Navigation integration of the given client.
62
+ */
63
+ export declare function getReactNavigationIntegration(client: Client): ReturnType<typeof reactNavigationIntegration> | undefined;
46
64
  export {};
47
65
  //# sourceMappingURL=reactnavigation.d.ts.map
@@ -9,4 +9,6 @@ export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_NAME = "previous_route.na
9
9
  export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY = "previous_route.key";
10
10
  export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID = "previous_route.component_id";
11
11
  export declare const SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_TYPE = "previous_route.component_type";
12
+ export declare const SEMANTIC_ATTRIBUTE_TIME_TO_INITIAL_DISPLAY_FALLBACK = "route.initial_display_fallback";
13
+ export declare const SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE = "navigation.action_type";
12
14
  //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const addTimeToInitialDisplayFallback: (spanId: string, timestampSeconds: Promise<number | undefined | null>) => void;
2
+ export declare const getTimeToInitialDisplayFallback: (spanId: string) => Promise<number | undefined>;
3
+ //# sourceMappingURL=timeToDisplayFallback.d.ts.map
@@ -28,6 +28,8 @@ export declare function TimeToFullDisplay(props: TimeToDisplayProps): React.Reac
28
28
  * Starts a new span for the initial display.
29
29
  *
30
30
  * Returns current span if already exists in the currently active span.
31
+ *
32
+ * @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.
31
33
  */
32
34
  export declare function startTimeToInitialDisplaySpan(options?: Omit<StartSpanOptions, 'op' | 'name'> & {
33
35
  name?: string;
@@ -37,10 +39,37 @@ export declare function startTimeToInitialDisplaySpan(options?: Omit<StartSpanOp
37
39
  * Starts a new span for the full display.
38
40
  *
39
41
  * Returns current span if already exists in the currently active span.
42
+ *
43
+ * @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.
40
44
  */
41
45
  export declare function startTimeToFullDisplaySpan(options?: Omit<StartSpanOptions, 'op' | 'name'> & {
42
46
  name?: string;
43
47
  timeoutMs?: number;
44
48
  isAutoInstrumented?: boolean;
45
49
  }): Span | undefined;
50
+ /**
51
+ *
52
+ */
53
+ export declare function updateInitialDisplaySpan(frameTimestampSeconds: number, { activeSpan, span, }?: {
54
+ activeSpan?: Span;
55
+ /**
56
+ * Time to initial display span to update.
57
+ */
58
+ span?: Span;
59
+ }): void;
60
+ /**
61
+ * Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.
62
+ */
63
+ export declare function createTimeToFullDisplay({ useFocusEffect, }: {
64
+ /**
65
+ * `@react-navigation/native` useFocusEffect hook.
66
+ */
67
+ useFocusEffect: (callback: () => void) => void;
68
+ }): React.ComponentType<TimeToDisplayProps>;
69
+ /**
70
+ * Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.
71
+ */
72
+ export declare function createTimeToInitialDisplay({ useFocusEffect, }: {
73
+ useFocusEffect: (callback: () => void) => void;
74
+ }): React.ComponentType<TimeToDisplayProps>;
46
75
  //# sourceMappingURL=timetodisplay.d.ts.map
@@ -5,10 +5,8 @@ export interface RNSentryOnDrawNextFrameEvent {
5
5
  }
6
6
  export interface RNSentryOnDrawReporterProps {
7
7
  children?: React.ReactNode;
8
- onDrawNextFrame: (event: {
9
- nativeEvent: RNSentryOnDrawNextFrameEvent;
10
- }) => void;
11
8
  initialDisplay?: boolean;
12
9
  fullDisplay?: boolean;
10
+ parentSpanId?: string;
13
11
  }
14
12
  //# sourceMappingURL=timetodisplaynative.types.d.ts.map
@@ -1,3 +1,3 @@
1
1
  import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';
2
- export declare const ReactNativeLibraries: Required<ReactNativeLibrariesInterface>;
2
+ export declare const ReactNativeLibraries: ReactNativeLibrariesInterface;
3
3
  //# sourceMappingURL=rnlibraries.d.ts.map
@@ -13,6 +13,7 @@ export interface ReactNativeLibrariesInterface {
13
13
  Promise?: typeof Promise;
14
14
  ReactNativeVersion?: ReactNative.ReactNativeVersion;
15
15
  TurboModuleRegistry?: ReactNative.TurboModuleRegistry;
16
+ AppRegistry?: ReactNative.AppRegistry;
16
17
  ReactNative?: {
17
18
  requireNativeComponent?: <T>(viewName: string) => ReactNative.HostComponent<T>;
18
19
  };
@@ -43,5 +43,8 @@ export type ReactNativeVersion = {
43
43
  prerelease?: string | null | undefined;
44
44
  };
45
45
  };
46
+ export type AppRegistry = {
47
+ runApplication: (appKey: string, appParameters: any) => void;
48
+ };
46
49
  export {};
47
50
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Event which fires when an action is dispatched.
3
+ * Only intended for debugging purposes, don't use it for app logic.
4
+ * This event will be emitted before state changes have been applied.
5
+ */
6
+ export type UnsafeAction = {
7
+ data: {
8
+ /**
9
+ * The action object which was dispatched.
10
+ */
11
+ action: {
12
+ readonly type: string;
13
+ readonly payload?: object | undefined;
14
+ readonly source?: string | undefined;
15
+ readonly target?: string | undefined;
16
+ };
17
+ /**
18
+ * Whether the action was a no-op, i.e. resulted any state changes.
19
+ */
20
+ noop: boolean;
21
+ /**
22
+ * Stack trace of the action, this will only be available during development.
23
+ */
24
+ stack: string | undefined;
25
+ };
26
+ };
27
+ //# sourceMappingURL=types.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "6.10.0";
3
+ export declare const SDK_VERSION = "6.11.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -75,6 +75,8 @@ interface SentryNativeWrapper {
75
75
  crashedLastRun(): Promise<boolean | null>;
76
76
  getNewScreenTimeToDisplay(): Promise<number | null | undefined>;
77
77
  getDataFromUri(uri: string): Promise<Uint8Array | null>;
78
+ popTimeToDisplayFor(key: string): Promise<number | undefined | null>;
79
+ setActiveSpanId(spanId: string): void;
78
80
  }
79
81
  /**
80
82
  * Our internal interface for calling native functions
@@ -1,24 +0,0 @@
1
- import type { NativeModule } from 'react-native';
2
- import { NativeEventEmitter } from 'react-native';
3
- export declare const NewFrameEventName = "rn_sentry_new_frame";
4
- export type NewFrameEventName = typeof NewFrameEventName;
5
- export type NewFrameEvent = {
6
- newFrameTimestampInSeconds: number;
7
- };
8
- export interface SentryEventEmitter {
9
- /**
10
- * Initializes the native event emitter
11
- * This method is synchronous in JS but the native event emitter starts asynchronously
12
- * https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/React/Modules/RCTEventEmitter.m#L95
13
- */
14
- initAsync: (eventType: NewFrameEventName) => void;
15
- closeAllAsync: () => void;
16
- addListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
17
- removeListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
18
- once: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
19
- }
20
- /**
21
- * Creates emitter that allows to listen to native RNSentry events
22
- */
23
- export declare function createSentryEventEmitter(sentryNativeModule?: NativeModule | undefined, createNativeEventEmitter?: (nativeModule: NativeModule | undefined) => NativeEventEmitter): SentryEventEmitter;
24
- //# sourceMappingURL=sentryeventemitter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sentryeventemitter.d.ts","sourceRoot":"","sources":["../../../src/js/utils/sentryeventemitter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AACvD,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG;IAAE,0BAA0B,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,SAAS,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAK,IAAI,CAAC;IAC9F,cAAc,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAK,IAAI,CAAC;IACjG,IAAI,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAK,IAAI,CAAC;CACxF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,kBAAkB,GAAE,YAAY,GAAG,SAA+B,EAClE,wBAAwB,GAAE,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,KAAK,kBAChC,GACrC,kBAAkB,CA4DpB"}
@@ -1,82 +0,0 @@
1
- import { logger } from '@sentry/core';
2
- import { NativeEventEmitter } from 'react-native';
3
- import { getRNSentryModule } from '../wrapper';
4
- export const NewFrameEventName = 'rn_sentry_new_frame';
5
- /**
6
- * Creates emitter that allows to listen to native RNSentry events
7
- */
8
- export function createSentryEventEmitter(sentryNativeModule = getRNSentryModule(), createNativeEventEmitter = nativeModule => new NativeEventEmitter(nativeModule)) {
9
- if (!sentryNativeModule) {
10
- return createNoopSentryEventEmitter();
11
- }
12
- const openNativeListeners = new Map();
13
- const listenersMap = new Map();
14
- const nativeEventEmitter = createNativeEventEmitter(getRNSentryModule());
15
- const addListener = function (eventType, listener) {
16
- var _a;
17
- const map = listenersMap.get(eventType);
18
- if (!map) {
19
- logger.warn(`EventEmitter was not initialized for event type: ${eventType}`);
20
- return;
21
- }
22
- (_a = listenersMap.get(eventType)) === null || _a === void 0 ? void 0 : _a.set(listener, true);
23
- };
24
- const removeListener = function (eventType, listener) {
25
- var _a;
26
- (_a = listenersMap.get(eventType)) === null || _a === void 0 ? void 0 : _a.delete(listener);
27
- };
28
- return {
29
- initAsync(eventType) {
30
- if (openNativeListeners.has(eventType)) {
31
- return;
32
- }
33
- const nativeListener = nativeEventEmitter.addListener(eventType, (event) => {
34
- const listeners = listenersMap.get(eventType);
35
- if (!listeners) {
36
- return;
37
- }
38
- listeners.forEach((_, listener) => {
39
- listener(event);
40
- });
41
- });
42
- openNativeListeners.set(eventType, nativeListener);
43
- listenersMap.set(eventType, new Map());
44
- },
45
- closeAllAsync() {
46
- openNativeListeners.forEach(subscription => {
47
- subscription.remove();
48
- });
49
- openNativeListeners.clear();
50
- listenersMap.clear();
51
- },
52
- addListener,
53
- removeListener,
54
- once(eventType, listener) {
55
- const tmpListener = (event) => {
56
- listener(event);
57
- removeListener(eventType, tmpListener);
58
- };
59
- addListener(eventType, tmpListener);
60
- },
61
- };
62
- }
63
- function createNoopSentryEventEmitter() {
64
- return {
65
- initAsync: () => {
66
- logger.warn('Noop SentryEventEmitter: initAsync');
67
- },
68
- closeAllAsync: () => {
69
- logger.warn('Noop SentryEventEmitter: closeAllAsync');
70
- },
71
- addListener: () => {
72
- logger.warn('Noop SentryEventEmitter: addListener');
73
- },
74
- removeListener: () => {
75
- logger.warn('Noop SentryEventEmitter: removeListener');
76
- },
77
- once: () => {
78
- logger.warn('Noop SentryEventEmitter: once');
79
- },
80
- };
81
- }
82
- //# sourceMappingURL=sentryeventemitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sentryeventemitter.js","sourceRoot":"","sources":["../../../src/js/utils/sentryeventemitter.ts"],"names":[],"mappings":"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","sourcesContent":["import { logger } from '@sentry/core';\nimport type { EmitterSubscription, NativeModule } from 'react-native';\nimport { NativeEventEmitter } from 'react-native';\n\nimport { getRNSentryModule } from '../wrapper';\n\nexport const NewFrameEventName = 'rn_sentry_new_frame';\nexport type NewFrameEventName = typeof NewFrameEventName;\nexport type NewFrameEvent = { newFrameTimestampInSeconds: number };\n\nexport interface SentryEventEmitter {\n /**\n * Initializes the native event emitter\n * This method is synchronous in JS but the native event emitter starts asynchronously\n * https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/React/Modules/RCTEventEmitter.m#L95\n */\n initAsync: (eventType: NewFrameEventName) => void;\n closeAllAsync: () => void;\n addListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;\n removeListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;\n once: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;\n}\n\n/**\n * Creates emitter that allows to listen to native RNSentry events\n */\nexport function createSentryEventEmitter(\n sentryNativeModule: NativeModule | undefined = getRNSentryModule(),\n createNativeEventEmitter: (nativeModule: NativeModule | undefined) => NativeEventEmitter = nativeModule =>\n new NativeEventEmitter(nativeModule),\n): SentryEventEmitter {\n if (!sentryNativeModule) {\n return createNoopSentryEventEmitter();\n }\n\n const openNativeListeners = new Map<NewFrameEventName, EmitterSubscription>();\n const listenersMap = new Map<NewFrameEventName, Map<(event: NewFrameEvent) => void, true>>();\n\n const nativeEventEmitter = createNativeEventEmitter(getRNSentryModule());\n\n const addListener = function (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void): void {\n const map = listenersMap.get(eventType);\n if (!map) {\n logger.warn(`EventEmitter was not initialized for event type: ${eventType}`);\n return;\n }\n listenersMap.get(eventType)?.set(listener, true);\n };\n\n const removeListener = function (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void): void {\n listenersMap.get(eventType)?.delete(listener);\n };\n\n return {\n initAsync(eventType: NewFrameEventName) {\n if (openNativeListeners.has(eventType)) {\n return;\n }\n\n const nativeListener = nativeEventEmitter.addListener(eventType, (event: NewFrameEvent) => {\n const listeners = listenersMap.get(eventType);\n if (!listeners) {\n return;\n }\n\n listeners.forEach((_, listener) => {\n listener(event);\n });\n });\n openNativeListeners.set(eventType, nativeListener);\n\n listenersMap.set(eventType, new Map());\n },\n closeAllAsync() {\n openNativeListeners.forEach(subscription => {\n subscription.remove();\n });\n openNativeListeners.clear();\n listenersMap.clear();\n },\n addListener,\n removeListener,\n once(eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) {\n const tmpListener = (event: NewFrameEvent): void => {\n listener(event);\n removeListener(eventType, tmpListener);\n };\n addListener(eventType, tmpListener);\n },\n };\n}\n\nfunction createNoopSentryEventEmitter(): SentryEventEmitter {\n return {\n initAsync: () => {\n logger.warn('Noop SentryEventEmitter: initAsync');\n },\n closeAllAsync: () => {\n logger.warn('Noop SentryEventEmitter: closeAllAsync');\n },\n addListener: () => {\n logger.warn('Noop SentryEventEmitter: addListener');\n },\n removeListener: () => {\n logger.warn('Noop SentryEventEmitter: removeListener');\n },\n once: () => {\n logger.warn('Noop SentryEventEmitter: once');\n },\n };\n}\n"]}
@@ -1,19 +0,0 @@
1
- import type { SentryEventEmitter } from './sentryeventemitter';
2
- export declare const FALLBACK_TIMEOUT_MS = 10000;
3
- export type FallBackNewFrameEvent = {
4
- newFrameTimestampInSeconds: number;
5
- isFallback?: boolean;
6
- };
7
- export interface SentryEventEmitterFallback {
8
- /**
9
- * Initializes the fallback event emitter
10
- * This method is synchronous in JS but the event emitter starts asynchronously.
11
- */
12
- initAsync: () => void;
13
- onceNewFrame: (listener: (event: FallBackNewFrameEvent) => void) => void;
14
- }
15
- /**
16
- * Creates emitter that allows to listen to UI Frame events when ready.
17
- */
18
- export declare function createSentryFallbackEventEmitter(emitter?: SentryEventEmitter, fallbackTimeoutMs?: number): SentryEventEmitterFallback;
19
- //# sourceMappingURL=sentryeventemitterfallback.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sentryeventemitterfallback.d.ts","sourceRoot":"","sources":["../../../src/js/utils/sentryeventemitterfallback.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,MAAM,MAAM,qBAAqB,GAAG;IAAE,0BAA0B,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACjG,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,KAAK,IAAI,CAAC;CAC1E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,kBAA+C,EACxD,iBAAiB,SAAsB,GACtC,0BAA0B,CAyE5B"}