@testing-library/react-native 12.3.0 → 12.3.2

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 (212) hide show
  1. package/build/act.js +1 -2
  2. package/build/act.js.map +1 -1
  3. package/build/config.d.ts +2 -1
  4. package/build/config.js.map +1 -1
  5. package/build/{fireEvent.js → fire-event.js} +2 -3
  6. package/build/fire-event.js.map +1 -0
  7. package/build/helpers/accessiblity.d.ts +4 -0
  8. package/build/helpers/accessiblity.js +35 -6
  9. package/build/helpers/accessiblity.js.map +1 -1
  10. package/build/helpers/{debugDeep.js → debug-deep.js} +1 -1
  11. package/build/helpers/debug-deep.js.map +1 -0
  12. package/build/helpers/{debugShallow.js → debug-shallow.js} +1 -1
  13. package/build/helpers/debug-shallow.js.map +1 -0
  14. package/build/helpers/{findAll.js → find-all.js} +1 -1
  15. package/build/helpers/find-all.js.map +1 -0
  16. package/build/helpers/format-default.js +3 -19
  17. package/build/helpers/format-default.js.map +1 -1
  18. package/build/helpers/format.js +3 -4
  19. package/build/helpers/format.js.map +1 -1
  20. package/build/helpers/host-component-names.d.ts +5 -0
  21. package/build/helpers/host-component-names.js +14 -2
  22. package/build/helpers/host-component-names.js.map +1 -1
  23. package/build/helpers/matchers/{accessibilityState.js → match-accessibility-state.js} +1 -1
  24. package/build/helpers/matchers/match-accessibility-state.js.map +1 -0
  25. package/build/helpers/matchers/{accessibilityValue.js → match-accessibility-value.js} +2 -2
  26. package/build/helpers/matchers/match-accessibility-value.js.map +1 -0
  27. package/build/helpers/matchers/{matchArrayProp.js → match-array-prop.js} +1 -1
  28. package/build/helpers/matchers/match-array-prop.js.map +1 -0
  29. package/build/helpers/matchers/{matchLabelText.js → match-label-text.js} +3 -3
  30. package/build/helpers/matchers/match-label-text.js.map +1 -0
  31. package/build/helpers/matchers/{matchObjectProp.js → match-object-prop.js} +1 -1
  32. package/build/helpers/matchers/match-object-prop.js.map +1 -0
  33. package/build/helpers/matchers/{matchStringProp.js → match-string-prop.js} +1 -1
  34. package/build/helpers/matchers/match-string-prop.js.map +1 -0
  35. package/build/helpers/matchers/{matchTextContent.js → match-text-content.js} +1 -1
  36. package/build/helpers/matchers/match-text-content.js.map +1 -0
  37. package/build/helpers/object.d.ts +2 -0
  38. package/build/helpers/object.js +34 -0
  39. package/build/helpers/object.js.map +1 -0
  40. package/build/helpers/{stringValidation.js → string-validation.js} +1 -1
  41. package/build/helpers/string-validation.js.map +1 -0
  42. package/build/helpers/wrap-async.d.ts +7 -0
  43. package/build/helpers/wrap-async.js +45 -0
  44. package/build/helpers/wrap-async.js.map +1 -0
  45. package/build/matchers/extend-expect.d.js.map +1 -1
  46. package/build/matchers/extend-expect.js +14 -0
  47. package/build/matchers/extend-expect.js.map +1 -1
  48. package/build/matchers/index.d.ts +8 -1
  49. package/build/matchers/index.js +50 -1
  50. package/build/matchers/index.js.map +1 -1
  51. package/build/matchers/to-be-busy.d.ts +6 -0
  52. package/build/matchers/to-be-busy.js +20 -0
  53. package/build/matchers/to-be-busy.js.map +1 -0
  54. package/build/matchers/to-be-collapsed.d.ts +6 -0
  55. package/build/matchers/to-be-collapsed.js +20 -0
  56. package/build/matchers/to-be-collapsed.js.map +1 -0
  57. package/build/matchers/to-be-expanded.d.ts +6 -0
  58. package/build/matchers/to-be-expanded.js +20 -0
  59. package/build/matchers/to-be-expanded.js.map +1 -0
  60. package/build/matchers/to-be-selected.d.ts +6 -0
  61. package/build/matchers/to-be-selected.js +20 -0
  62. package/build/matchers/to-be-selected.js.map +1 -0
  63. package/build/matchers/to-contain-element.d.ts +6 -0
  64. package/build/matchers/to-contain-element.js +26 -0
  65. package/build/matchers/to-contain-element.js.map +1 -0
  66. package/build/matchers/to-have-accessibility-value.d.ts +7 -0
  67. package/build/matchers/to-have-accessibility-value.js +23 -0
  68. package/build/matchers/to-have-accessibility-value.js.map +1 -0
  69. package/build/matchers/to-have-style.d.ts +8 -0
  70. package/build/matchers/to-have-style.js +52 -0
  71. package/build/matchers/to-have-style.js.map +1 -0
  72. package/build/matchers/utils.js +2 -2
  73. package/build/matchers/utils.js.map +1 -1
  74. package/build/pure.d.ts +5 -5
  75. package/build/pure.js +4 -4
  76. package/build/pure.js.map +1 -1
  77. package/build/queries/{a11yState.d.ts → accessibility-state.d.ts} +2 -2
  78. package/build/queries/{a11yState.js → accessibility-state.js} +5 -5
  79. package/build/queries/accessibility-state.js.map +1 -0
  80. package/build/queries/{a11yValue.d.ts → accessibility-value.d.ts} +2 -2
  81. package/build/queries/{a11yValue.js → accessibility-value.js} +5 -5
  82. package/build/queries/accessibility-value.js.map +1 -0
  83. package/build/queries/{displayValue.d.ts → display-value.d.ts} +1 -1
  84. package/build/queries/{displayValue.js → display-value.js} +3 -3
  85. package/build/queries/display-value.js.map +1 -0
  86. package/build/queries/{hintText.d.ts → hint-text.d.ts} +1 -1
  87. package/build/queries/{hintText.js → hint-text.js} +3 -3
  88. package/build/queries/hint-text.js.map +1 -0
  89. package/build/queries/{labelText.d.ts → label-text.d.ts} +1 -1
  90. package/build/queries/{labelText.js → label-text.js} +4 -4
  91. package/build/queries/label-text.js.map +1 -0
  92. package/build/queries/{makeQueries.d.ts → make-queries.d.ts} +1 -1
  93. package/build/queries/{makeQueries.js → make-queries.js} +2 -2
  94. package/build/queries/make-queries.js.map +1 -0
  95. package/build/queries/{placeholderText.d.ts → placeholder-text.d.ts} +1 -1
  96. package/build/queries/{placeholderText.js → placeholder-text.js} +3 -3
  97. package/build/queries/placeholder-text.js.map +1 -0
  98. package/build/queries/role.d.ts +3 -3
  99. package/build/queries/role.js +7 -7
  100. package/build/queries/role.js.map +1 -1
  101. package/build/queries/{testId.d.ts → test-id.d.ts} +1 -1
  102. package/build/queries/{testId.js → test-id.js} +3 -3
  103. package/build/queries/test-id.js.map +1 -0
  104. package/build/queries/text.d.ts +1 -1
  105. package/build/queries/text.js +3 -3
  106. package/build/queries/text.js.map +1 -1
  107. package/build/queries/{unsafeProps.js → unsafe-props.js} +1 -1
  108. package/build/queries/unsafe-props.js.map +1 -0
  109. package/build/queries/{unsafeType.js → unsafe-type.js} +1 -1
  110. package/build/queries/unsafe-type.js.map +1 -0
  111. package/build/react-versions.js +2 -2
  112. package/build/react-versions.js.map +1 -1
  113. package/build/{renderHook.js → render-hook.js} +1 -1
  114. package/build/render-hook.js.map +1 -0
  115. package/build/render.d.ts +169 -169
  116. package/build/render.js +8 -7
  117. package/build/render.js.map +1 -1
  118. package/build/screen.js +1 -2
  119. package/build/screen.js.map +1 -1
  120. package/build/shallow.js +2 -2
  121. package/build/shallow.js.map +1 -1
  122. package/build/test-utils/events.d.ts +1 -2
  123. package/build/test-utils/events.js.map +1 -1
  124. package/build/user-event/event-builder/common.js +1 -2
  125. package/build/user-event/event-builder/common.js.map +1 -1
  126. package/build/user-event/event-builder/index.d.ts +30 -0
  127. package/build/user-event/event-builder/index.js +3 -2
  128. package/build/user-event/event-builder/index.js.map +1 -1
  129. package/build/user-event/event-builder/scroll-view.d.ts +42 -0
  130. package/build/user-event/event-builder/scroll-view.js +52 -0
  131. package/build/user-event/event-builder/scroll-view.js.map +1 -0
  132. package/build/user-event/event-builder/text-input.js +1 -2
  133. package/build/user-event/event-builder/text-input.js.map +1 -1
  134. package/build/user-event/index.d.ts +2 -0
  135. package/build/user-event/index.js +3 -3
  136. package/build/user-event/index.js.map +1 -1
  137. package/build/user-event/press/constants.js +2 -4
  138. package/build/user-event/press/constants.js.map +1 -1
  139. package/build/user-event/press/press.js +9 -13
  140. package/build/user-event/press/press.js.map +1 -1
  141. package/build/user-event/scroll/index.d.ts +1 -0
  142. package/build/user-event/scroll/index.js +19 -0
  143. package/build/user-event/scroll/index.js.map +1 -0
  144. package/build/user-event/scroll/scroll-to.d.ts +16 -0
  145. package/build/user-event/scroll/scroll-to.js +82 -0
  146. package/build/user-event/scroll/scroll-to.js.map +1 -0
  147. package/build/user-event/scroll/state.d.ts +4 -0
  148. package/build/user-event/scroll/state.js +18 -0
  149. package/build/user-event/scroll/state.js.map +1 -0
  150. package/build/user-event/scroll/utils.d.ts +20 -0
  151. package/build/user-event/scroll/utils.js +68 -0
  152. package/build/user-event/scroll/utils.js.map +1 -0
  153. package/build/user-event/setup/setup.d.ts +8 -0
  154. package/build/user-event/setup/setup.js +34 -6
  155. package/build/user-event/setup/setup.js.map +1 -1
  156. package/build/user-event/type/{parseKeys.js → parse-keys.js} +1 -1
  157. package/build/user-event/type/parse-keys.js.map +1 -0
  158. package/build/user-event/type/type.js +1 -1
  159. package/build/user-event/type/type.js.map +1 -1
  160. package/build/{waitForElementToBeRemoved.d.ts → wait-for-element-to-be-removed.d.ts} +1 -1
  161. package/build/{waitForElementToBeRemoved.js → wait-for-element-to-be-removed.js} +2 -2
  162. package/build/wait-for-element-to-be-removed.js.map +1 -0
  163. package/build/{waitFor.js → wait-for.js} +3 -27
  164. package/build/wait-for.js.map +1 -0
  165. package/build/within.d.ts +84 -84
  166. package/build/within.js +12 -13
  167. package/build/within.js.map +1 -1
  168. package/package.json +22 -19
  169. package/pure.d.ts +1 -0
  170. package/build/fireEvent.js.map +0 -1
  171. package/build/helpers/debugDeep.js.map +0 -1
  172. package/build/helpers/debugShallow.js.map +0 -1
  173. package/build/helpers/findAll.js.map +0 -1
  174. package/build/helpers/matchers/accessibilityState.js.map +0 -1
  175. package/build/helpers/matchers/accessibilityValue.js.map +0 -1
  176. package/build/helpers/matchers/matchArrayProp.js.map +0 -1
  177. package/build/helpers/matchers/matchLabelText.js.map +0 -1
  178. package/build/helpers/matchers/matchObjectProp.js.map +0 -1
  179. package/build/helpers/matchers/matchStringProp.js.map +0 -1
  180. package/build/helpers/matchers/matchTextContent.js.map +0 -1
  181. package/build/helpers/stringValidation.js.map +0 -1
  182. package/build/queries/a11yState.js.map +0 -1
  183. package/build/queries/a11yValue.js.map +0 -1
  184. package/build/queries/displayValue.js.map +0 -1
  185. package/build/queries/hintText.js.map +0 -1
  186. package/build/queries/labelText.js.map +0 -1
  187. package/build/queries/makeQueries.js.map +0 -1
  188. package/build/queries/placeholderText.js.map +0 -1
  189. package/build/queries/testId.js.map +0 -1
  190. package/build/queries/unsafeProps.js.map +0 -1
  191. package/build/queries/unsafeType.js.map +0 -1
  192. package/build/renderHook.js.map +0 -1
  193. package/build/user-event/type/parseKeys.js.map +0 -1
  194. package/build/waitFor.js.map +0 -1
  195. package/build/waitForElementToBeRemoved.js.map +0 -1
  196. /package/build/{fireEvent.d.ts → fire-event.d.ts} +0 -0
  197. /package/build/helpers/{debugDeep.d.ts → debug-deep.d.ts} +0 -0
  198. /package/build/helpers/{debugShallow.d.ts → debug-shallow.d.ts} +0 -0
  199. /package/build/helpers/{findAll.d.ts → find-all.d.ts} +0 -0
  200. /package/build/helpers/matchers/{accessibilityState.d.ts → match-accessibility-state.d.ts} +0 -0
  201. /package/build/helpers/matchers/{accessibilityValue.d.ts → match-accessibility-value.d.ts} +0 -0
  202. /package/build/helpers/matchers/{matchArrayProp.d.ts → match-array-prop.d.ts} +0 -0
  203. /package/build/helpers/matchers/{matchLabelText.d.ts → match-label-text.d.ts} +0 -0
  204. /package/build/helpers/matchers/{matchObjectProp.d.ts → match-object-prop.d.ts} +0 -0
  205. /package/build/helpers/matchers/{matchStringProp.d.ts → match-string-prop.d.ts} +0 -0
  206. /package/build/helpers/matchers/{matchTextContent.d.ts → match-text-content.d.ts} +0 -0
  207. /package/build/helpers/{stringValidation.d.ts → string-validation.d.ts} +0 -0
  208. /package/build/queries/{unsafeProps.d.ts → unsafe-props.d.ts} +0 -0
  209. /package/build/queries/{unsafeType.d.ts → unsafe-type.d.ts} +0 -0
  210. /package/build/{renderHook.d.ts → render-hook.d.ts} +0 -0
  211. /package/build/user-event/type/{parseKeys.d.ts → parse-keys.d.ts} +0 -0
  212. /package/build/{waitFor.d.ts → wait-for.d.ts} +0 -0
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.bindByRoleQueries = void 0;
7
7
  var _accessiblity = require("../helpers/accessiblity");
8
- var _findAll = require("../helpers/findAll");
9
- var _accessibilityState = require("../helpers/matchers/accessibilityState");
10
- var _accessibilityValue = require("../helpers/matchers/accessibilityValue");
11
- var _matchStringProp = require("../helpers/matchers/matchStringProp");
8
+ var _findAll = require("../helpers/find-all");
9
+ var _matchAccessibilityState = require("../helpers/matchers/match-accessibility-state");
10
+ var _matchAccessibilityValue = require("../helpers/matchers/match-accessibility-value");
11
+ var _matchStringProp = require("../helpers/matchers/match-string-prop");
12
12
  var _within = require("../within");
13
- var _makeQueries = require("./makeQueries");
13
+ var _makeQueries = require("./make-queries");
14
14
  const matchAccessibleNameIfNeeded = (node, name) => {
15
15
  if (name == null) return true;
16
16
  const {
@@ -20,10 +20,10 @@ const matchAccessibleNameIfNeeded = (node, name) => {
20
20
  return queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0;
21
21
  };
22
22
  const matchAccessibleStateIfNeeded = (node, options) => {
23
- return options != null ? (0, _accessibilityState.matchAccessibilityState)(node, options) : true;
23
+ return options != null ? (0, _matchAccessibilityState.matchAccessibilityState)(node, options) : true;
24
24
  };
25
25
  const matchAccessibilityValueIfNeeded = (node, value) => {
26
- return value != null ? (0, _accessibilityValue.matchAccessibilityValue)(node, value) : true;
26
+ return value != null ? (0, _matchAccessibilityValue.matchAccessibilityValue)(node, value) : true;
27
27
  };
28
28
  const queryAllByRole = instance => function queryAllByRoleFn(role, options) {
29
29
  return (0, _findAll.findAll)(instance, node =>
@@ -1 +1 @@
1
- {"version":3,"file":"role.js","names":["_accessiblity","require","_findAll","_accessibilityState","_accessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","isAccessibilityElement","matchStringProp","getAccessibilityRole","formatQueryParams","params","String","push","accessibilityStateKeys","forEach","stateKey","undefined","accessiblityValueKeys","valueKey","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByRoleQueries","getByRole","getAllByRole","queryByRole","findByRole","findAllByRole","exports"],"sources":["../../src/queries/role.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n accessibilityStateKeys,\n accessiblityValueKeys,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessiblity';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport type { TextMatch } from '../matches';\nimport { getQueriesForElement } from '../within';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByRoleOptions = CommonQueryOptions &\n AccessibilityStateMatcher & {\n name?: TextMatch;\n value?: AccessibilityValueMatcher;\n };\n\nconst matchAccessibleNameIfNeeded = (\n node: ReactTestInstance,\n name?: TextMatch\n) => {\n if (name == null) return true;\n\n const { queryAllByText, queryAllByLabelText } = getQueriesForElement(node);\n return (\n queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0\n );\n};\n\nconst matchAccessibleStateIfNeeded = (\n node: ReactTestInstance,\n options?: ByRoleOptions\n) => {\n return options != null ? matchAccessibilityState(node, options) : true;\n};\n\nconst matchAccessibilityValueIfNeeded = (\n node: ReactTestInstance,\n value?: AccessibilityValueMatcher\n) => {\n return value != null ? matchAccessibilityValue(node, value) : true;\n};\n\nconst queryAllByRole = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByRoleOptions> =>\n function queryAllByRoleFn(role, options) {\n return findAll(\n instance,\n (node) =>\n // run the cheapest checks first, and early exit to avoid unneeded computations\n isAccessibilityElement(node) &&\n matchStringProp(getAccessibilityRole(node), role) &&\n matchAccessibleStateIfNeeded(node, options) &&\n matchAccessibilityValueIfNeeded(node, options?.value) &&\n matchAccessibleNameIfNeeded(node, options?.name),\n options\n );\n };\n\nconst formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {\n const params = [`role: \"${String(role)}\"`];\n\n if (options.name) {\n params.push(`name: \"${String(options.name)}\"`);\n }\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (options[stateKey] !== undefined) {\n params.push(`${stateKey} state: ${options[stateKey]}`);\n }\n });\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (options?.value?.[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${options?.value?.[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (role: TextMatch, options?: ByRoleOptions) =>\n `Found multiple elements with ${formatQueryParams(role, options)}`;\n\nconst getMissingError = (role: TextMatch, options?: ByRoleOptions) =>\n `Unable to find an element with ${formatQueryParams(role, options)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByRole,\n getMissingError,\n getMultipleError\n);\n\nexport type ByRoleQueries = {\n getByRole: GetByQuery<TextMatch, ByRoleOptions>;\n getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;\n queryByRole: QueryByQuery<TextMatch, ByRoleOptions>;\n queryAllByRole: QueryAllByQuery<TextMatch, ByRoleOptions>;\n findByRole: FindByQuery<TextMatch, ByRoleOptions>;\n findAllByRole: FindAllByQuery<TextMatch, ByRoleOptions>;\n};\n\nexport const bindByRoleQueries = (\n instance: ReactTestInstance\n): ByRoleQueries => ({\n getByRole: getBy(instance),\n getAllByRole: getAllBy(instance),\n queryByRole: queryBy(instance),\n queryAllByRole: queryAllBy(instance),\n findByRole: findBy(instance),\n findAllByRole: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,O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EC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7E3B,cAAc,EACdoB,eAAe,EACfD,gBACF,CAAC;AAWM,MAAMS,iBAAiB,GAC5B3B,QAA2B,KACR;EACnB4B,SAAS,EAAER,KAAK,CAACpB,QAAQ,CAAC;EAC1B6B,YAAY,EAAER,QAAQ,CAACrB,QAAQ,CAAC;EAChC8B,WAAW,EAAER,OAAO,CAACtB,QAAQ,CAAC;EAC9BD,cAAc,EAAEwB,UAAU,CAACvB,QAAQ,CAAC;EACpC+B,UAAU,EAAEP,MAAM,CAACxB,QAAQ,CAAC;EAC5BgC,aAAa,EAAEP,SAAS,CAACzB,QAAQ;AACnC,CAAC,CAAC;AAACiC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"file":"role.js","names":["_accessiblity","require","_findAll","_matchAccessibilityState","_matchAccessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","isAccessibilityElement","matchStringProp","getAccessibilityRole","formatQueryParams","params","String","push","accessibilityStateKeys","forEach","stateKey","undefined","accessiblityValueKeys","valueKey","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByRoleQueries","getByRole","getAllByRole","queryByRole","findByRole","findAllByRole","exports"],"sources":["../../src/queries/role.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n accessibilityStateKeys,\n accessiblityValueKeys,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessiblity';\nimport { findAll } from '../helpers/find-all';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/match-accessibility-state';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { matchStringProp } from '../helpers/matchers/match-string-prop';\nimport type { TextMatch } from '../matches';\nimport { getQueriesForElement } from '../within';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { CommonQueryOptions } from './options';\n\ntype ByRoleOptions = CommonQueryOptions &\n AccessibilityStateMatcher & {\n name?: TextMatch;\n value?: AccessibilityValueMatcher;\n };\n\nconst matchAccessibleNameIfNeeded = (\n node: ReactTestInstance,\n name?: TextMatch\n) => {\n if (name == null) return true;\n\n const { queryAllByText, queryAllByLabelText } = getQueriesForElement(node);\n return (\n queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0\n );\n};\n\nconst matchAccessibleStateIfNeeded = (\n node: ReactTestInstance,\n options?: ByRoleOptions\n) => {\n return options != null ? matchAccessibilityState(node, options) : true;\n};\n\nconst matchAccessibilityValueIfNeeded = (\n node: ReactTestInstance,\n value?: AccessibilityValueMatcher\n) => {\n return value != null ? matchAccessibilityValue(node, value) : true;\n};\n\nconst queryAllByRole = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByRoleOptions> =>\n function queryAllByRoleFn(role, options) {\n return findAll(\n instance,\n (node) =>\n // run the cheapest checks first, and early exit to avoid unneeded computations\n isAccessibilityElement(node) &&\n matchStringProp(getAccessibilityRole(node), role) &&\n matchAccessibleStateIfNeeded(node, options) &&\n matchAccessibilityValueIfNeeded(node, options?.value) &&\n matchAccessibleNameIfNeeded(node, options?.name),\n options\n );\n };\n\nconst formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {\n const params = [`role: \"${String(role)}\"`];\n\n if (options.name) {\n params.push(`name: \"${String(options.name)}\"`);\n }\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (options[stateKey] !== undefined) {\n params.push(`${stateKey} state: ${options[stateKey]}`);\n }\n });\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (options?.value?.[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${options?.value?.[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (role: TextMatch, options?: ByRoleOptions) =>\n `Found multiple elements with ${formatQueryParams(role, options)}`;\n\nconst getMissingError = (role: TextMatch, options?: ByRoleOptions) =>\n `Unable to find an element with ${formatQueryParams(role, options)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByRole,\n getMissingError,\n getMultipleError\n);\n\nexport type ByRoleQueries = {\n getByRole: GetByQuery<TextMatch, ByRoleOptions>;\n getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;\n queryByRole: QueryByQuery<TextMatch, ByRoleOptions>;\n queryAllByRole: QueryAllByQuery<TextMatch, ByRoleOptions>;\n findByRole: FindByQuery<TextMatch, ByRoleOptions>;\n findAllByRole: FindAllByQuery<TextMatch, ByRoleOptions>;\n};\n\nexport const bindByRoleQueries = (\n instance: ReactTestInstance\n): ByRoleQueries => ({\n getByRole: getBy(instance),\n getAllByRole: getAllBy(instance),\n queryByRole: queryBy(instance),\n queryAllByRole: queryAllBy(instance),\n findByRole: findBy(instance),\n findAllByRole: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,wBAAA,GAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAiBA,MAAMO,2BAA2B,GAAGA,CAClCC,IAAuB,EACvBC,IAAgB,KACb;EACH,IAAIA,IAAI,IAAI,IAAI,EAAE,OAAO,IAAI;EAE7B,MAAM;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAAG,IAAAC,4BAAoB,EAACJ,IAAI,CAAC;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,SAAS,CAACzB,QAAQ;AACnC,CAAC,CAAC;AAACiC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import type { CommonQueryOptions } from './options';
5
5
  type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByTestIdQueries = {
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByTestIdQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
7
+ var _findAll = require("../helpers/find-all");
8
8
  var _matches = require("../matches");
9
- var _makeQueries = require("./makeQueries");
9
+ var _makeQueries = require("./make-queries");
10
10
  const matchTestId = (node, testId, options = {}) => {
11
11
  const {
12
12
  exact,
@@ -36,4 +36,4 @@ const bindByTestIdQueries = instance => ({
36
36
  findAllByTestId: findAllBy(instance)
37
37
  });
38
38
  exports.bindByTestIdQueries = bindByTestIdQueries;
39
- //# sourceMappingURL=testId.js.map
39
+ //# sourceMappingURL=test-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-id.js","names":["_findAll","require","_matches","_makeQueries","matchTestId","node","testId","options","exact","normalizer","matches","props","testID","queryAllByTestId","instance","queryAllByTestIdFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTestIdQueries","getByTestId","getAllByTestId","queryByTestId","findByTestId","findAllByTestId","exports"],"sources":["../../src/queries/test-id.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTestIdOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchTestId = (\n node: ReactTestInstance,\n testId: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(testId, node.props.testID, normalizer, exact);\n};\n\nconst queryAllByTestId = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByTestIdOptions> =>\n function queryAllByTestIdFn(testId, queryOptions) {\n return findAll(\n instance,\n (node) => matchTestId(node, testId, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (testId: TextMatch) =>\n `Found multiple elements with testID: ${String(testId)}`;\nconst getMissingError = (testId: TextMatch) =>\n `Unable to find an element with testID: ${String(testId)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByTestId,\n getMissingError,\n getMultipleError\n);\n\nexport type ByTestIdQueries = {\n getByTestId: GetByQuery<TextMatch, ByTestIdOptions>;\n getAllByTestId: GetAllByQuery<TextMatch, ByTestIdOptions>;\n queryByTestId: QueryByQuery<TextMatch, ByTestIdOptions>;\n queryAllByTestId: QueryAllByQuery<TextMatch, ByTestIdOptions>;\n findByTestId: FindByQuery<TextMatch, ByTestIdOptions>;\n findAllByTestId: FindAllByQuery<TextMatch, ByTestIdOptions>;\n};\n\nexport const bindByTestIdQueries = (\n instance: ReactTestInstance\n): ByTestIdQueries => ({\n getByTestId: getBy(instance),\n getAllByTestId: getAllBy(instance),\n queryByTestId: queryBy(instance),\n queryAllByTestId: queryAllBy(instance),\n findByTestId: findBy(instance),\n findAllByTestId: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAA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}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import type { CommonQueryOptions } from './options';
5
5
  type ByTextOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByTextQueries = {
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByTextQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
7
+ var _findAll = require("../helpers/find-all");
8
8
  var _hostComponentNames = require("../helpers/host-component-names");
9
- var _matchTextContent = require("../helpers/matchers/matchTextContent");
10
- var _makeQueries = require("./makeQueries");
9
+ var _matchTextContent = require("../helpers/matchers/match-text-content");
10
+ var _makeQueries = require("./make-queries");
11
11
  const queryAllByText = instance => function queryAllByTextFn(text, options = {}) {
12
12
  return (0, _findAll.findAll)(instance, node => (0, _hostComponentNames.isHostText)(node) && (0, _matchTextContent.matchTextContent)(node, text, options), {
13
13
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":["_findAll","require","_hostComponentNames","_matchTextContent","_makeQueries","queryAllByText","instance","queryAllByTextFn","text","options","findAll","node","isHostText","matchTextContent","matchDeepestOnly","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTextQueries","getByText","getAllByText","queryByText","findByText","findAllByText","exports"],"sources":["../../src/queries/text.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { isHostText } from '../helpers/host-component-names';\nimport { matchTextContent } from '../helpers/matchers/matchTextContent';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst queryAllByText = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByTextOptions> =>\n function queryAllByTextFn(text, options = {}) {\n return findAll(\n instance,\n (node) => isHostText(node) && matchTextContent(node, text, options),\n {\n ...options,\n matchDeepestOnly: true,\n }\n );\n };\n\nconst getMultipleError = (text: TextMatch) =>\n `Found multiple elements with text: ${String(text)}`;\n\nconst getMissingError = (text: TextMatch) =>\n `Unable to find an element with text: ${String(text)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByTextQueries = {\n getByText: GetByQuery<TextMatch, ByTextOptions>;\n getAllByText: GetAllByQuery<TextMatch, ByTextOptions>;\n queryByText: QueryByQuery<TextMatch, ByTextOptions>;\n queryAllByText: QueryAllByQuery<TextMatch, ByTextOptions>;\n findByText: FindByQuery<TextMatch, ByTextOptions>;\n findAllByText: FindAllByQuery<TextMatch, ByTextOptions>;\n};\n\nexport const bindByTextQueries = (\n instance: ReactTestInstance\n): ByTextQueries => ({\n getByText: getBy(instance),\n getAllByText: getAllBy(instance),\n queryByText: queryBy(instance),\n queryAllByText: queryAllBy(instance),\n findByText: findBy(instance),\n findAllByText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAaA,MAAMI,cAAc,GAClBC,QAA2B,IAE3B,SAASC,gBAAgBA,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EAC5C,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IAAK,IAAAC,8BAAU,EAACD,IAAI,CAAC,IAAI,IAAAE,kCAAgB,EAACF,IAAI,EAAEH,IAAI,EAAEC,OAAO,CAAC,EACnE;IACE,GAAGA,OAAO;IACVK,gBAAgB,EAAE;EACpB,CACF,CAAC;AACH,CAAC;AAEH,MAAMC,gBAAgB,GAAIP,IAAe,IACtC,sCAAqCQ,MAAM,CAACR,IAAI,CAAE,EAAC;AAEtD,MAAMS,eAAe,GAAIT,IAAe,IACrC,wCAAuCQ,MAAM,CAACR,IAAI,CAAE,EAAC;AAExD,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EnB,cAAc,EACdY,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,iBAAiB,GAC5BnB,QAA2B,KACR;EACnBoB,SAAS,EAAER,KAAK,CAACZ,QAAQ,CAAC;EAC1BqB,YAAY,EAAER,QAAQ,CAACb,QAAQ,CAAC;EAChCsB,WAAW,EAAER,OAAO,CAACd,QAAQ,CAAC;EAC9BD,cAAc,EAAEgB,UAAU,CAACf,QAAQ,CAAC;EACpCuB,UAAU,EAAEP,MAAM,CAAChB,QAAQ,CAAC;EAC5BwB,aAAa,EAAEP,SAAS,CAACjB,QAAQ;AACnC,CAAC,CAAC;AAACyB,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"file":"text.js","names":["_findAll","require","_hostComponentNames","_matchTextContent","_makeQueries","queryAllByText","instance","queryAllByTextFn","text","options","findAll","node","isHostText","matchTextContent","matchDeepestOnly","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTextQueries","getByText","getAllByText","queryByText","findByText","findAllByText","exports"],"sources":["../../src/queries/text.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { isHostText } from '../helpers/host-component-names';\nimport { matchTextContent } from '../helpers/matchers/match-text-content';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst queryAllByText = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByTextOptions> =>\n function queryAllByTextFn(text, options = {}) {\n return findAll(\n instance,\n (node) => isHostText(node) && matchTextContent(node, text, options),\n {\n ...options,\n matchDeepestOnly: true,\n }\n );\n };\n\nconst getMultipleError = (text: TextMatch) =>\n `Found multiple elements with text: ${String(text)}`;\n\nconst getMissingError = (text: TextMatch) =>\n `Unable to find an element with text: ${String(text)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByTextQueries = {\n getByText: GetByQuery<TextMatch, ByTextOptions>;\n getAllByText: GetAllByQuery<TextMatch, ByTextOptions>;\n queryByText: QueryByQuery<TextMatch, ByTextOptions>;\n queryAllByText: QueryAllByQuery<TextMatch, ByTextOptions>;\n findByText: FindByQuery<TextMatch, ByTextOptions>;\n findAllByText: FindAllByQuery<TextMatch, ByTextOptions>;\n};\n\nexport const bindByTextQueries = (\n instance: ReactTestInstance\n): ByTextQueries => ({\n getByText: getBy(instance),\n getAllByText: getAllBy(instance),\n queryByText: queryBy(instance),\n queryAllByText: queryAllBy(instance),\n findByText: findBy(instance),\n findAllByText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAaA,MAAMI,cAAc,GAClBC,QAA2B,IAE3B,SAASC,gBAAgBA,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EAC5C,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IAAK,IAAAC,8BAAU,EAACD,IAAI,CAAC,IAAI,IAAAE,kCAAgB,EAACF,IAAI,EAAEH,IAAI,EAAEC,OAAO,CAAC,EACnE;IACE,GAAGA,OAAO;IACVK,gBAAgB,EAAE;EACpB,CACF,CAAC;AACH,CAAC;AAEH,MAAMC,gBAAgB,GAAIP,IAAe,IACtC,sCAAqCQ,MAAM,CAACR,IAAI,CAAE,EAAC;AAEtD,MAAMS,eAAe,GAAIT,IAAe,IACrC,wCAAuCQ,MAAM,CAACR,IAAI,CAAE,EAAC;AAExD,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EnB,cAAc,EACdY,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,iBAAiB,GAC5BnB,QAA2B,KACR;EACnBoB,SAAS,EAAER,KAAK,CAACZ,QAAQ,CAAC;EAC1BqB,YAAY,EAAER,QAAQ,CAACb,QAAQ,CAAC;EAChCsB,WAAW,EAAER,OAAO,CAACd,QAAQ,CAAC;EAC9BD,cAAc,EAAEgB,UAAU,CAACf,QAAQ,CAAC;EACpCuB,UAAU,EAAEP,MAAM,CAAChB,QAAQ,CAAC;EAC5BwB,aAAa,EAAEP,SAAS,CAACjB,QAAQ;AACnC,CAAC,CAAC;AAACyB,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
@@ -46,4 +46,4 @@ const bindUnsafeByPropsQueries = instance => ({
46
46
  UNSAFE_queryAllByProps: UNSAFE_queryAllByProps(instance)
47
47
  });
48
48
  exports.bindUnsafeByPropsQueries = bindUnsafeByPropsQueries;
49
- //# sourceMappingURL=unsafeProps.js.map
49
+ //# sourceMappingURL=unsafe-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsafe-props.js","names":["_prettyFormat","_interopRequireDefault","require","_errors","obj","__esModule","default","UNSAFE_getByProps","instance","getByPropsFn","props","findByProps","error","ErrorWithStack","prepareErrorMessage","UNSAFE_getAllByProps","getAllByPropsFn","results","findAllByProps","length","prettyFormat","UNSAFE_queryByProps","queryByPropsFn","createQueryByError","UNSAFE_queryAllByProps","bindUnsafeByPropsQueries","exports"],"sources":["../../src/queries/unsafe-props.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport prettyFormat from 'pretty-format';\nimport { ErrorWithStack, prepareErrorMessage } from '../helpers/errors';\nimport { createQueryByError } from '../helpers/errors';\n\nconst UNSAFE_getByProps = (\n instance: ReactTestInstance\n): ((props: { [propName: string]: any }) => ReactTestInstance) =>\n function getByPropsFn(props: { [propName: string]: any }) {\n try {\n return instance.findByProps(props);\n } catch (error) {\n throw new ErrorWithStack(prepareErrorMessage(error), getByPropsFn);\n }\n };\n\nconst UNSAFE_getAllByProps = (\n instance: ReactTestInstance\n): ((props: { [propName: string]: any }) => Array<ReactTestInstance>) =>\n function getAllByPropsFn(props: { [propName: string]: any }) {\n const results = instance.findAllByProps(props);\n if (results.length === 0) {\n throw new ErrorWithStack(\n `No instances found with props:\\n${prettyFormat(props)}`,\n getAllByPropsFn\n );\n }\n return results;\n };\n\nconst UNSAFE_queryByProps = (\n instance: ReactTestInstance\n): ((props: { [propName: string]: any }) => ReactTestInstance | null) =>\n function queryByPropsFn(props: { [propName: string]: any }) {\n try {\n return UNSAFE_getByProps(instance)(props);\n } catch (error) {\n return createQueryByError(error, queryByPropsFn);\n }\n };\n\nconst UNSAFE_queryAllByProps =\n (\n instance: ReactTestInstance\n ): ((props: { [propName: string]: any }) => Array<ReactTestInstance>) =>\n (props: { [propName: string]: any }) => {\n try {\n return UNSAFE_getAllByProps(instance)(props);\n } catch (error) {\n return [];\n }\n };\n\n// Unsafe aliases\nexport type UnsafeByPropsQueries = {\n UNSAFE_getByProps: (props: { [key: string]: any }) => ReactTestInstance;\n UNSAFE_getAllByProps: (props: {\n [key: string]: any;\n }) => Array<ReactTestInstance>;\n UNSAFE_queryByProps: (props: {\n [key: string]: any;\n }) => ReactTestInstance | null;\n UNSAFE_queryAllByProps: (props: {\n [key: string]: any;\n }) => Array<ReactTestInstance>;\n};\n\n// TODO: migrate to makeQueries pattern\nexport const bindUnsafeByPropsQueries = (\n instance: ReactTestInstance\n): UnsafeByPropsQueries => ({\n UNSAFE_getByProps: UNSAFE_getByProps(instance),\n UNSAFE_getAllByProps: UNSAFE_getAllByProps(instance),\n UNSAFE_queryByProps: UNSAFE_queryByProps(instance),\n UNSAFE_queryAllByProps: UNSAFE_queryAllByProps(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAwE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGxE,MAAMG,iBAAiB,GACrBC,QAA2B,IAE3B,SAASC,YAAYA,CAACC,KAAkC,EAAE;EACxD,IAAI;IACF,OAAOF,QAAQ,CAACG,WAAW,CAACD,KAAK,CAAC;EACpC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,MAAM,IAAIC,sBAAc,CAAC,IAAAC,2BAAmB,EAACF,KAAK,CAAC,EAAEH,YAAY,CAAC;EACpE;AACF,CAAC;AAEH,MAAMM,oBAAoB,GACxBP,QAA2B,IAE3B,SAASQ,eAAeA,CAACN,KAAkC,EAAE;EAC3D,MAAMO,OAAO,GAAGT,QAAQ,CAACU,cAAc,CAACR,KAAK,CAAC;EAC9C,IAAIO,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIN,sBAAc,CACrB,mCAAkC,IAAAO,qBAAY,EAACV,KAAK,CAAE,EAAC,EACxDM,eACF,CAAC;EACH;EACA,OAAOC,OAAO;AAChB,CAAC;AAEH,MAAMI,mBAAmB,GACvBb,QAA2B,IAE3B,SAASc,cAAcA,CAACZ,KAAkC,EAAE;EAC1D,IAAI;IACF,OAAOH,iBAAiB,CAACC,QAAQ,CAAC,CAACE,KAAK,CAAC;EAC3C,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,IAAAW,0BAAkB,EAACX,KAAK,EAAEU,cAAc,CAAC;EAClD;AACF,CAAC;AAEH,MAAME,sBAAsB,GAExBhB,QAA2B,IAE5BE,KAAkC,IAAK;EACtC,IAAI;IACF,OAAOK,oBAAoB,CAACP,QAAQ,CAAC,CAACE,KAAK,CAAC;EAC9C,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;;AAEH;;AAcA;AACO,MAAMa,wBAAwB,GACnCjB,QAA2B,KACD;EAC1BD,iBAAiB,EAAEA,iBAAiB,CAACC,QAAQ,CAAC;EAC9CO,oBAAoB,EAAEA,oBAAoB,CAACP,QAAQ,CAAC;EACpDa,mBAAmB,EAAEA,mBAAmB,CAACb,QAAQ,CAAC;EAClDgB,sBAAsB,EAAEA,sBAAsB,CAAChB,QAAQ;AACzD,CAAC,CAAC;AAACkB,OAAA,CAAAD,wBAAA,GAAAA,wBAAA"}
@@ -44,4 +44,4 @@ const bindUnsafeByTypeQueries = instance => ({
44
44
  UNSAFE_queryAllByType: UNSAFE_queryAllByType(instance)
45
45
  });
46
46
  exports.bindUnsafeByTypeQueries = bindUnsafeByTypeQueries;
47
- //# sourceMappingURL=unsafeType.js.map
47
+ //# sourceMappingURL=unsafe-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsafe-type.js","names":["_errors","require","UNSAFE_getByType","instance","getByTypeFn","type","findByType","error","ErrorWithStack","prepareErrorMessage","UNSAFE_getAllByType","getAllByTypeFn","results","findAllByType","length","UNSAFE_queryByType","queryByTypeFn","createQueryByError","UNSAFE_queryAllByType","bindUnsafeByTypeQueries","exports"],"sources":["../../src/queries/unsafe-type.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport * as React from 'react';\nimport { ErrorWithStack, prepareErrorMessage } from '../helpers/errors';\nimport { createQueryByError } from '../helpers/errors';\n\nconst UNSAFE_getByType = (\n instance: ReactTestInstance\n): ((type: React.ComponentType<any>) => ReactTestInstance) =>\n function getByTypeFn(type: React.ComponentType<any>) {\n try {\n return instance.findByType(type);\n } catch (error) {\n throw new ErrorWithStack(prepareErrorMessage(error), getByTypeFn);\n }\n };\n\nconst UNSAFE_getAllByType = (\n instance: ReactTestInstance\n): ((type: React.ComponentType<any>) => Array<ReactTestInstance>) =>\n function getAllByTypeFn(type: React.ComponentType<any>) {\n const results = instance.findAllByType(type);\n if (results.length === 0) {\n throw new ErrorWithStack('No instances found', getAllByTypeFn);\n }\n return results;\n };\n\nconst UNSAFE_queryByType = (\n instance: ReactTestInstance\n): ((type: React.ComponentType<any>) => ReactTestInstance | null) =>\n function queryByTypeFn(type: React.ComponentType<any>) {\n try {\n return UNSAFE_getByType(instance)(type);\n } catch (error) {\n return createQueryByError(error, queryByTypeFn);\n }\n };\n\nconst UNSAFE_queryAllByType =\n (\n instance: ReactTestInstance\n ): ((type: React.ComponentType<any>) => Array<ReactTestInstance>) =>\n (type: React.ComponentType<any>) => {\n try {\n return UNSAFE_getAllByType(instance)(type);\n } catch (error) {\n return [];\n }\n };\n\n// Unsafe aliases\nexport type UnsafeByTypeQueries = {\n UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;\n UNSAFE_getAllByType: <P>(\n type: React.ComponentType<P>\n ) => Array<ReactTestInstance>;\n UNSAFE_queryByType: <P>(\n type: React.ComponentType<P>\n ) => ReactTestInstance | null;\n UNSAFE_queryAllByType: <P>(\n type: React.ComponentType<P>\n ) => Array<ReactTestInstance>;\n};\n\n// TODO: migrate to makeQueries pattern\nexport const bindUnsafeByTypeQueries = (\n instance: ReactTestInstance\n): UnsafeByTypeQueries => ({\n UNSAFE_getByType: UNSAFE_getByType(instance),\n UNSAFE_getAllByType: UNSAFE_getAllByType(instance),\n UNSAFE_queryByType: UNSAFE_queryByType(instance),\n UNSAFE_queryAllByType: UNSAFE_queryAllByType(instance),\n});\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAGA,MAAMC,gBAAgB,GACpBC,QAA2B,IAE3B,SAASC,WAAWA,CAACC,IAA8B,EAAE;EACnD,IAAI;IACF,OAAOF,QAAQ,CAACG,UAAU,CAACD,IAAI,CAAC;EAClC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,MAAM,IAAIC,sBAAc,CAAC,IAAAC,2BAAmB,EAACF,KAAK,CAAC,EAAEH,WAAW,CAAC;EACnE;AACF,CAAC;AAEH,MAAMM,mBAAmB,GACvBP,QAA2B,IAE3B,SAASQ,cAAcA,CAACN,IAA8B,EAAE;EACtD,MAAMO,OAAO,GAAGT,QAAQ,CAACU,aAAa,CAACR,IAAI,CAAC;EAC5C,IAAIO,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIN,sBAAc,CAAC,oBAAoB,EAAEG,cAAc,CAAC;EAChE;EACA,OAAOC,OAAO;AAChB,CAAC;AAEH,MAAMG,kBAAkB,GACtBZ,QAA2B,IAE3B,SAASa,aAAaA,CAACX,IAA8B,EAAE;EACrD,IAAI;IACF,OAAOH,gBAAgB,CAACC,QAAQ,CAAC,CAACE,IAAI,CAAC;EACzC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,IAAAU,0BAAkB,EAACV,KAAK,EAAES,aAAa,CAAC;EACjD;AACF,CAAC;AAEH,MAAME,qBAAqB,GAEvBf,QAA2B,IAE5BE,IAA8B,IAAK;EAClC,IAAI;IACF,OAAOK,mBAAmB,CAACP,QAAQ,CAAC,CAACE,IAAI,CAAC;EAC5C,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;;AAEH;;AAcA;AACO,MAAMY,uBAAuB,GAClChB,QAA2B,KACF;EACzBD,gBAAgB,EAAEA,gBAAgB,CAACC,QAAQ,CAAC;EAC5CO,mBAAmB,EAAEA,mBAAmB,CAACP,QAAQ,CAAC;EAClDY,kBAAkB,EAAEA,kBAAkB,CAACZ,QAAQ,CAAC;EAChDe,qBAAqB,EAAEA,qBAAqB,CAACf,QAAQ;AACvD,CAAC,CAAC;AAACiB,OAAA,CAAAD,uBAAA,GAAAA,uBAAA"}
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.checkReactVersionAtLeast = checkReactVersionAtLeast;
7
7
  var React = _interopRequireWildcard(require("react"));
8
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  function checkReactVersionAtLeast(major, minor) {
11
11
  if (React.version === undefined) return false;
12
12
  const [actualMajor, actualMinor] = React.version.split('.').map(Number);
@@ -1 +1 @@
1
- {"version":3,"file":"react-versions.js","names":["React","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","checkReactVersionAtLeast","major","minor","version","undefined","actualMajor","actualMinor","split","map","Number"],"sources":["../src/react-versions.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function checkReactVersionAtLeast(\n major: number,\n minor: number\n): boolean {\n if (React.version === undefined) return false;\n const [actualMajor, actualMinor] = React.version.split('.').map(Number);\n\n return actualMajor > major || (actualMajor === major && actualMinor >= minor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAExB,SAASW,wBAAwBA,CACtCC,KAAa,EACbC,KAAa,EACJ;EACT,IAAI3B,KAAK,CAAC4B,OAAO,KAAKC,SAAS,EAAE,OAAO,KAAK;EAC7C,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG/B,KAAK,CAAC4B,OAAO,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAEvE,OAAOJ,WAAW,GAAGJ,KAAK,IAAKI,WAAW,KAAKJ,KAAK,IAAIK,WAAW,IAAIJ,KAAM;AAC/E"}
1
+ {"version":3,"file":"react-versions.js","names":["React","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","checkReactVersionAtLeast","major","minor","version","undefined","actualMajor","actualMinor","split","map","Number"],"sources":["../src/react-versions.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function checkReactVersionAtLeast(\n major: number,\n minor: number\n): boolean {\n if (React.version === undefined) return false;\n const [actualMajor, actualMinor] = React.version.split('.').map(Number);\n\n return actualMajor > major || (actualMajor === major && actualMinor >= minor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAExB,SAASY,wBAAwBA,CACtCC,KAAa,EACbC,KAAa,EACJ;EACT,IAAI1B,KAAK,CAAC2B,OAAO,KAAKC,SAAS,EAAE,OAAO,KAAK;EAC7C,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG9B,KAAK,CAAC2B,OAAO,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAEvE,OAAOJ,WAAW,GAAGJ,KAAK,IAAKI,WAAW,KAAKJ,KAAK,IAAIK,WAAW,IAAIJ,KAAM;AAC/E"}
@@ -45,4 +45,4 @@ function renderHook(renderCallback, options) {
45
45
  unmount
46
46
  };
47
47
  }
48
- //# sourceMappingURL=renderHook.js.map
48
+ //# sourceMappingURL=render-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-hook.js","names":["_react","_interopRequireDefault","require","_render","obj","__esModule","default","renderHook","renderCallback","options","initialProps","wrapper","result","React","createRef","TestComponent","renderCallbackProps","renderResult","useEffect","current","rerender","baseRerender","unmount","renderInternal","createElement","detectHostComponentNames","rerenderCallbackProps"],"sources":["../src/render-hook.tsx"],"sourcesContent":["import React from 'react';\nimport type { ComponentType } from 'react';\nimport { renderInternal } from './render';\n\nexport type RenderHookResult<Result, Props> = {\n rerender: (props: Props) => void;\n result: { current: Result };\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = {\n initialProps?: Props;\n wrapper?: ComponentType<any>;\n};\n\nexport function renderHook<Result, Props>(\n renderCallback: (props: Props) => Result,\n options?: RenderHookOptions<Props>\n): RenderHookResult<Result, Props> {\n const initialProps = options?.initialProps;\n const wrapper = options?.wrapper;\n\n const result: React.MutableRefObject<Result | null> = React.createRef();\n\n function TestComponent({\n renderCallbackProps,\n }: {\n renderCallbackProps: Props;\n }) {\n const renderResult = renderCallback(renderCallbackProps);\n\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { rerender: baseRerender, unmount } = renderInternal(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <TestComponent renderCallbackProps={initialProps} />,\n {\n wrapper,\n detectHostComponentNames: false,\n }\n );\n\n function rerender(rerenderCallbackProps: Props) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />\n );\n }\n\n // @ts-expect-error result is ill typed because ref is initialized to null\n return { result, rerender, unmount };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAanC,SAASG,UAAUA,CACxBC,cAAwC,EACxCC,OAAkC,EACD;EACjC,MAAMC,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,OAAO,GAAGF,OAAO,EAAEE,OAAO;EAEhC,MAAMC,MAA6C,gBAAGC,cAAK,CAACC,SAAS,CAAC,CAAC;EAEvE,SAASC,aAAaA,CAAC;IACrBC;EAGF,CAAC,EAAE;IACD,MAAMC,YAAY,GAAGT,cAAc,CAACQ,mBAAmB,CAAC;IAExDH,cAAK,CAACK,SAAS,CAAC,MAAM;MACpBN,MAAM,CAACO,OAAO,GAAGF,YAAY;IAC/B,CAAC,CAAC;IAEF,OAAO,IAAI;EACb;EAEA,MAAM;IAAEG,QAAQ,EAAEC,YAAY;IAAEC;EAAQ,CAAC,GAAG,IAAAC,sBAAc;EAAA;EACxD;EACAvB,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAACT,aAAa;IAACC,mBAAmB,EAAEN;EAAa,CAAE,CAAC,EACpD;IACEC,OAAO;IACPc,wBAAwB,EAAE;EAC5B,CACF,CAAC;EAED,SAASL,QAAQA,CAACM,qBAA4B,EAAE;IAC9C,OAAOL,YAAY,eACjBrB,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAACT,aAAa;MAACC,mBAAmB,EAAEU;IAAsB,CAAE,CAC9D,CAAC;EACH;;EAEA;EACA,OAAO;IAAEd,MAAM;IAAEQ,QAAQ;IAAEE;EAAQ,CAAC;AACtC"}