storybook 10.1.0-alpha.9 → 10.1.0-beta.1

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 (198) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
  5. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  6. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  7. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  8. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  9. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  15. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  16. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  17. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  18. package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
  19. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  20. package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
  26. package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
  27. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  28. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  29. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  30. package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
  31. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  32. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  33. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
  39. package/dist/_node-chunks/{builder-manager-SM3UWERX.js → builder-manager-FTVC2JL7.js} +510 -1019
  40. package/dist/_node-chunks/camelcase-3SMT5WKC.js +37 -0
  41. package/dist/_node-chunks/chunk-2OVULPK3.js +54 -0
  42. package/dist/_node-chunks/chunk-3JJPSDXI.js +3043 -0
  43. package/dist/_node-chunks/chunk-54NMJ4II.js +1564 -0
  44. package/dist/_node-chunks/chunk-5V4A6MSI.js +943 -0
  45. package/dist/_node-chunks/chunk-6DEMT5VX.js +299 -0
  46. package/dist/_node-chunks/{chunk-HHSTA6QS.js → chunk-6L7FFBOW.js} +8 -10
  47. package/dist/_node-chunks/chunk-6ULDIDXV.js +46662 -0
  48. package/dist/_node-chunks/chunk-AREL5IXS.js +603 -0
  49. package/dist/_node-chunks/chunk-DWA53E73.js +23 -0
  50. package/dist/_node-chunks/chunk-FNYKBULZ.js +765 -0
  51. package/dist/_node-chunks/chunk-IUYZQKSX.js +70 -0
  52. package/dist/_node-chunks/{chunk-F6EFOEC7.js → chunk-K673CX4Q.js} +469 -983
  53. package/dist/_node-chunks/chunk-KJAFCNZ3.js +61 -0
  54. package/dist/_node-chunks/chunk-N3BJOOY5.js +78 -0
  55. package/dist/_node-chunks/{chunk-EBUEXRH5.js → chunk-O5FMCQHP.js} +116 -276
  56. package/dist/_node-chunks/chunk-RIKQZHV3.js +29 -0
  57. package/dist/_node-chunks/chunk-RURZIE3W.js +3780 -0
  58. package/dist/_node-chunks/chunk-RVII4SK6.js +919 -0
  59. package/dist/_node-chunks/chunk-S3PBHOVC.js +6024 -0
  60. package/dist/_node-chunks/chunk-SQSFX47N.js +61 -0
  61. package/dist/_node-chunks/{chunk-SGM3ZCCT.js → chunk-TURUTKVH.js} +292 -688
  62. package/dist/_node-chunks/chunk-VRICJPXY.js +72 -0
  63. package/dist/_node-chunks/chunk-WIWWMCEU.js +119 -0
  64. package/dist/_node-chunks/{chunk-ATDHMMIZ.js → chunk-XGNRK7QB.js} +15 -24
  65. package/dist/_node-chunks/chunk-Y2FOTPAE.js +4523 -0
  66. package/dist/_node-chunks/{chunk-GHIBZRKD.js → chunk-Y4UYN72K.js} +8133 -8887
  67. package/dist/_node-chunks/chunk-Z4BMBA5L.js +18 -0
  68. package/dist/_node-chunks/chunk-ZMCJS2GU.js +20 -0
  69. package/dist/_node-chunks/dist-TZLZ3T6L.js +121 -0
  70. package/dist/_node-chunks/globby-22GFCZQD.js +3452 -0
  71. package/dist/_node-chunks/lib-37NQ4ZIJ.js +366 -0
  72. package/dist/_node-chunks/mdx-N42X6CFJ-2TRB7OEH.js +14329 -0
  73. package/dist/_node-chunks/p-limit-UD7TYFDW.js +116 -0
  74. package/dist/actions/decorator.js +21 -42
  75. package/dist/actions/index.js +3 -3
  76. package/dist/babel/index.d.ts +671 -335
  77. package/dist/babel/index.js +10 -11
  78. package/dist/bin/core.js +602 -1549
  79. package/dist/bin/dispatcher.js +36 -36
  80. package/dist/bin/loader.js +24 -38
  81. package/dist/channels/index.js +98 -234
  82. package/dist/cli/index.d.ts +1479 -133
  83. package/dist/cli/index.js +30 -8540
  84. package/dist/client-logger/index.js +31 -61
  85. package/dist/common/index.d.ts +139 -62
  86. package/dist/common/index.js +66 -51
  87. package/dist/components/index.d.ts +575 -273
  88. package/dist/components/index.js +14863 -4313
  89. package/dist/core-events/index.js +2 -66
  90. package/dist/core-server/index.d.ts +3 -2
  91. package/dist/core-server/index.js +2911 -8519
  92. package/dist/core-server/presets/common-manager.css +2 -2
  93. package/dist/core-server/presets/common-manager.js +2521 -5233
  94. package/dist/core-server/presets/common-override-preset.js +31 -60
  95. package/dist/core-server/presets/common-preset.js +663 -962
  96. package/dist/csf/index.js +534 -1179
  97. package/dist/csf-tools/index.js +9 -9
  98. package/dist/docs-tools/index.js +6 -6
  99. package/dist/highlight/index.js +2 -2
  100. package/dist/instrumenter/index.js +199 -415
  101. package/dist/manager/globals-runtime.js +59044 -67141
  102. package/dist/manager/globals.js +2 -3
  103. package/dist/manager/manager-stores.d.ts +1 -0
  104. package/dist/manager/manager-stores.js +23 -0
  105. package/dist/manager/runtime.js +11569 -10953
  106. package/dist/manager-api/index.d.ts +1813 -2
  107. package/dist/manager-api/index.js +1348 -2401
  108. package/dist/manager-errors.d.ts +9 -0
  109. package/dist/manager-errors.js +3 -3
  110. package/dist/mocking-utils/index.d.ts +1126 -0
  111. package/dist/mocking-utils/index.js +1181 -0
  112. package/dist/node-logger/index.d.ts +192 -24
  113. package/dist/node-logger/index.js +23 -4471
  114. package/dist/preview/globals.js +2 -3
  115. package/dist/preview/runtime.js +10799 -22393
  116. package/dist/preview-api/index.d.ts +1 -1
  117. package/dist/preview-api/index.js +13 -13
  118. package/dist/preview-errors.d.ts +9 -0
  119. package/dist/preview-errors.js +4 -4
  120. package/dist/router/index.js +347 -899
  121. package/dist/server-errors.d.ts +34 -1
  122. package/dist/server-errors.js +17 -10
  123. package/dist/telemetry/index.d.ts +24 -3
  124. package/dist/telemetry/index.js +25 -24
  125. package/dist/test/index.js +6131 -11916
  126. package/dist/theming/create.d.ts +1 -0
  127. package/dist/theming/create.js +4 -4
  128. package/dist/theming/index.d.ts +3366 -2599
  129. package/dist/theming/index.js +501 -1091
  130. package/dist/types/index.d.ts +72 -8
  131. package/dist/types/index.js +27 -12
  132. package/dist/viewport/index.js +3 -3
  133. package/package.json +26 -17
  134. package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
  135. package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
  136. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  137. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  138. package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
  139. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  140. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  141. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  142. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  143. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  144. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  145. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  146. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  147. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  148. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  149. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  150. package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
  151. package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
  152. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  153. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  154. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  155. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  156. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  157. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  158. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  159. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  160. package/dist/_node-chunks/camelcase-H5QSGQLK.js +0 -18
  161. package/dist/_node-chunks/chunk-3THWHQOC.js +0 -61
  162. package/dist/_node-chunks/chunk-45YUOLTU.js +0 -69
  163. package/dist/_node-chunks/chunk-4QSNCPAU.js +0 -64656
  164. package/dist/_node-chunks/chunk-744PQSOU.js +0 -79
  165. package/dist/_node-chunks/chunk-74Z2U7QG.js +0 -1544
  166. package/dist/_node-chunks/chunk-7MB7TFPO.js +0 -1198
  167. package/dist/_node-chunks/chunk-A7GS4RFT.js +0 -697
  168. package/dist/_node-chunks/chunk-BIA3A5UM.js +0 -61
  169. package/dist/_node-chunks/chunk-C5G7CLWX.js +0 -1657
  170. package/dist/_node-chunks/chunk-DLFUKMYJ.js +0 -1531
  171. package/dist/_node-chunks/chunk-EMRGRXKT.js +0 -111
  172. package/dist/_node-chunks/chunk-EX46EHHY.js +0 -420
  173. package/dist/_node-chunks/chunk-F76QKNOJ.js +0 -304
  174. package/dist/_node-chunks/chunk-HDCRUTEF.js +0 -220
  175. package/dist/_node-chunks/chunk-HUYAOIPH.js +0 -90
  176. package/dist/_node-chunks/chunk-IBJZQZJC.js +0 -101
  177. package/dist/_node-chunks/chunk-KZN2RDDT.js +0 -6712
  178. package/dist/_node-chunks/chunk-LYUNFU3F.js +0 -4741
  179. package/dist/_node-chunks/chunk-N44SIS6K.js +0 -28
  180. package/dist/_node-chunks/chunk-NILZM6KR.js +0 -18
  181. package/dist/_node-chunks/chunk-PC4ZRP6W.js +0 -34
  182. package/dist/_node-chunks/chunk-TJNGOQUH.js +0 -4272
  183. package/dist/_node-chunks/chunk-UBSYLHIL.js +0 -1250
  184. package/dist/_node-chunks/chunk-UTCLXPOC.js +0 -1518
  185. package/dist/_node-chunks/chunk-WOXXODXP.js +0 -5029
  186. package/dist/_node-chunks/chunk-XC4MEUA6.js +0 -1586
  187. package/dist/_node-chunks/chunk-YRXXMKRR.js +0 -2256
  188. package/dist/_node-chunks/dist-SL73W244.js +0 -175
  189. package/dist/_node-chunks/globby-ZSHAUQZ5.js +0 -5222
  190. package/dist/_node-chunks/lib-U2VIPUTI.js +0 -518
  191. package/dist/_node-chunks/mdx-N42X6CFJ-ZLHD33JK.js +0 -22017
  192. package/dist/_node-chunks/p-limit-K5BS5MSV.js +0 -168
  193. package/dist/_node-chunks/plugin-5PD4YIUH.js +0 -129
  194. package/dist/_node-chunks/plugin-MONDT2WL.js +0 -159
  195. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-EUZJRG3W.js +0 -69102
  196. package/dist/_node-chunks/webpack-mock-plugin-T4LDXEHE.js +0 -124
  197. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
  198. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
@@ -1,4052 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
- // ../node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
6
- var f = {
7
- reset: [0, 0],
8
- bold: [1, 22, "\x1B[22m\x1B[1m"],
9
- dim: [2, 22, "\x1B[22m\x1B[2m"],
10
- italic: [3, 23],
11
- underline: [4, 24],
12
- inverse: [7, 27],
13
- hidden: [8, 28],
14
- strikethrough: [9, 29],
15
- black: [30, 39],
16
- red: [31, 39],
17
- green: [32, 39],
18
- yellow: [33, 39],
19
- blue: [34, 39],
20
- magenta: [35, 39],
21
- cyan: [36, 39],
22
- white: [37, 39],
23
- gray: [90, 39],
24
- bgBlack: [40, 49],
25
- bgRed: [41, 49],
26
- bgGreen: [42, 49],
27
- bgYellow: [43, 49],
28
- bgBlue: [44, 49],
29
- bgMagenta: [45, 49],
30
- bgCyan: [46, 49],
31
- bgWhite: [47, 49],
32
- blackBright: [90, 39],
33
- redBright: [91, 39],
34
- greenBright: [92, 39],
35
- yellowBright: [93, 39],
36
- blueBright: [94, 39],
37
- magentaBright: [95, 39],
38
- cyanBright: [96, 39],
39
- whiteBright: [97, 39],
40
- bgBlackBright: [100, 49],
41
- bgRedBright: [101, 49],
42
- bgGreenBright: [102, 49],
43
- bgYellowBright: [103, 49],
44
- bgBlueBright: [104, 49],
45
- bgMagentaBright: [105, 49],
46
- bgCyanBright: [106, 49],
47
- bgWhiteBright: [107, 49]
48
- };
49
- var h = Object.entries(f);
50
- function a(n) {
51
- return String(n);
52
- }
53
- __name(a, "a");
54
- a.open = "";
55
- a.close = "";
56
- var B = h.reduce(
57
- (n, [e]) => (n[e] = a, n),
58
- { isColorSupported: false }
59
- );
60
- function C(n = false) {
61
- let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
62
- return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
63
- }
64
- __name(C, "C");
65
- function p(n = false) {
66
- let e = C(n), i = /* @__PURE__ */ __name((r, t, c, o) => {
67
- let l = "", s2 = 0;
68
- do
69
- l += r.substring(s2, o) + c, s2 = o + t.length, o = r.indexOf(t, s2);
70
- while (~o);
71
- return l + r.substring(s2);
72
- }, "i"), g = /* @__PURE__ */ __name((r, t, c = r) => {
73
- let o = /* @__PURE__ */ __name((l) => {
74
- let s2 = String(l), b = s2.indexOf(t, r.length);
75
- return ~b ? r + i(s2, t, c, b) + t : r + s2 + t;
76
- }, "o");
77
- return o.open = r, o.close = t, o;
78
- }, "g"), u = {
79
- isColorSupported: e
80
- }, d = /* @__PURE__ */ __name((r) => `\x1B[${r}m`, "d");
81
- for (let [r, t] of h)
82
- u[r] = e ? g(
83
- d(t[0]),
84
- d(t[1]),
85
- t[2]
86
- ) : a;
87
- return u;
88
- }
89
- __name(p, "p");
90
-
91
- // ../node_modules/tinyrainbow/dist/browser.js
92
- var s = p();
93
-
94
- // ../node_modules/@vitest/pretty-format/dist/index.js
95
- function _mergeNamespaces(n, m2) {
96
- m2.forEach(function(e) {
97
- e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
98
- if (k !== "default" && !(k in n)) {
99
- var d = Object.getOwnPropertyDescriptor(e, k);
100
- Object.defineProperty(n, k, d.get ? d : {
101
- enumerable: true,
102
- get: /* @__PURE__ */ __name(function() {
103
- return e[k];
104
- }, "get")
105
- });
106
- }
107
- });
108
- });
109
- return Object.freeze(n);
110
- }
111
- __name(_mergeNamespaces, "_mergeNamespaces");
112
- function getKeysOfEnumerableProperties(object, compareKeys) {
113
- const rawKeys = Object.keys(object);
114
- const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
115
- if (Object.getOwnPropertySymbols) {
116
- for (const symbol of Object.getOwnPropertySymbols(object)) {
117
- if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
118
- keys.push(symbol);
119
- }
120
- }
121
- }
122
- return keys;
123
- }
124
- __name(getKeysOfEnumerableProperties, "getKeysOfEnumerableProperties");
125
- function printIteratorEntries(iterator, config, indentation, depth, refs, printer2, separator = ": ") {
126
- let result = "";
127
- let width = 0;
128
- let current = iterator.next();
129
- if (!current.done) {
130
- result += config.spacingOuter;
131
- const indentationNext = indentation + config.indent;
132
- while (!current.done) {
133
- result += indentationNext;
134
- if (width++ === config.maxWidth) {
135
- result += "\u2026";
136
- break;
137
- }
138
- const name = printer2(current.value[0], config, indentationNext, depth, refs);
139
- const value = printer2(current.value[1], config, indentationNext, depth, refs);
140
- result += name + separator + value;
141
- current = iterator.next();
142
- if (!current.done) {
143
- result += `,${config.spacingInner}`;
144
- } else if (!config.min) {
145
- result += ",";
146
- }
147
- }
148
- result += config.spacingOuter + indentation;
149
- }
150
- return result;
151
- }
152
- __name(printIteratorEntries, "printIteratorEntries");
153
- function printIteratorValues(iterator, config, indentation, depth, refs, printer2) {
154
- let result = "";
155
- let width = 0;
156
- let current = iterator.next();
157
- if (!current.done) {
158
- result += config.spacingOuter;
159
- const indentationNext = indentation + config.indent;
160
- while (!current.done) {
161
- result += indentationNext;
162
- if (width++ === config.maxWidth) {
163
- result += "\u2026";
164
- break;
165
- }
166
- result += printer2(current.value, config, indentationNext, depth, refs);
167
- current = iterator.next();
168
- if (!current.done) {
169
- result += `,${config.spacingInner}`;
170
- } else if (!config.min) {
171
- result += ",";
172
- }
173
- }
174
- result += config.spacingOuter + indentation;
175
- }
176
- return result;
177
- }
178
- __name(printIteratorValues, "printIteratorValues");
179
- function printListItems(list, config, indentation, depth, refs, printer2) {
180
- let result = "";
181
- list = list instanceof ArrayBuffer ? new DataView(list) : list;
182
- const isDataView = /* @__PURE__ */ __name((l) => l instanceof DataView, "isDataView");
183
- const length = isDataView(list) ? list.byteLength : list.length;
184
- if (length > 0) {
185
- result += config.spacingOuter;
186
- const indentationNext = indentation + config.indent;
187
- for (let i = 0; i < length; i++) {
188
- result += indentationNext;
189
- if (i === config.maxWidth) {
190
- result += "\u2026";
191
- break;
192
- }
193
- if (isDataView(list) || i in list) {
194
- result += printer2(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
195
- }
196
- if (i < length - 1) {
197
- result += `,${config.spacingInner}`;
198
- } else if (!config.min) {
199
- result += ",";
200
- }
201
- }
202
- result += config.spacingOuter + indentation;
203
- }
204
- return result;
205
- }
206
- __name(printListItems, "printListItems");
207
- function printObjectProperties(val, config, indentation, depth, refs, printer2) {
208
- let result = "";
209
- const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
210
- if (keys.length > 0) {
211
- result += config.spacingOuter;
212
- const indentationNext = indentation + config.indent;
213
- for (let i = 0; i < keys.length; i++) {
214
- const key = keys[i];
215
- const name = printer2(key, config, indentationNext, depth, refs);
216
- const value = printer2(val[key], config, indentationNext, depth, refs);
217
- result += `${indentationNext + name}: ${value}`;
218
- if (i < keys.length - 1) {
219
- result += `,${config.spacingInner}`;
220
- } else if (!config.min) {
221
- result += ",";
222
- }
223
- }
224
- result += config.spacingOuter + indentation;
225
- }
226
- return result;
227
- }
228
- __name(printObjectProperties, "printObjectProperties");
229
- var asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
230
- var SPACE$2 = " ";
231
- var serialize$5 = /* @__PURE__ */ __name((val, config, indentation, depth, refs, printer2) => {
232
- const stringedValue = val.toString();
233
- if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
234
- if (++depth > config.maxDepth) {
235
- return `[${stringedValue}]`;
236
- }
237
- return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer2)}]`;
238
- }
239
- if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
240
- if (++depth > config.maxDepth) {
241
- return `[${stringedValue}]`;
242
- }
243
- return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer2)}}`;
244
- }
245
- if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
246
- return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
247
- }
248
- if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
249
- return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
250
- }
251
- if (typeof val.toAsymmetricMatcher !== "function") {
252
- throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
253
- }
254
- return val.toAsymmetricMatcher();
255
- }, "serialize$5");
256
- var test$5 = /* @__PURE__ */ __name((val) => val && val.$$typeof === asymmetricMatcher, "test$5");
257
- var plugin$5 = {
258
- serialize: serialize$5,
259
- test: test$5
260
- };
261
- var SPACE$1 = " ";
262
- var OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
263
- var ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
264
- function testName(name) {
265
- return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
266
- }
267
- __name(testName, "testName");
268
- var test$4 = /* @__PURE__ */ __name((val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name), "test$4");
269
- function isNamedNodeMap(collection) {
270
- return collection.constructor.name === "NamedNodeMap";
271
- }
272
- __name(isNamedNodeMap, "isNamedNodeMap");
273
- var serialize$4 = /* @__PURE__ */ __name((collection, config, indentation, depth, refs, printer2) => {
274
- const name = collection.constructor.name;
275
- if (++depth > config.maxDepth) {
276
- return `[${name}]`;
277
- }
278
- return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
279
- props[attribute.name] = attribute.value;
280
- return props;
281
- }, {}) : { ...collection }, config, indentation, depth, refs, printer2)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer2)}]`);
282
- }, "serialize$4");
283
- var plugin$4 = {
284
- serialize: serialize$4,
285
- test: test$4
286
- };
287
- function escapeHTML(str) {
288
- return str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
289
- }
290
- __name(escapeHTML, "escapeHTML");
291
- function printProps(keys, props, config, indentation, depth, refs, printer2) {
292
- const indentationNext = indentation + config.indent;
293
- const colors = config.colors;
294
- return keys.map((key) => {
295
- const value = props[key];
296
- let printed = printer2(value, config, indentationNext, depth, refs);
297
- if (typeof value !== "string") {
298
- if (printed.includes("\n")) {
299
- printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
300
- }
301
- printed = `{${printed}}`;
302
- }
303
- return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
304
- }).join("");
305
- }
306
- __name(printProps, "printProps");
307
- function printChildren(children, config, indentation, depth, refs, printer2) {
308
- return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer2(child, config, indentation, depth, refs))).join("");
309
- }
310
- __name(printChildren, "printChildren");
311
- function printText(text, config) {
312
- const contentColor = config.colors.content;
313
- return contentColor.open + escapeHTML(text) + contentColor.close;
314
- }
315
- __name(printText, "printText");
316
- function printComment(comment, config) {
317
- const commentColor = config.colors.comment;
318
- return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
319
- }
320
- __name(printComment, "printComment");
321
- function printElement(type, printedProps, printedChildren, config, indentation) {
322
- const tagColor = config.colors.tag;
323
- return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
324
- }
325
- __name(printElement, "printElement");
326
- function printElementAsLeaf(type, config) {
327
- const tagColor = config.colors.tag;
328
- return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`;
329
- }
330
- __name(printElementAsLeaf, "printElementAsLeaf");
331
- var ELEMENT_NODE = 1;
332
- var TEXT_NODE = 3;
333
- var COMMENT_NODE = 8;
334
- var FRAGMENT_NODE = 11;
335
- var ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
336
- function testHasAttribute(val) {
337
- try {
338
- return typeof val.hasAttribute === "function" && val.hasAttribute("is");
339
- } catch {
340
- return false;
341
- }
342
- }
343
- __name(testHasAttribute, "testHasAttribute");
344
- function testNode(val) {
345
- const constructorName = val.constructor.name;
346
- const { nodeType, tagName } = val;
347
- const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
348
- return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
349
- }
350
- __name(testNode, "testNode");
351
- var test$3 = /* @__PURE__ */ __name((val) => {
352
- var _val$constructor;
353
- return (val === null || val === void 0 || (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val);
354
- }, "test$3");
355
- function nodeIsText(node) {
356
- return node.nodeType === TEXT_NODE;
357
- }
358
- __name(nodeIsText, "nodeIsText");
359
- function nodeIsComment(node) {
360
- return node.nodeType === COMMENT_NODE;
361
- }
362
- __name(nodeIsComment, "nodeIsComment");
363
- function nodeIsFragment(node) {
364
- return node.nodeType === FRAGMENT_NODE;
365
- }
366
- __name(nodeIsFragment, "nodeIsFragment");
367
- var serialize$3 = /* @__PURE__ */ __name((node, config, indentation, depth, refs, printer2) => {
368
- if (nodeIsText(node)) {
369
- return printText(node.data, config);
370
- }
371
- if (nodeIsComment(node)) {
372
- return printComment(node.data, config);
373
- }
374
- const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
375
- if (++depth > config.maxDepth) {
376
- return printElementAsLeaf(type, config);
377
- }
378
- return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
379
- props[attribute.name] = attribute.value;
380
- return props;
381
- }, {}), config, indentation + config.indent, depth, refs, printer2), printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
382
- }, "serialize$3");
383
- var plugin$3 = {
384
- serialize: serialize$3,
385
- test: test$3
386
- };
387
- var IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
388
- var IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
389
- var IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
390
- var IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
391
- var IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
392
- var IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
393
- var IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
394
- var IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
395
- var IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
396
- var getImmutableName = /* @__PURE__ */ __name((name) => `Immutable.${name}`, "getImmutableName");
397
- var printAsLeaf = /* @__PURE__ */ __name((name) => `[${name}]`, "printAsLeaf");
398
- var SPACE = " ";
399
- var LAZY = "\u2026";
400
- function printImmutableEntries(val, config, indentation, depth, refs, printer2, type) {
401
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2)}}`;
402
- }
403
- __name(printImmutableEntries, "printImmutableEntries");
404
- function getRecordEntries(val) {
405
- let i = 0;
406
- return { next() {
407
- if (i < val._keys.length) {
408
- const key = val._keys[i++];
409
- return {
410
- done: false,
411
- value: [key, val.get(key)]
412
- };
413
- }
414
- return {
415
- done: true,
416
- value: void 0
417
- };
418
- } };
419
- }
420
- __name(getRecordEntries, "getRecordEntries");
421
- function printImmutableRecord(val, config, indentation, depth, refs, printer2) {
422
- const name = getImmutableName(val._name || "Record");
423
- return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer2)}}`;
424
- }
425
- __name(printImmutableRecord, "printImmutableRecord");
426
- function printImmutableSeq(val, config, indentation, depth, refs, printer2) {
427
- const name = getImmutableName("Seq");
428
- if (++depth > config.maxDepth) {
429
- return printAsLeaf(name);
430
- }
431
- if (val[IS_KEYED_SENTINEL]) {
432
- return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2) : LAZY}}`;
433
- }
434
- return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer2) : LAZY}]`;
435
- }
436
- __name(printImmutableSeq, "printImmutableSeq");
437
- function printImmutableValues(val, config, indentation, depth, refs, printer2, type) {
438
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer2)}]`;
439
- }
440
- __name(printImmutableValues, "printImmutableValues");
441
- var serialize$2 = /* @__PURE__ */ __name((val, config, indentation, depth, refs, printer2) => {
442
- if (val[IS_MAP_SENTINEL]) {
443
- return printImmutableEntries(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
444
- }
445
- if (val[IS_LIST_SENTINEL]) {
446
- return printImmutableValues(val, config, indentation, depth, refs, printer2, "List");
447
- }
448
- if (val[IS_SET_SENTINEL]) {
449
- return printImmutableValues(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
450
- }
451
- if (val[IS_STACK_SENTINEL]) {
452
- return printImmutableValues(val, config, indentation, depth, refs, printer2, "Stack");
453
- }
454
- if (val[IS_SEQ_SENTINEL]) {
455
- return printImmutableSeq(val, config, indentation, depth, refs, printer2);
456
- }
457
- return printImmutableRecord(val, config, indentation, depth, refs, printer2);
458
- }, "serialize$2");
459
- var test$2 = /* @__PURE__ */ __name((val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true), "test$2");
460
- var plugin$2 = {
461
- serialize: serialize$2,
462
- test: test$2
463
- };
464
- function getDefaultExportFromCjs(x) {
465
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
466
- }
467
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
468
- var reactIs$1 = { exports: {} };
469
- var reactIs_production = {};
470
- var hasRequiredReactIs_production;
471
- function requireReactIs_production() {
472
- if (hasRequiredReactIs_production) return reactIs_production;
473
- hasRequiredReactIs_production = 1;
474
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
475
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
476
- function typeOf(object) {
477
- if ("object" === typeof object && null !== object) {
478
- var $$typeof = object.$$typeof;
479
- switch ($$typeof) {
480
- case REACT_ELEMENT_TYPE:
481
- switch (object = object.type, object) {
482
- case REACT_FRAGMENT_TYPE:
483
- case REACT_PROFILER_TYPE:
484
- case REACT_STRICT_MODE_TYPE:
485
- case REACT_SUSPENSE_TYPE:
486
- case REACT_SUSPENSE_LIST_TYPE:
487
- case REACT_VIEW_TRANSITION_TYPE:
488
- return object;
489
- default:
490
- switch (object = object && object.$$typeof, object) {
491
- case REACT_CONTEXT_TYPE:
492
- case REACT_FORWARD_REF_TYPE:
493
- case REACT_LAZY_TYPE:
494
- case REACT_MEMO_TYPE:
495
- return object;
496
- case REACT_CONSUMER_TYPE:
497
- return object;
498
- default:
499
- return $$typeof;
500
- }
501
- }
502
- case REACT_PORTAL_TYPE:
503
- return $$typeof;
504
- }
505
- }
506
- }
507
- __name(typeOf, "typeOf");
508
- reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
509
- reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
510
- reactIs_production.Element = REACT_ELEMENT_TYPE;
511
- reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
512
- reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
513
- reactIs_production.Lazy = REACT_LAZY_TYPE;
514
- reactIs_production.Memo = REACT_MEMO_TYPE;
515
- reactIs_production.Portal = REACT_PORTAL_TYPE;
516
- reactIs_production.Profiler = REACT_PROFILER_TYPE;
517
- reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
518
- reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
519
- reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
520
- reactIs_production.isContextConsumer = function(object) {
521
- return typeOf(object) === REACT_CONSUMER_TYPE;
522
- };
523
- reactIs_production.isContextProvider = function(object) {
524
- return typeOf(object) === REACT_CONTEXT_TYPE;
525
- };
526
- reactIs_production.isElement = function(object) {
527
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
528
- };
529
- reactIs_production.isForwardRef = function(object) {
530
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
531
- };
532
- reactIs_production.isFragment = function(object) {
533
- return typeOf(object) === REACT_FRAGMENT_TYPE;
534
- };
535
- reactIs_production.isLazy = function(object) {
536
- return typeOf(object) === REACT_LAZY_TYPE;
537
- };
538
- reactIs_production.isMemo = function(object) {
539
- return typeOf(object) === REACT_MEMO_TYPE;
540
- };
541
- reactIs_production.isPortal = function(object) {
542
- return typeOf(object) === REACT_PORTAL_TYPE;
543
- };
544
- reactIs_production.isProfiler = function(object) {
545
- return typeOf(object) === REACT_PROFILER_TYPE;
546
- };
547
- reactIs_production.isStrictMode = function(object) {
548
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
549
- };
550
- reactIs_production.isSuspense = function(object) {
551
- return typeOf(object) === REACT_SUSPENSE_TYPE;
552
- };
553
- reactIs_production.isSuspenseList = function(object) {
554
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
555
- };
556
- reactIs_production.isValidElementType = function(type) {
557
- return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
558
- };
559
- reactIs_production.typeOf = typeOf;
560
- return reactIs_production;
561
- }
562
- __name(requireReactIs_production, "requireReactIs_production");
563
- var reactIs_development$1 = {};
564
- var hasRequiredReactIs_development$1;
565
- function requireReactIs_development$1() {
566
- if (hasRequiredReactIs_development$1) return reactIs_development$1;
567
- hasRequiredReactIs_development$1 = 1;
568
- "production" !== process.env.NODE_ENV && function() {
569
- function typeOf(object) {
570
- if ("object" === typeof object && null !== object) {
571
- var $$typeof = object.$$typeof;
572
- switch ($$typeof) {
573
- case REACT_ELEMENT_TYPE:
574
- switch (object = object.type, object) {
575
- case REACT_FRAGMENT_TYPE:
576
- case REACT_PROFILER_TYPE:
577
- case REACT_STRICT_MODE_TYPE:
578
- case REACT_SUSPENSE_TYPE:
579
- case REACT_SUSPENSE_LIST_TYPE:
580
- case REACT_VIEW_TRANSITION_TYPE:
581
- return object;
582
- default:
583
- switch (object = object && object.$$typeof, object) {
584
- case REACT_CONTEXT_TYPE:
585
- case REACT_FORWARD_REF_TYPE:
586
- case REACT_LAZY_TYPE:
587
- case REACT_MEMO_TYPE:
588
- return object;
589
- case REACT_CONSUMER_TYPE:
590
- return object;
591
- default:
592
- return $$typeof;
593
- }
594
- }
595
- case REACT_PORTAL_TYPE:
596
- return $$typeof;
597
- }
598
- }
599
- }
600
- __name(typeOf, "typeOf");
601
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
602
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
603
- reactIs_development$1.ContextConsumer = REACT_CONSUMER_TYPE;
604
- reactIs_development$1.ContextProvider = REACT_CONTEXT_TYPE;
605
- reactIs_development$1.Element = REACT_ELEMENT_TYPE;
606
- reactIs_development$1.ForwardRef = REACT_FORWARD_REF_TYPE;
607
- reactIs_development$1.Fragment = REACT_FRAGMENT_TYPE;
608
- reactIs_development$1.Lazy = REACT_LAZY_TYPE;
609
- reactIs_development$1.Memo = REACT_MEMO_TYPE;
610
- reactIs_development$1.Portal = REACT_PORTAL_TYPE;
611
- reactIs_development$1.Profiler = REACT_PROFILER_TYPE;
612
- reactIs_development$1.StrictMode = REACT_STRICT_MODE_TYPE;
613
- reactIs_development$1.Suspense = REACT_SUSPENSE_TYPE;
614
- reactIs_development$1.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
615
- reactIs_development$1.isContextConsumer = function(object) {
616
- return typeOf(object) === REACT_CONSUMER_TYPE;
617
- };
618
- reactIs_development$1.isContextProvider = function(object) {
619
- return typeOf(object) === REACT_CONTEXT_TYPE;
620
- };
621
- reactIs_development$1.isElement = function(object) {
622
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
623
- };
624
- reactIs_development$1.isForwardRef = function(object) {
625
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
626
- };
627
- reactIs_development$1.isFragment = function(object) {
628
- return typeOf(object) === REACT_FRAGMENT_TYPE;
629
- };
630
- reactIs_development$1.isLazy = function(object) {
631
- return typeOf(object) === REACT_LAZY_TYPE;
632
- };
633
- reactIs_development$1.isMemo = function(object) {
634
- return typeOf(object) === REACT_MEMO_TYPE;
635
- };
636
- reactIs_development$1.isPortal = function(object) {
637
- return typeOf(object) === REACT_PORTAL_TYPE;
638
- };
639
- reactIs_development$1.isProfiler = function(object) {
640
- return typeOf(object) === REACT_PROFILER_TYPE;
641
- };
642
- reactIs_development$1.isStrictMode = function(object) {
643
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
644
- };
645
- reactIs_development$1.isSuspense = function(object) {
646
- return typeOf(object) === REACT_SUSPENSE_TYPE;
647
- };
648
- reactIs_development$1.isSuspenseList = function(object) {
649
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
650
- };
651
- reactIs_development$1.isValidElementType = function(type) {
652
- return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
653
- };
654
- reactIs_development$1.typeOf = typeOf;
655
- }();
656
- return reactIs_development$1;
657
- }
658
- __name(requireReactIs_development$1, "requireReactIs_development$1");
659
- var hasRequiredReactIs$1;
660
- function requireReactIs$1() {
661
- if (hasRequiredReactIs$1) return reactIs$1.exports;
662
- hasRequiredReactIs$1 = 1;
663
- if (process.env.NODE_ENV === "production") {
664
- reactIs$1.exports = requireReactIs_production();
665
- } else {
666
- reactIs$1.exports = requireReactIs_development$1();
667
- }
668
- return reactIs$1.exports;
669
- }
670
- __name(requireReactIs$1, "requireReactIs$1");
671
- var reactIsExports$1 = requireReactIs$1();
672
- var index$1 = getDefaultExportFromCjs(reactIsExports$1);
673
- var ReactIs19 = _mergeNamespaces({
674
- __proto__: null,
675
- default: index$1
676
- }, [reactIsExports$1]);
677
- var reactIs = { exports: {} };
678
- var reactIs_production_min = {};
679
- var hasRequiredReactIs_production_min;
680
- function requireReactIs_production_min() {
681
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
682
- hasRequiredReactIs_production_min = 1;
683
- var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f2 = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h2 = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m2 = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p2 = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u;
684
- u = Symbol.for("react.module.reference");
685
- function v(a2) {
686
- if ("object" === typeof a2 && null !== a2) {
687
- var r = a2.$$typeof;
688
- switch (r) {
689
- case b:
690
- switch (a2 = a2.type, a2) {
691
- case d:
692
- case f2:
693
- case e:
694
- case m2:
695
- case n:
696
- return a2;
697
- default:
698
- switch (a2 = a2 && a2.$$typeof, a2) {
699
- case k:
700
- case h2:
701
- case l:
702
- case q:
703
- case p2:
704
- case g:
705
- return a2;
706
- default:
707
- return r;
708
- }
709
- }
710
- case c:
711
- return r;
712
- }
713
- }
714
- }
715
- __name(v, "v");
716
- reactIs_production_min.ContextConsumer = h2;
717
- reactIs_production_min.ContextProvider = g;
718
- reactIs_production_min.Element = b;
719
- reactIs_production_min.ForwardRef = l;
720
- reactIs_production_min.Fragment = d;
721
- reactIs_production_min.Lazy = q;
722
- reactIs_production_min.Memo = p2;
723
- reactIs_production_min.Portal = c;
724
- reactIs_production_min.Profiler = f2;
725
- reactIs_production_min.StrictMode = e;
726
- reactIs_production_min.Suspense = m2;
727
- reactIs_production_min.SuspenseList = n;
728
- reactIs_production_min.isAsyncMode = function() {
729
- return false;
730
- };
731
- reactIs_production_min.isConcurrentMode = function() {
732
- return false;
733
- };
734
- reactIs_production_min.isContextConsumer = function(a2) {
735
- return v(a2) === h2;
736
- };
737
- reactIs_production_min.isContextProvider = function(a2) {
738
- return v(a2) === g;
739
- };
740
- reactIs_production_min.isElement = function(a2) {
741
- return "object" === typeof a2 && null !== a2 && a2.$$typeof === b;
742
- };
743
- reactIs_production_min.isForwardRef = function(a2) {
744
- return v(a2) === l;
745
- };
746
- reactIs_production_min.isFragment = function(a2) {
747
- return v(a2) === d;
748
- };
749
- reactIs_production_min.isLazy = function(a2) {
750
- return v(a2) === q;
751
- };
752
- reactIs_production_min.isMemo = function(a2) {
753
- return v(a2) === p2;
754
- };
755
- reactIs_production_min.isPortal = function(a2) {
756
- return v(a2) === c;
757
- };
758
- reactIs_production_min.isProfiler = function(a2) {
759
- return v(a2) === f2;
760
- };
761
- reactIs_production_min.isStrictMode = function(a2) {
762
- return v(a2) === e;
763
- };
764
- reactIs_production_min.isSuspense = function(a2) {
765
- return v(a2) === m2;
766
- };
767
- reactIs_production_min.isSuspenseList = function(a2) {
768
- return v(a2) === n;
769
- };
770
- reactIs_production_min.isValidElementType = function(a2) {
771
- return "string" === typeof a2 || "function" === typeof a2 || a2 === d || a2 === f2 || a2 === e || a2 === m2 || a2 === n || a2 === t || "object" === typeof a2 && null !== a2 && (a2.$$typeof === q || a2.$$typeof === p2 || a2.$$typeof === g || a2.$$typeof === h2 || a2.$$typeof === l || a2.$$typeof === u || void 0 !== a2.getModuleId) ? true : false;
772
- };
773
- reactIs_production_min.typeOf = v;
774
- return reactIs_production_min;
775
- }
776
- __name(requireReactIs_production_min, "requireReactIs_production_min");
777
- var reactIs_development = {};
778
- var hasRequiredReactIs_development;
779
- function requireReactIs_development() {
780
- if (hasRequiredReactIs_development) return reactIs_development;
781
- hasRequiredReactIs_development = 1;
782
- if (process.env.NODE_ENV !== "production") {
783
- (function() {
784
- var REACT_ELEMENT_TYPE = Symbol.for("react.element");
785
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
786
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
787
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
788
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
789
- var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
790
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
791
- var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
792
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
793
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
794
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
795
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
796
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
797
- var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
798
- var enableScopeAPI = false;
799
- var enableCacheElement = false;
800
- var enableTransitionTracing = false;
801
- var enableLegacyHidden = false;
802
- var enableDebugTracing = false;
803
- var REACT_MODULE_REFERENCE;
804
- {
805
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
806
- }
807
- function isValidElementType(type) {
808
- if (typeof type === "string" || typeof type === "function") {
809
- return true;
810
- }
811
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
812
- return true;
813
- }
814
- if (typeof type === "object" && type !== null) {
815
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
816
- // types supported by any Flight configuration anywhere since
817
- // we don't know which Flight build this will end up being used
818
- // with.
819
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
820
- return true;
821
- }
822
- }
823
- return false;
824
- }
825
- __name(isValidElementType, "isValidElementType");
826
- function typeOf(object) {
827
- if (typeof object === "object" && object !== null) {
828
- var $$typeof = object.$$typeof;
829
- switch ($$typeof) {
830
- case REACT_ELEMENT_TYPE:
831
- var type = object.type;
832
- switch (type) {
833
- case REACT_FRAGMENT_TYPE:
834
- case REACT_PROFILER_TYPE:
835
- case REACT_STRICT_MODE_TYPE:
836
- case REACT_SUSPENSE_TYPE:
837
- case REACT_SUSPENSE_LIST_TYPE:
838
- return type;
839
- default:
840
- var $$typeofType = type && type.$$typeof;
841
- switch ($$typeofType) {
842
- case REACT_SERVER_CONTEXT_TYPE:
843
- case REACT_CONTEXT_TYPE:
844
- case REACT_FORWARD_REF_TYPE:
845
- case REACT_LAZY_TYPE:
846
- case REACT_MEMO_TYPE:
847
- case REACT_PROVIDER_TYPE:
848
- return $$typeofType;
849
- default:
850
- return $$typeof;
851
- }
852
- }
853
- case REACT_PORTAL_TYPE:
854
- return $$typeof;
855
- }
856
- }
857
- return void 0;
858
- }
859
- __name(typeOf, "typeOf");
860
- var ContextConsumer = REACT_CONTEXT_TYPE;
861
- var ContextProvider = REACT_PROVIDER_TYPE;
862
- var Element2 = REACT_ELEMENT_TYPE;
863
- var ForwardRef = REACT_FORWARD_REF_TYPE;
864
- var Fragment = REACT_FRAGMENT_TYPE;
865
- var Lazy = REACT_LAZY_TYPE;
866
- var Memo = REACT_MEMO_TYPE;
867
- var Portal = REACT_PORTAL_TYPE;
868
- var Profiler = REACT_PROFILER_TYPE;
869
- var StrictMode = REACT_STRICT_MODE_TYPE;
870
- var Suspense = REACT_SUSPENSE_TYPE;
871
- var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
872
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
873
- var hasWarnedAboutDeprecatedIsConcurrentMode = false;
874
- function isAsyncMode(object) {
875
- {
876
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
877
- hasWarnedAboutDeprecatedIsAsyncMode = true;
878
- console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
879
- }
880
- }
881
- return false;
882
- }
883
- __name(isAsyncMode, "isAsyncMode");
884
- function isConcurrentMode(object) {
885
- {
886
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
887
- hasWarnedAboutDeprecatedIsConcurrentMode = true;
888
- console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
889
- }
890
- }
891
- return false;
892
- }
893
- __name(isConcurrentMode, "isConcurrentMode");
894
- function isContextConsumer(object) {
895
- return typeOf(object) === REACT_CONTEXT_TYPE;
896
- }
897
- __name(isContextConsumer, "isContextConsumer");
898
- function isContextProvider(object) {
899
- return typeOf(object) === REACT_PROVIDER_TYPE;
900
- }
901
- __name(isContextProvider, "isContextProvider");
902
- function isElement(object) {
903
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
904
- }
905
- __name(isElement, "isElement");
906
- function isForwardRef(object) {
907
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
908
- }
909
- __name(isForwardRef, "isForwardRef");
910
- function isFragment(object) {
911
- return typeOf(object) === REACT_FRAGMENT_TYPE;
912
- }
913
- __name(isFragment, "isFragment");
914
- function isLazy(object) {
915
- return typeOf(object) === REACT_LAZY_TYPE;
916
- }
917
- __name(isLazy, "isLazy");
918
- function isMemo(object) {
919
- return typeOf(object) === REACT_MEMO_TYPE;
920
- }
921
- __name(isMemo, "isMemo");
922
- function isPortal(object) {
923
- return typeOf(object) === REACT_PORTAL_TYPE;
924
- }
925
- __name(isPortal, "isPortal");
926
- function isProfiler(object) {
927
- return typeOf(object) === REACT_PROFILER_TYPE;
928
- }
929
- __name(isProfiler, "isProfiler");
930
- function isStrictMode(object) {
931
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
932
- }
933
- __name(isStrictMode, "isStrictMode");
934
- function isSuspense(object) {
935
- return typeOf(object) === REACT_SUSPENSE_TYPE;
936
- }
937
- __name(isSuspense, "isSuspense");
938
- function isSuspenseList(object) {
939
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
940
- }
941
- __name(isSuspenseList, "isSuspenseList");
942
- reactIs_development.ContextConsumer = ContextConsumer;
943
- reactIs_development.ContextProvider = ContextProvider;
944
- reactIs_development.Element = Element2;
945
- reactIs_development.ForwardRef = ForwardRef;
946
- reactIs_development.Fragment = Fragment;
947
- reactIs_development.Lazy = Lazy;
948
- reactIs_development.Memo = Memo;
949
- reactIs_development.Portal = Portal;
950
- reactIs_development.Profiler = Profiler;
951
- reactIs_development.StrictMode = StrictMode;
952
- reactIs_development.Suspense = Suspense;
953
- reactIs_development.SuspenseList = SuspenseList;
954
- reactIs_development.isAsyncMode = isAsyncMode;
955
- reactIs_development.isConcurrentMode = isConcurrentMode;
956
- reactIs_development.isContextConsumer = isContextConsumer;
957
- reactIs_development.isContextProvider = isContextProvider;
958
- reactIs_development.isElement = isElement;
959
- reactIs_development.isForwardRef = isForwardRef;
960
- reactIs_development.isFragment = isFragment;
961
- reactIs_development.isLazy = isLazy;
962
- reactIs_development.isMemo = isMemo;
963
- reactIs_development.isPortal = isPortal;
964
- reactIs_development.isProfiler = isProfiler;
965
- reactIs_development.isStrictMode = isStrictMode;
966
- reactIs_development.isSuspense = isSuspense;
967
- reactIs_development.isSuspenseList = isSuspenseList;
968
- reactIs_development.isValidElementType = isValidElementType;
969
- reactIs_development.typeOf = typeOf;
970
- })();
971
- }
972
- return reactIs_development;
973
- }
974
- __name(requireReactIs_development, "requireReactIs_development");
975
- var hasRequiredReactIs;
976
- function requireReactIs() {
977
- if (hasRequiredReactIs) return reactIs.exports;
978
- hasRequiredReactIs = 1;
979
- if (process.env.NODE_ENV === "production") {
980
- reactIs.exports = requireReactIs_production_min();
981
- } else {
982
- reactIs.exports = requireReactIs_development();
983
- }
984
- return reactIs.exports;
985
- }
986
- __name(requireReactIs, "requireReactIs");
987
- var reactIsExports = requireReactIs();
988
- var index = getDefaultExportFromCjs(reactIsExports);
989
- var ReactIs18 = _mergeNamespaces({
990
- __proto__: null,
991
- default: index
992
- }, [reactIsExports]);
993
- var reactIsMethods = [
994
- "isAsyncMode",
995
- "isConcurrentMode",
996
- "isContextConsumer",
997
- "isContextProvider",
998
- "isElement",
999
- "isForwardRef",
1000
- "isFragment",
1001
- "isLazy",
1002
- "isMemo",
1003
- "isPortal",
1004
- "isProfiler",
1005
- "isStrictMode",
1006
- "isSuspense",
1007
- "isSuspenseList",
1008
- "isValidElementType"
1009
- ];
1010
- var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v) => ReactIs18[m2](v) || ReactIs19[m2](v)]));
1011
- function getChildren(arg, children = []) {
1012
- if (Array.isArray(arg)) {
1013
- for (const item of arg) {
1014
- getChildren(item, children);
1015
- }
1016
- } else if (arg != null && arg !== false && arg !== "") {
1017
- children.push(arg);
1018
- }
1019
- return children;
1020
- }
1021
- __name(getChildren, "getChildren");
1022
- function getType(element) {
1023
- const type = element.type;
1024
- if (typeof type === "string") {
1025
- return type;
1026
- }
1027
- if (typeof type === "function") {
1028
- return type.displayName || type.name || "Unknown";
1029
- }
1030
- if (ReactIs.isFragment(element)) {
1031
- return "React.Fragment";
1032
- }
1033
- if (ReactIs.isSuspense(element)) {
1034
- return "React.Suspense";
1035
- }
1036
- if (typeof type === "object" && type !== null) {
1037
- if (ReactIs.isContextProvider(element)) {
1038
- return "Context.Provider";
1039
- }
1040
- if (ReactIs.isContextConsumer(element)) {
1041
- return "Context.Consumer";
1042
- }
1043
- if (ReactIs.isForwardRef(element)) {
1044
- if (type.displayName) {
1045
- return type.displayName;
1046
- }
1047
- const functionName = type.render.displayName || type.render.name || "";
1048
- return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
1049
- }
1050
- if (ReactIs.isMemo(element)) {
1051
- const functionName = type.displayName || type.type.displayName || type.type.name || "";
1052
- return functionName === "" ? "Memo" : `Memo(${functionName})`;
1053
- }
1054
- }
1055
- return "UNDEFINED";
1056
- }
1057
- __name(getType, "getType");
1058
- function getPropKeys$1(element) {
1059
- const { props } = element;
1060
- return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
1061
- }
1062
- __name(getPropKeys$1, "getPropKeys$1");
1063
- var serialize$1 = /* @__PURE__ */ __name((element, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer2), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer2), config, indentation), "serialize$1");
1064
- var test$1 = /* @__PURE__ */ __name((val) => val != null && ReactIs.isElement(val), "test$1");
1065
- var plugin$1 = {
1066
- serialize: serialize$1,
1067
- test: test$1
1068
- };
1069
- var testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
1070
- function getPropKeys(object) {
1071
- const { props } = object;
1072
- return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
1073
- }
1074
- __name(getPropKeys, "getPropKeys");
1075
- var serialize = /* @__PURE__ */ __name((object, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer2) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer2) : "", config, indentation), "serialize");
1076
- var test = /* @__PURE__ */ __name((val) => val && val.$$typeof === testSymbol, "test");
1077
- var plugin = {
1078
- serialize,
1079
- test
1080
- };
1081
- var toString = Object.prototype.toString;
1082
- var toISOString = Date.prototype.toISOString;
1083
- var errorToString = Error.prototype.toString;
1084
- var regExpToString = RegExp.prototype.toString;
1085
- function getConstructorName(val) {
1086
- return typeof val.constructor === "function" && val.constructor.name || "Object";
1087
- }
1088
- __name(getConstructorName, "getConstructorName");
1089
- function isWindow(val) {
1090
- return typeof window !== "undefined" && val === window;
1091
- }
1092
- __name(isWindow, "isWindow");
1093
- var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
1094
- var NEWLINE_REGEXP = /\n/g;
1095
- var _PrettyFormatPluginError = class _PrettyFormatPluginError extends Error {
1096
- constructor(message, stack) {
1097
- super(message);
1098
- this.stack = stack;
1099
- this.name = this.constructor.name;
1100
- }
1101
- };
1102
- __name(_PrettyFormatPluginError, "PrettyFormatPluginError");
1103
- var PrettyFormatPluginError = _PrettyFormatPluginError;
1104
- function isToStringedArrayType(toStringed) {
1105
- return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
1106
- }
1107
- __name(isToStringedArrayType, "isToStringedArrayType");
1108
- function printNumber(val) {
1109
- return Object.is(val, -0) ? "-0" : String(val);
1110
- }
1111
- __name(printNumber, "printNumber");
1112
- function printBigInt(val) {
1113
- return String(`${val}n`);
1114
- }
1115
- __name(printBigInt, "printBigInt");
1116
- function printFunction(val, printFunctionName) {
1117
- if (!printFunctionName) {
1118
- return "[Function]";
1119
- }
1120
- return `[Function ${val.name || "anonymous"}]`;
1121
- }
1122
- __name(printFunction, "printFunction");
1123
- function printSymbol(val) {
1124
- return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
1125
- }
1126
- __name(printSymbol, "printSymbol");
1127
- function printError(val) {
1128
- return `[${errorToString.call(val)}]`;
1129
- }
1130
- __name(printError, "printError");
1131
- function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
1132
- if (val === true || val === false) {
1133
- return `${val}`;
1134
- }
1135
- if (val === void 0) {
1136
- return "undefined";
1137
- }
1138
- if (val === null) {
1139
- return "null";
1140
- }
1141
- const typeOf = typeof val;
1142
- if (typeOf === "number") {
1143
- return printNumber(val);
1144
- }
1145
- if (typeOf === "bigint") {
1146
- return printBigInt(val);
1147
- }
1148
- if (typeOf === "string") {
1149
- if (escapeString) {
1150
- return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
1151
- }
1152
- return `"${val}"`;
1153
- }
1154
- if (typeOf === "function") {
1155
- return printFunction(val, printFunctionName);
1156
- }
1157
- if (typeOf === "symbol") {
1158
- return printSymbol(val);
1159
- }
1160
- const toStringed = toString.call(val);
1161
- if (toStringed === "[object WeakMap]") {
1162
- return "WeakMap {}";
1163
- }
1164
- if (toStringed === "[object WeakSet]") {
1165
- return "WeakSet {}";
1166
- }
1167
- if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
1168
- return printFunction(val, printFunctionName);
1169
- }
1170
- if (toStringed === "[object Symbol]") {
1171
- return printSymbol(val);
1172
- }
1173
- if (toStringed === "[object Date]") {
1174
- return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
1175
- }
1176
- if (toStringed === "[object Error]") {
1177
- return printError(val);
1178
- }
1179
- if (toStringed === "[object RegExp]") {
1180
- if (escapeRegex) {
1181
- return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
1182
- }
1183
- return regExpToString.call(val);
1184
- }
1185
- if (val instanceof Error) {
1186
- return printError(val);
1187
- }
1188
- return null;
1189
- }
1190
- __name(printBasicValue, "printBasicValue");
1191
- function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
1192
- if (refs.includes(val)) {
1193
- return "[Circular]";
1194
- }
1195
- refs = [...refs];
1196
- refs.push(val);
1197
- const hitMaxDepth = ++depth > config.maxDepth;
1198
- const min = config.min;
1199
- if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
1200
- return printer(val.toJSON(), config, indentation, depth, refs, true);
1201
- }
1202
- const toStringed = toString.call(val);
1203
- if (toStringed === "[object Arguments]") {
1204
- return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
1205
- }
1206
- if (isToStringedArrayType(toStringed)) {
1207
- return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
1208
- }
1209
- if (toStringed === "[object Map]") {
1210
- return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
1211
- }
1212
- if (toStringed === "[object Set]") {
1213
- return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
1214
- }
1215
- return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
1216
- }
1217
- __name(printComplexValue, "printComplexValue");
1218
- var ErrorPlugin = {
1219
- test: /* @__PURE__ */ __name((val) => val && val instanceof Error, "test"),
1220
- serialize(val, config, indentation, depth, refs, printer2) {
1221
- if (refs.includes(val)) {
1222
- return "[Circular]";
1223
- }
1224
- refs = [...refs, val];
1225
- const hitMaxDepth = ++depth > config.maxDepth;
1226
- const { message, cause, ...rest } = val;
1227
- const entries = {
1228
- message,
1229
- ...typeof cause !== "undefined" ? { cause } : {},
1230
- ...val instanceof AggregateError ? { errors: val.errors } : {},
1231
- ...rest
1232
- };
1233
- const name = val.name !== "Error" ? val.name : getConstructorName(val);
1234
- return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer2)}}`;
1235
- }
1236
- };
1237
- function isNewPlugin(plugin2) {
1238
- return plugin2.serialize != null;
1239
- }
1240
- __name(isNewPlugin, "isNewPlugin");
1241
- function printPlugin(plugin2, val, config, indentation, depth, refs) {
1242
- let printed;
1243
- try {
1244
- printed = isNewPlugin(plugin2) ? plugin2.serialize(val, config, indentation, depth, refs, printer) : plugin2.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
1245
- const indentationNext = indentation + config.indent;
1246
- return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
1247
- ${indentationNext}`);
1248
- }, {
1249
- edgeSpacing: config.spacingOuter,
1250
- min: config.min,
1251
- spacing: config.spacingInner
1252
- }, config.colors);
1253
- } catch (error) {
1254
- throw new PrettyFormatPluginError(error.message, error.stack);
1255
- }
1256
- if (typeof printed !== "string") {
1257
- throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
1258
- }
1259
- return printed;
1260
- }
1261
- __name(printPlugin, "printPlugin");
1262
- function findPlugin(plugins2, val) {
1263
- for (const plugin2 of plugins2) {
1264
- try {
1265
- if (plugin2.test(val)) {
1266
- return plugin2;
1267
- }
1268
- } catch (error) {
1269
- throw new PrettyFormatPluginError(error.message, error.stack);
1270
- }
1271
- }
1272
- return null;
1273
- }
1274
- __name(findPlugin, "findPlugin");
1275
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
1276
- const plugin2 = findPlugin(config.plugins, val);
1277
- if (plugin2 !== null) {
1278
- return printPlugin(plugin2, val, config, indentation, depth, refs);
1279
- }
1280
- const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
1281
- if (basicResult !== null) {
1282
- return basicResult;
1283
- }
1284
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
1285
- }
1286
- __name(printer, "printer");
1287
- var DEFAULT_THEME = {
1288
- comment: "gray",
1289
- content: "reset",
1290
- prop: "yellow",
1291
- tag: "cyan",
1292
- value: "green"
1293
- };
1294
- var DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
1295
- var DEFAULT_OPTIONS = {
1296
- callToJSON: true,
1297
- compareKeys: void 0,
1298
- escapeRegex: false,
1299
- escapeString: true,
1300
- highlight: false,
1301
- indent: 2,
1302
- maxDepth: Number.POSITIVE_INFINITY,
1303
- maxWidth: Number.POSITIVE_INFINITY,
1304
- min: false,
1305
- plugins: [],
1306
- printBasicPrototype: true,
1307
- printFunctionName: true,
1308
- theme: DEFAULT_THEME
1309
- };
1310
- function validateOptions(options) {
1311
- for (const key of Object.keys(options)) {
1312
- if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) {
1313
- throw new Error(`pretty-format: Unknown option "${key}".`);
1314
- }
1315
- }
1316
- if (options.min && options.indent !== void 0 && options.indent !== 0) {
1317
- throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
1318
- }
1319
- }
1320
- __name(validateOptions, "validateOptions");
1321
- function getColorsHighlight() {
1322
- return DEFAULT_THEME_KEYS.reduce((colors, key) => {
1323
- const value = DEFAULT_THEME[key];
1324
- const color = value && s[value];
1325
- if (color && typeof color.close === "string" && typeof color.open === "string") {
1326
- colors[key] = color;
1327
- } else {
1328
- throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
1329
- }
1330
- return colors;
1331
- }, /* @__PURE__ */ Object.create(null));
1332
- }
1333
- __name(getColorsHighlight, "getColorsHighlight");
1334
- function getColorsEmpty() {
1335
- return DEFAULT_THEME_KEYS.reduce((colors, key) => {
1336
- colors[key] = {
1337
- close: "",
1338
- open: ""
1339
- };
1340
- return colors;
1341
- }, /* @__PURE__ */ Object.create(null));
1342
- }
1343
- __name(getColorsEmpty, "getColorsEmpty");
1344
- function getPrintFunctionName(options) {
1345
- return (options === null || options === void 0 ? void 0 : options.printFunctionName) ?? DEFAULT_OPTIONS.printFunctionName;
1346
- }
1347
- __name(getPrintFunctionName, "getPrintFunctionName");
1348
- function getEscapeRegex(options) {
1349
- return (options === null || options === void 0 ? void 0 : options.escapeRegex) ?? DEFAULT_OPTIONS.escapeRegex;
1350
- }
1351
- __name(getEscapeRegex, "getEscapeRegex");
1352
- function getEscapeString(options) {
1353
- return (options === null || options === void 0 ? void 0 : options.escapeString) ?? DEFAULT_OPTIONS.escapeString;
1354
- }
1355
- __name(getEscapeString, "getEscapeString");
1356
- function getConfig(options) {
1357
- return {
1358
- callToJSON: (options === null || options === void 0 ? void 0 : options.callToJSON) ?? DEFAULT_OPTIONS.callToJSON,
1359
- colors: (options === null || options === void 0 ? void 0 : options.highlight) ? getColorsHighlight() : getColorsEmpty(),
1360
- compareKeys: typeof (options === null || options === void 0 ? void 0 : options.compareKeys) === "function" || (options === null || options === void 0 ? void 0 : options.compareKeys) === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
1361
- escapeRegex: getEscapeRegex(options),
1362
- escapeString: getEscapeString(options),
1363
- indent: (options === null || options === void 0 ? void 0 : options.min) ? "" : createIndent((options === null || options === void 0 ? void 0 : options.indent) ?? DEFAULT_OPTIONS.indent),
1364
- maxDepth: (options === null || options === void 0 ? void 0 : options.maxDepth) ?? DEFAULT_OPTIONS.maxDepth,
1365
- maxWidth: (options === null || options === void 0 ? void 0 : options.maxWidth) ?? DEFAULT_OPTIONS.maxWidth,
1366
- min: (options === null || options === void 0 ? void 0 : options.min) ?? DEFAULT_OPTIONS.min,
1367
- plugins: (options === null || options === void 0 ? void 0 : options.plugins) ?? DEFAULT_OPTIONS.plugins,
1368
- printBasicPrototype: (options === null || options === void 0 ? void 0 : options.printBasicPrototype) ?? true,
1369
- printFunctionName: getPrintFunctionName(options),
1370
- spacingInner: (options === null || options === void 0 ? void 0 : options.min) ? " " : "\n",
1371
- spacingOuter: (options === null || options === void 0 ? void 0 : options.min) ? "" : "\n"
1372
- };
1373
- }
1374
- __name(getConfig, "getConfig");
1375
- function createIndent(indent) {
1376
- return Array.from({ length: indent + 1 }).join(" ");
1377
- }
1378
- __name(createIndent, "createIndent");
1379
- function format(val, options) {
1380
- if (options) {
1381
- validateOptions(options);
1382
- if (options.plugins) {
1383
- const plugin2 = findPlugin(options.plugins, val);
1384
- if (plugin2 !== null) {
1385
- return printPlugin(plugin2, val, getConfig(options), "", 0, []);
1386
- }
1387
- }
1388
- }
1389
- const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
1390
- if (basicResult !== null) {
1391
- return basicResult;
1392
- }
1393
- return printComplexValue(val, getConfig(options), "", 0, []);
1394
- }
1395
- __name(format, "format");
1396
- var plugins = {
1397
- AsymmetricMatcher: plugin$5,
1398
- DOMCollection: plugin$4,
1399
- DOMElement: plugin$3,
1400
- Immutable: plugin$2,
1401
- ReactElement: plugin$1,
1402
- ReactTestComponent: plugin,
1403
- Error: ErrorPlugin
1404
- };
1405
-
1406
- // ../node_modules/loupe/lib/helpers.js
1407
- var ansiColors = {
1408
- bold: ["1", "22"],
1409
- dim: ["2", "22"],
1410
- italic: ["3", "23"],
1411
- underline: ["4", "24"],
1412
- // 5 & 6 are blinking
1413
- inverse: ["7", "27"],
1414
- hidden: ["8", "28"],
1415
- strike: ["9", "29"],
1416
- // 10-20 are fonts
1417
- // 21-29 are resets for 1-9
1418
- black: ["30", "39"],
1419
- red: ["31", "39"],
1420
- green: ["32", "39"],
1421
- yellow: ["33", "39"],
1422
- blue: ["34", "39"],
1423
- magenta: ["35", "39"],
1424
- cyan: ["36", "39"],
1425
- white: ["37", "39"],
1426
- brightblack: ["30;1", "39"],
1427
- brightred: ["31;1", "39"],
1428
- brightgreen: ["32;1", "39"],
1429
- brightyellow: ["33;1", "39"],
1430
- brightblue: ["34;1", "39"],
1431
- brightmagenta: ["35;1", "39"],
1432
- brightcyan: ["36;1", "39"],
1433
- brightwhite: ["37;1", "39"],
1434
- grey: ["90", "39"]
1435
- };
1436
- var styles = {
1437
- special: "cyan",
1438
- number: "yellow",
1439
- bigint: "yellow",
1440
- boolean: "yellow",
1441
- undefined: "grey",
1442
- null: "bold",
1443
- string: "green",
1444
- symbol: "green",
1445
- date: "magenta",
1446
- regexp: "red"
1447
- };
1448
- var truncator = "\u2026";
1449
- function colorise(value, styleType) {
1450
- const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
1451
- if (!color) {
1452
- return String(value);
1453
- }
1454
- return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
1455
- }
1456
- __name(colorise, "colorise");
1457
- function normaliseOptions({
1458
- showHidden = false,
1459
- depth = 2,
1460
- colors = false,
1461
- customInspect = true,
1462
- showProxy = false,
1463
- maxArrayLength = Infinity,
1464
- breakLength = Infinity,
1465
- seen = [],
1466
- // eslint-disable-next-line no-shadow
1467
- truncate: truncate2 = Infinity,
1468
- stylize = String
1469
- } = {}, inspect3) {
1470
- const options = {
1471
- showHidden: Boolean(showHidden),
1472
- depth: Number(depth),
1473
- colors: Boolean(colors),
1474
- customInspect: Boolean(customInspect),
1475
- showProxy: Boolean(showProxy),
1476
- maxArrayLength: Number(maxArrayLength),
1477
- breakLength: Number(breakLength),
1478
- truncate: Number(truncate2),
1479
- seen,
1480
- inspect: inspect3,
1481
- stylize
1482
- };
1483
- if (options.colors) {
1484
- options.stylize = colorise;
1485
- }
1486
- return options;
1487
- }
1488
- __name(normaliseOptions, "normaliseOptions");
1489
- function isHighSurrogate(char) {
1490
- return char >= "\uD800" && char <= "\uDBFF";
1491
- }
1492
- __name(isHighSurrogate, "isHighSurrogate");
1493
- function truncate(string, length, tail = truncator) {
1494
- string = String(string);
1495
- const tailLength = tail.length;
1496
- const stringLength = string.length;
1497
- if (tailLength > length && stringLength > tailLength) {
1498
- return tail;
1499
- }
1500
- if (stringLength > length && stringLength > tailLength) {
1501
- let end = length - tailLength;
1502
- if (end > 0 && isHighSurrogate(string[end - 1])) {
1503
- end = end - 1;
1504
- }
1505
- return `${string.slice(0, end)}${tail}`;
1506
- }
1507
- return string;
1508
- }
1509
- __name(truncate, "truncate");
1510
- function inspectList(list, options, inspectItem, separator = ", ") {
1511
- inspectItem = inspectItem || options.inspect;
1512
- const size = list.length;
1513
- if (size === 0)
1514
- return "";
1515
- const originalLength = options.truncate;
1516
- let output = "";
1517
- let peek = "";
1518
- let truncated = "";
1519
- for (let i = 0; i < size; i += 1) {
1520
- const last = i + 1 === list.length;
1521
- const secondToLast = i + 2 === list.length;
1522
- truncated = `${truncator}(${list.length - i})`;
1523
- const value = list[i];
1524
- options.truncate = originalLength - output.length - (last ? 0 : separator.length);
1525
- const string = peek || inspectItem(value, options) + (last ? "" : separator);
1526
- const nextLength = output.length + string.length;
1527
- const truncatedLength = nextLength + truncated.length;
1528
- if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
1529
- break;
1530
- }
1531
- if (!last && !secondToLast && truncatedLength > originalLength) {
1532
- break;
1533
- }
1534
- peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
1535
- if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
1536
- break;
1537
- }
1538
- output += string;
1539
- if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
1540
- truncated = `${truncator}(${list.length - i - 1})`;
1541
- break;
1542
- }
1543
- truncated = "";
1544
- }
1545
- return `${output}${truncated}`;
1546
- }
1547
- __name(inspectList, "inspectList");
1548
- function quoteComplexKey(key) {
1549
- if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
1550
- return key;
1551
- }
1552
- return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
1553
- }
1554
- __name(quoteComplexKey, "quoteComplexKey");
1555
- function inspectProperty([key, value], options) {
1556
- options.truncate -= 2;
1557
- if (typeof key === "string") {
1558
- key = quoteComplexKey(key);
1559
- } else if (typeof key !== "number") {
1560
- key = `[${options.inspect(key, options)}]`;
1561
- }
1562
- options.truncate -= key.length;
1563
- value = options.inspect(value, options);
1564
- return `${key}: ${value}`;
1565
- }
1566
- __name(inspectProperty, "inspectProperty");
1567
-
1568
- // ../node_modules/loupe/lib/array.js
1569
- function inspectArray(array, options) {
1570
- const nonIndexProperties = Object.keys(array).slice(array.length);
1571
- if (!array.length && !nonIndexProperties.length)
1572
- return "[]";
1573
- options.truncate -= 4;
1574
- const listContents = inspectList(array, options);
1575
- options.truncate -= listContents.length;
1576
- let propertyContents = "";
1577
- if (nonIndexProperties.length) {
1578
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1579
- }
1580
- return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1581
- }
1582
- __name(inspectArray, "inspectArray");
1583
-
1584
- // ../node_modules/loupe/lib/typedarray.js
1585
- var getArrayName = /* @__PURE__ */ __name((array) => {
1586
- if (typeof Buffer === "function" && array instanceof Buffer) {
1587
- return "Buffer";
1588
- }
1589
- if (array[Symbol.toStringTag]) {
1590
- return array[Symbol.toStringTag];
1591
- }
1592
- return array.constructor.name;
1593
- }, "getArrayName");
1594
- function inspectTypedArray(array, options) {
1595
- const name = getArrayName(array);
1596
- options.truncate -= name.length + 4;
1597
- const nonIndexProperties = Object.keys(array).slice(array.length);
1598
- if (!array.length && !nonIndexProperties.length)
1599
- return `${name}[]`;
1600
- let output = "";
1601
- for (let i = 0; i < array.length; i++) {
1602
- const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
1603
- options.truncate -= string.length;
1604
- if (array[i] !== array.length && options.truncate <= 3) {
1605
- output += `${truncator}(${array.length - array[i] + 1})`;
1606
- break;
1607
- }
1608
- output += string;
1609
- }
1610
- let propertyContents = "";
1611
- if (nonIndexProperties.length) {
1612
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1613
- }
1614
- return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1615
- }
1616
- __name(inspectTypedArray, "inspectTypedArray");
1617
-
1618
- // ../node_modules/loupe/lib/date.js
1619
- function inspectDate(dateObject, options) {
1620
- const stringRepresentation = dateObject.toJSON();
1621
- if (stringRepresentation === null) {
1622
- return "Invalid Date";
1623
- }
1624
- const split = stringRepresentation.split("T");
1625
- const date = split[0];
1626
- return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
1627
- }
1628
- __name(inspectDate, "inspectDate");
1629
-
1630
- // ../node_modules/loupe/lib/function.js
1631
- function inspectFunction(func, options) {
1632
- const functionType = func[Symbol.toStringTag] || "Function";
1633
- const name = func.name;
1634
- if (!name) {
1635
- return options.stylize(`[${functionType}]`, "special");
1636
- }
1637
- return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
1638
- }
1639
- __name(inspectFunction, "inspectFunction");
1640
-
1641
- // ../node_modules/loupe/lib/map.js
1642
- function inspectMapEntry([key, value], options) {
1643
- options.truncate -= 4;
1644
- key = options.inspect(key, options);
1645
- options.truncate -= key.length;
1646
- value = options.inspect(value, options);
1647
- return `${key} => ${value}`;
1648
- }
1649
- __name(inspectMapEntry, "inspectMapEntry");
1650
- function mapToEntries(map) {
1651
- const entries = [];
1652
- map.forEach((value, key) => {
1653
- entries.push([key, value]);
1654
- });
1655
- return entries;
1656
- }
1657
- __name(mapToEntries, "mapToEntries");
1658
- function inspectMap(map, options) {
1659
- if (map.size === 0)
1660
- return "Map{}";
1661
- options.truncate -= 7;
1662
- return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
1663
- }
1664
- __name(inspectMap, "inspectMap");
1665
-
1666
- // ../node_modules/loupe/lib/number.js
1667
- var isNaN = Number.isNaN || ((i) => i !== i);
1668
- function inspectNumber(number, options) {
1669
- if (isNaN(number)) {
1670
- return options.stylize("NaN", "number");
1671
- }
1672
- if (number === Infinity) {
1673
- return options.stylize("Infinity", "number");
1674
- }
1675
- if (number === -Infinity) {
1676
- return options.stylize("-Infinity", "number");
1677
- }
1678
- if (number === 0) {
1679
- return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
1680
- }
1681
- return options.stylize(truncate(String(number), options.truncate), "number");
1682
- }
1683
- __name(inspectNumber, "inspectNumber");
1684
-
1685
- // ../node_modules/loupe/lib/bigint.js
1686
- function inspectBigInt(number, options) {
1687
- let nums = truncate(number.toString(), options.truncate - 1);
1688
- if (nums !== truncator)
1689
- nums += "n";
1690
- return options.stylize(nums, "bigint");
1691
- }
1692
- __name(inspectBigInt, "inspectBigInt");
1693
-
1694
- // ../node_modules/loupe/lib/regexp.js
1695
- function inspectRegExp(value, options) {
1696
- const flags = value.toString().split("/")[2];
1697
- const sourceLength = options.truncate - (2 + flags.length);
1698
- const source = value.source;
1699
- return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
1700
- }
1701
- __name(inspectRegExp, "inspectRegExp");
1702
-
1703
- // ../node_modules/loupe/lib/set.js
1704
- function arrayFromSet(set) {
1705
- const values = [];
1706
- set.forEach((value) => {
1707
- values.push(value);
1708
- });
1709
- return values;
1710
- }
1711
- __name(arrayFromSet, "arrayFromSet");
1712
- function inspectSet(set, options) {
1713
- if (set.size === 0)
1714
- return "Set{}";
1715
- options.truncate -= 7;
1716
- return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
1717
- }
1718
- __name(inspectSet, "inspectSet");
1719
-
1720
- // ../node_modules/loupe/lib/string.js
1721
- var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
1722
- var escapeCharacters = {
1723
- "\b": "\\b",
1724
- " ": "\\t",
1725
- "\n": "\\n",
1726
- "\f": "\\f",
1727
- "\r": "\\r",
1728
- "'": "\\'",
1729
- "\\": "\\\\"
1730
- };
1731
- var hex = 16;
1732
- var unicodeLength = 4;
1733
- function escape(char) {
1734
- return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
1735
- }
1736
- __name(escape, "escape");
1737
- function inspectString(string, options) {
1738
- if (stringEscapeChars.test(string)) {
1739
- string = string.replace(stringEscapeChars, escape);
1740
- }
1741
- return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
1742
- }
1743
- __name(inspectString, "inspectString");
1744
-
1745
- // ../node_modules/loupe/lib/symbol.js
1746
- function inspectSymbol(value) {
1747
- if ("description" in Symbol.prototype) {
1748
- return value.description ? `Symbol(${value.description})` : "Symbol()";
1749
- }
1750
- return value.toString();
1751
- }
1752
- __name(inspectSymbol, "inspectSymbol");
1753
-
1754
- // ../node_modules/loupe/lib/promise.js
1755
- var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue");
1756
- var promise_default = getPromiseValue;
1757
-
1758
- // ../node_modules/loupe/lib/object.js
1759
- function inspectObject(object, options) {
1760
- const properties = Object.getOwnPropertyNames(object);
1761
- const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
1762
- if (properties.length === 0 && symbols.length === 0) {
1763
- return "{}";
1764
- }
1765
- options.truncate -= 4;
1766
- options.seen = options.seen || [];
1767
- if (options.seen.includes(object)) {
1768
- return "[Circular]";
1769
- }
1770
- options.seen.push(object);
1771
- const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
1772
- const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
1773
- options.seen.pop();
1774
- let sep = "";
1775
- if (propertyContents && symbolContents) {
1776
- sep = ", ";
1777
- }
1778
- return `{ ${propertyContents}${sep}${symbolContents} }`;
1779
- }
1780
- __name(inspectObject, "inspectObject");
1781
-
1782
- // ../node_modules/loupe/lib/class.js
1783
- var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
1784
- function inspectClass(value, options) {
1785
- let name = "";
1786
- if (toStringTag && toStringTag in value) {
1787
- name = value[toStringTag];
1788
- }
1789
- name = name || value.constructor.name;
1790
- if (!name || name === "_class") {
1791
- name = "<Anonymous Class>";
1792
- }
1793
- options.truncate -= name.length;
1794
- return `${name}${inspectObject(value, options)}`;
1795
- }
1796
- __name(inspectClass, "inspectClass");
1797
-
1798
- // ../node_modules/loupe/lib/arguments.js
1799
- function inspectArguments(args, options) {
1800
- if (args.length === 0)
1801
- return "Arguments[]";
1802
- options.truncate -= 13;
1803
- return `Arguments[ ${inspectList(args, options)} ]`;
1804
- }
1805
- __name(inspectArguments, "inspectArguments");
1806
-
1807
- // ../node_modules/loupe/lib/error.js
1808
- var errorKeys = [
1809
- "stack",
1810
- "line",
1811
- "column",
1812
- "name",
1813
- "message",
1814
- "fileName",
1815
- "lineNumber",
1816
- "columnNumber",
1817
- "number",
1818
- "description",
1819
- "cause"
1820
- ];
1821
- function inspectObject2(error, options) {
1822
- const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
1823
- const name = error.name;
1824
- options.truncate -= name.length;
1825
- let message = "";
1826
- if (typeof error.message === "string") {
1827
- message = truncate(error.message, options.truncate);
1828
- } else {
1829
- properties.unshift("message");
1830
- }
1831
- message = message ? `: ${message}` : "";
1832
- options.truncate -= message.length + 5;
1833
- options.seen = options.seen || [];
1834
- if (options.seen.includes(error)) {
1835
- return "[Circular]";
1836
- }
1837
- options.seen.push(error);
1838
- const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
1839
- return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
1840
- }
1841
- __name(inspectObject2, "inspectObject");
1842
-
1843
- // ../node_modules/loupe/lib/html.js
1844
- function inspectAttribute([key, value], options) {
1845
- options.truncate -= 3;
1846
- if (!value) {
1847
- return `${options.stylize(String(key), "yellow")}`;
1848
- }
1849
- return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
1850
- }
1851
- __name(inspectAttribute, "inspectAttribute");
1852
- function inspectNodeCollection(collection, options) {
1853
- return inspectList(collection, options, inspectNode, "\n");
1854
- }
1855
- __name(inspectNodeCollection, "inspectNodeCollection");
1856
- function inspectNode(node, options) {
1857
- switch (node.nodeType) {
1858
- case 1:
1859
- return inspectHTML(node, options);
1860
- case 3:
1861
- return options.inspect(node.data, options);
1862
- default:
1863
- return options.inspect(node, options);
1864
- }
1865
- }
1866
- __name(inspectNode, "inspectNode");
1867
- function inspectHTML(element, options) {
1868
- const properties = element.getAttributeNames();
1869
- const name = element.tagName.toLowerCase();
1870
- const head = options.stylize(`<${name}`, "special");
1871
- const headClose = options.stylize(`>`, "special");
1872
- const tail = options.stylize(`</${name}>`, "special");
1873
- options.truncate -= name.length * 2 + 5;
1874
- let propertyContents = "";
1875
- if (properties.length > 0) {
1876
- propertyContents += " ";
1877
- propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
1878
- }
1879
- options.truncate -= propertyContents.length;
1880
- const truncate2 = options.truncate;
1881
- let children = inspectNodeCollection(element.children, options);
1882
- if (children && children.length > truncate2) {
1883
- children = `${truncator}(${element.children.length})`;
1884
- }
1885
- return `${head}${propertyContents}${headClose}${children}${tail}`;
1886
- }
1887
- __name(inspectHTML, "inspectHTML");
1888
-
1889
- // ../node_modules/loupe/lib/index.js
1890
- var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
1891
- var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
1892
- var nodeInspect = Symbol.for("nodejs.util.inspect.custom");
1893
- var constructorMap = /* @__PURE__ */ new WeakMap();
1894
- var stringTagMap = {};
1895
- var baseTypesMap = {
1896
- undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
1897
- null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
1898
- boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
1899
- Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
1900
- number: inspectNumber,
1901
- Number: inspectNumber,
1902
- bigint: inspectBigInt,
1903
- BigInt: inspectBigInt,
1904
- string: inspectString,
1905
- String: inspectString,
1906
- function: inspectFunction,
1907
- Function: inspectFunction,
1908
- symbol: inspectSymbol,
1909
- // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
1910
- Symbol: inspectSymbol,
1911
- Array: inspectArray,
1912
- Date: inspectDate,
1913
- Map: inspectMap,
1914
- Set: inspectSet,
1915
- RegExp: inspectRegExp,
1916
- Promise: promise_default,
1917
- // WeakSet, WeakMap are totally opaque to us
1918
- WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{\u2026}", "special"), "WeakSet"),
1919
- WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{\u2026}", "special"), "WeakMap"),
1920
- Arguments: inspectArguments,
1921
- Int8Array: inspectTypedArray,
1922
- Uint8Array: inspectTypedArray,
1923
- Uint8ClampedArray: inspectTypedArray,
1924
- Int16Array: inspectTypedArray,
1925
- Uint16Array: inspectTypedArray,
1926
- Int32Array: inspectTypedArray,
1927
- Uint32Array: inspectTypedArray,
1928
- Float32Array: inspectTypedArray,
1929
- Float64Array: inspectTypedArray,
1930
- Generator: /* @__PURE__ */ __name(() => "", "Generator"),
1931
- DataView: /* @__PURE__ */ __name(() => "", "DataView"),
1932
- ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
1933
- Error: inspectObject2,
1934
- HTMLCollection: inspectNodeCollection,
1935
- NodeList: inspectNodeCollection
1936
- };
1937
- var inspectCustom = /* @__PURE__ */ __name((value, options, type, inspectFn) => {
1938
- if (chaiInspect in value && typeof value[chaiInspect] === "function") {
1939
- return value[chaiInspect](options);
1940
- }
1941
- if (nodeInspect in value && typeof value[nodeInspect] === "function") {
1942
- return value[nodeInspect](options.depth, options, inspectFn);
1943
- }
1944
- if ("inspect" in value && typeof value.inspect === "function") {
1945
- return value.inspect(options.depth, options);
1946
- }
1947
- if ("constructor" in value && constructorMap.has(value.constructor)) {
1948
- return constructorMap.get(value.constructor)(value, options);
1949
- }
1950
- if (stringTagMap[type]) {
1951
- return stringTagMap[type](value, options);
1952
- }
1953
- return "";
1954
- }, "inspectCustom");
1955
- var toString2 = Object.prototype.toString;
1956
- function inspect(value, opts = {}) {
1957
- const options = normaliseOptions(opts, inspect);
1958
- const { customInspect } = options;
1959
- let type = value === null ? "null" : typeof value;
1960
- if (type === "object") {
1961
- type = toString2.call(value).slice(8, -1);
1962
- }
1963
- if (type in baseTypesMap) {
1964
- return baseTypesMap[type](value, options);
1965
- }
1966
- if (customInspect && value) {
1967
- const output = inspectCustom(value, options, type, inspect);
1968
- if (output) {
1969
- if (typeof output === "string")
1970
- return output;
1971
- return inspect(output, options);
1972
- }
1973
- }
1974
- const proto = value ? Object.getPrototypeOf(value) : false;
1975
- if (proto === Object.prototype || proto === null) {
1976
- return inspectObject(value, options);
1977
- }
1978
- if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
1979
- return inspectHTML(value, options);
1980
- }
1981
- if ("constructor" in value) {
1982
- if (value.constructor !== Object) {
1983
- return inspectClass(value, options);
1984
- }
1985
- return inspectObject(value, options);
1986
- }
1987
- if (value === Object(value)) {
1988
- return inspectObject(value, options);
1989
- }
1990
- return options.stylize(String(value), type);
1991
- }
1992
- __name(inspect, "inspect");
1993
-
1994
- // ../node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
1995
- var { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
1996
- var PLUGINS = [
1997
- ReactTestComponent,
1998
- ReactElement,
1999
- DOMElement,
2000
- DOMCollection,
2001
- Immutable,
2002
- AsymmetricMatcher
2003
- ];
2004
- function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
2005
- const MAX_LENGTH = maxLength ?? 1e4;
2006
- let result;
2007
- try {
2008
- result = format(object, {
2009
- maxDepth,
2010
- escapeString: false,
2011
- plugins: PLUGINS,
2012
- ...options
2013
- });
2014
- } catch {
2015
- result = format(object, {
2016
- callToJSON: false,
2017
- maxDepth,
2018
- escapeString: false,
2019
- plugins: PLUGINS,
2020
- ...options
2021
- });
2022
- }
2023
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
2024
- maxLength,
2025
- ...options
2026
- }) : result;
2027
- }
2028
- __name(stringify, "stringify");
2029
- var formatRegExp = /%[sdjifoOc%]/g;
2030
- function format2(...args) {
2031
- if (typeof args[0] !== "string") {
2032
- const objects = [];
2033
- for (let i2 = 0; i2 < args.length; i2++) {
2034
- objects.push(inspect2(args[i2], {
2035
- depth: 0,
2036
- colors: false
2037
- }));
2038
- }
2039
- return objects.join(" ");
2040
- }
2041
- const len = args.length;
2042
- let i = 1;
2043
- const template = args[0];
2044
- let str = String(template).replace(formatRegExp, (x) => {
2045
- if (x === "%%") {
2046
- return "%";
2047
- }
2048
- if (i >= len) {
2049
- return x;
2050
- }
2051
- switch (x) {
2052
- case "%s": {
2053
- const value = args[i++];
2054
- if (typeof value === "bigint") {
2055
- return `${value.toString()}n`;
2056
- }
2057
- if (typeof value === "number" && value === 0 && 1 / value < 0) {
2058
- return "-0";
2059
- }
2060
- if (typeof value === "object" && value !== null) {
2061
- if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
2062
- return value.toString();
2063
- }
2064
- return inspect2(value, {
2065
- depth: 0,
2066
- colors: false
2067
- });
2068
- }
2069
- return String(value);
2070
- }
2071
- case "%d": {
2072
- const value = args[i++];
2073
- if (typeof value === "bigint") {
2074
- return `${value.toString()}n`;
2075
- }
2076
- return Number(value).toString();
2077
- }
2078
- case "%i": {
2079
- const value = args[i++];
2080
- if (typeof value === "bigint") {
2081
- return `${value.toString()}n`;
2082
- }
2083
- return Number.parseInt(String(value)).toString();
2084
- }
2085
- case "%f":
2086
- return Number.parseFloat(String(args[i++])).toString();
2087
- case "%o":
2088
- return inspect2(args[i++], {
2089
- showHidden: true,
2090
- showProxy: true
2091
- });
2092
- case "%O":
2093
- return inspect2(args[i++]);
2094
- case "%c": {
2095
- i++;
2096
- return "";
2097
- }
2098
- case "%j":
2099
- try {
2100
- return JSON.stringify(args[i++]);
2101
- } catch (err) {
2102
- const m2 = err.message;
2103
- if (m2.includes("circular structure") || m2.includes("cyclic structures") || m2.includes("cyclic object")) {
2104
- return "[Circular]";
2105
- }
2106
- throw err;
2107
- }
2108
- default:
2109
- return x;
2110
- }
2111
- });
2112
- for (let x = args[i]; i < len; x = args[++i]) {
2113
- if (x === null || typeof x !== "object") {
2114
- str += ` ${x}`;
2115
- } else {
2116
- str += ` ${inspect2(x)}`;
2117
- }
2118
- }
2119
- return str;
2120
- }
2121
- __name(format2, "format");
2122
- function inspect2(obj, options = {}) {
2123
- if (options.truncate === 0) {
2124
- options.truncate = Number.POSITIVE_INFINITY;
2125
- }
2126
- return inspect(obj, options);
2127
- }
2128
- __name(inspect2, "inspect");
2129
- function getDefaultExportFromCjs2(x) {
2130
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
2131
- }
2132
- __name(getDefaultExportFromCjs2, "getDefaultExportFromCjs");
2133
-
2134
- // ../node_modules/@vitest/utils/dist/helpers.js
2135
- function assertTypes(value, name, types) {
2136
- const receivedType = typeof value;
2137
- const pass = types.includes(receivedType);
2138
- if (!pass) {
2139
- throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
2140
- }
2141
- }
2142
- __name(assertTypes, "assertTypes");
2143
- function isObject(item) {
2144
- return item != null && typeof item === "object" && !Array.isArray(item);
2145
- }
2146
- __name(isObject, "isObject");
2147
- function isFinalObj(obj) {
2148
- return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
2149
- }
2150
- __name(isFinalObj, "isFinalObj");
2151
- function getType2(value) {
2152
- return Object.prototype.toString.apply(value).slice(8, -1);
2153
- }
2154
- __name(getType2, "getType");
2155
- function collectOwnProperties(obj, collector) {
2156
- const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
2157
- Object.getOwnPropertyNames(obj).forEach(collect);
2158
- Object.getOwnPropertySymbols(obj).forEach(collect);
2159
- }
2160
- __name(collectOwnProperties, "collectOwnProperties");
2161
- function getOwnProperties(obj) {
2162
- const ownProps = /* @__PURE__ */ new Set();
2163
- if (isFinalObj(obj)) {
2164
- return [];
2165
- }
2166
- collectOwnProperties(obj, ownProps);
2167
- return Array.from(ownProps);
2168
- }
2169
- __name(getOwnProperties, "getOwnProperties");
2170
- var defaultCloneOptions = { forceWritable: false };
2171
- function deepClone(val, options = defaultCloneOptions) {
2172
- const seen = /* @__PURE__ */ new WeakMap();
2173
- return clone(val, seen, options);
2174
- }
2175
- __name(deepClone, "deepClone");
2176
- function clone(val, seen, options = defaultCloneOptions) {
2177
- let k, out;
2178
- if (seen.has(val)) {
2179
- return seen.get(val);
2180
- }
2181
- if (Array.isArray(val)) {
2182
- out = Array.from({ length: k = val.length });
2183
- seen.set(val, out);
2184
- while (k--) {
2185
- out[k] = clone(val[k], seen, options);
2186
- }
2187
- return out;
2188
- }
2189
- if (Object.prototype.toString.call(val) === "[object Object]") {
2190
- out = Object.create(Object.getPrototypeOf(val));
2191
- seen.set(val, out);
2192
- const props = getOwnProperties(val);
2193
- for (const k2 of props) {
2194
- const descriptor = Object.getOwnPropertyDescriptor(val, k2);
2195
- if (!descriptor) {
2196
- continue;
2197
- }
2198
- const cloned = clone(val[k2], seen, options);
2199
- if (options.forceWritable) {
2200
- Object.defineProperty(out, k2, {
2201
- enumerable: descriptor.enumerable,
2202
- configurable: true,
2203
- writable: true,
2204
- value: cloned
2205
- });
2206
- } else if ("get" in descriptor) {
2207
- Object.defineProperty(out, k2, {
2208
- ...descriptor,
2209
- get() {
2210
- return cloned;
2211
- }
2212
- });
2213
- } else {
2214
- Object.defineProperty(out, k2, {
2215
- ...descriptor,
2216
- value: cloned
2217
- });
2218
- }
2219
- }
2220
- return out;
2221
- }
2222
- return val;
2223
- }
2224
- __name(clone, "clone");
2225
- function noop() {
2226
- }
2227
- __name(noop, "noop");
2228
-
2229
- // ../node_modules/@vitest/utils/dist/diff.js
2230
- var DIFF_DELETE = -1;
2231
- var DIFF_INSERT = 1;
2232
- var DIFF_EQUAL = 0;
2233
- var _Diff = class _Diff {
2234
- 0;
2235
- 1;
2236
- constructor(op, text) {
2237
- this[0] = op;
2238
- this[1] = text;
2239
- }
2240
- };
2241
- __name(_Diff, "Diff");
2242
- var Diff = _Diff;
2243
- function diff_commonPrefix(text1, text2) {
2244
- if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
2245
- return 0;
2246
- }
2247
- let pointermin = 0;
2248
- let pointermax = Math.min(text1.length, text2.length);
2249
- let pointermid = pointermax;
2250
- let pointerstart = 0;
2251
- while (pointermin < pointermid) {
2252
- if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) {
2253
- pointermin = pointermid;
2254
- pointerstart = pointermin;
2255
- } else {
2256
- pointermax = pointermid;
2257
- }
2258
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
2259
- }
2260
- return pointermid;
2261
- }
2262
- __name(diff_commonPrefix, "diff_commonPrefix");
2263
- function diff_commonSuffix(text1, text2) {
2264
- if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) {
2265
- return 0;
2266
- }
2267
- let pointermin = 0;
2268
- let pointermax = Math.min(text1.length, text2.length);
2269
- let pointermid = pointermax;
2270
- let pointerend = 0;
2271
- while (pointermin < pointermid) {
2272
- if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) {
2273
- pointermin = pointermid;
2274
- pointerend = pointermin;
2275
- } else {
2276
- pointermax = pointermid;
2277
- }
2278
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
2279
- }
2280
- return pointermid;
2281
- }
2282
- __name(diff_commonSuffix, "diff_commonSuffix");
2283
- function diff_commonOverlap_(text1, text2) {
2284
- const text1_length = text1.length;
2285
- const text2_length = text2.length;
2286
- if (text1_length === 0 || text2_length === 0) {
2287
- return 0;
2288
- }
2289
- if (text1_length > text2_length) {
2290
- text1 = text1.substring(text1_length - text2_length);
2291
- } else if (text1_length < text2_length) {
2292
- text2 = text2.substring(0, text1_length);
2293
- }
2294
- const text_length = Math.min(text1_length, text2_length);
2295
- if (text1 === text2) {
2296
- return text_length;
2297
- }
2298
- let best = 0;
2299
- let length = 1;
2300
- while (true) {
2301
- const pattern = text1.substring(text_length - length);
2302
- const found = text2.indexOf(pattern);
2303
- if (found === -1) {
2304
- return best;
2305
- }
2306
- length += found;
2307
- if (found === 0 || text1.substring(text_length - length) === text2.substring(0, length)) {
2308
- best = length;
2309
- length++;
2310
- }
2311
- }
2312
- }
2313
- __name(diff_commonOverlap_, "diff_commonOverlap_");
2314
- function diff_cleanupSemantic(diffs) {
2315
- let changes = false;
2316
- const equalities = [];
2317
- let equalitiesLength = 0;
2318
- let lastEquality = null;
2319
- let pointer = 0;
2320
- let length_insertions1 = 0;
2321
- let length_deletions1 = 0;
2322
- let length_insertions2 = 0;
2323
- let length_deletions2 = 0;
2324
- while (pointer < diffs.length) {
2325
- if (diffs[pointer][0] === DIFF_EQUAL) {
2326
- equalities[equalitiesLength++] = pointer;
2327
- length_insertions1 = length_insertions2;
2328
- length_deletions1 = length_deletions2;
2329
- length_insertions2 = 0;
2330
- length_deletions2 = 0;
2331
- lastEquality = diffs[pointer][1];
2332
- } else {
2333
- if (diffs[pointer][0] === DIFF_INSERT) {
2334
- length_insertions2 += diffs[pointer][1].length;
2335
- } else {
2336
- length_deletions2 += diffs[pointer][1].length;
2337
- }
2338
- if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) {
2339
- diffs.splice(equalities[equalitiesLength - 1], 0, new Diff(DIFF_DELETE, lastEquality));
2340
- diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
2341
- equalitiesLength--;
2342
- equalitiesLength--;
2343
- pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
2344
- length_insertions1 = 0;
2345
- length_deletions1 = 0;
2346
- length_insertions2 = 0;
2347
- length_deletions2 = 0;
2348
- lastEquality = null;
2349
- changes = true;
2350
- }
2351
- }
2352
- pointer++;
2353
- }
2354
- if (changes) {
2355
- diff_cleanupMerge(diffs);
2356
- }
2357
- diff_cleanupSemanticLossless(diffs);
2358
- pointer = 1;
2359
- while (pointer < diffs.length) {
2360
- if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) {
2361
- const deletion = diffs[pointer - 1][1];
2362
- const insertion = diffs[pointer][1];
2363
- const overlap_length1 = diff_commonOverlap_(deletion, insertion);
2364
- const overlap_length2 = diff_commonOverlap_(insertion, deletion);
2365
- if (overlap_length1 >= overlap_length2) {
2366
- if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
2367
- diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1)));
2368
- diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
2369
- diffs[pointer + 1][1] = insertion.substring(overlap_length1);
2370
- pointer++;
2371
- }
2372
- } else {
2373
- if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
2374
- diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2)));
2375
- diffs[pointer - 1][0] = DIFF_INSERT;
2376
- diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
2377
- diffs[pointer + 1][0] = DIFF_DELETE;
2378
- diffs[pointer + 1][1] = deletion.substring(overlap_length2);
2379
- pointer++;
2380
- }
2381
- }
2382
- pointer++;
2383
- }
2384
- pointer++;
2385
- }
2386
- }
2387
- __name(diff_cleanupSemantic, "diff_cleanupSemantic");
2388
- var nonAlphaNumericRegex_ = /[^a-z0-9]/i;
2389
- var whitespaceRegex_ = /\s/;
2390
- var linebreakRegex_ = /[\r\n]/;
2391
- var blanklineEndRegex_ = /\n\r?\n$/;
2392
- var blanklineStartRegex_ = /^\r?\n\r?\n/;
2393
- function diff_cleanupSemanticLossless(diffs) {
2394
- let pointer = 1;
2395
- while (pointer < diffs.length - 1) {
2396
- if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
2397
- let equality1 = diffs[pointer - 1][1];
2398
- let edit = diffs[pointer][1];
2399
- let equality2 = diffs[pointer + 1][1];
2400
- const commonOffset = diff_commonSuffix(equality1, edit);
2401
- if (commonOffset) {
2402
- const commonString = edit.substring(edit.length - commonOffset);
2403
- equality1 = equality1.substring(0, equality1.length - commonOffset);
2404
- edit = commonString + edit.substring(0, edit.length - commonOffset);
2405
- equality2 = commonString + equality2;
2406
- }
2407
- let bestEquality1 = equality1;
2408
- let bestEdit = edit;
2409
- let bestEquality2 = equality2;
2410
- let bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
2411
- while (edit.charAt(0) === equality2.charAt(0)) {
2412
- equality1 += edit.charAt(0);
2413
- edit = edit.substring(1) + equality2.charAt(0);
2414
- equality2 = equality2.substring(1);
2415
- const score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
2416
- if (score >= bestScore) {
2417
- bestScore = score;
2418
- bestEquality1 = equality1;
2419
- bestEdit = edit;
2420
- bestEquality2 = equality2;
2421
- }
2422
- }
2423
- if (diffs[pointer - 1][1] !== bestEquality1) {
2424
- if (bestEquality1) {
2425
- diffs[pointer - 1][1] = bestEquality1;
2426
- } else {
2427
- diffs.splice(pointer - 1, 1);
2428
- pointer--;
2429
- }
2430
- diffs[pointer][1] = bestEdit;
2431
- if (bestEquality2) {
2432
- diffs[pointer + 1][1] = bestEquality2;
2433
- } else {
2434
- diffs.splice(pointer + 1, 1);
2435
- pointer--;
2436
- }
2437
- }
2438
- }
2439
- pointer++;
2440
- }
2441
- }
2442
- __name(diff_cleanupSemanticLossless, "diff_cleanupSemanticLossless");
2443
- function diff_cleanupMerge(diffs) {
2444
- diffs.push(new Diff(DIFF_EQUAL, ""));
2445
- let pointer = 0;
2446
- let count_delete = 0;
2447
- let count_insert = 0;
2448
- let text_delete = "";
2449
- let text_insert = "";
2450
- let commonlength;
2451
- while (pointer < diffs.length) {
2452
- switch (diffs[pointer][0]) {
2453
- case DIFF_INSERT:
2454
- count_insert++;
2455
- text_insert += diffs[pointer][1];
2456
- pointer++;
2457
- break;
2458
- case DIFF_DELETE:
2459
- count_delete++;
2460
- text_delete += diffs[pointer][1];
2461
- pointer++;
2462
- break;
2463
- case DIFF_EQUAL:
2464
- if (count_delete + count_insert > 1) {
2465
- if (count_delete !== 0 && count_insert !== 0) {
2466
- commonlength = diff_commonPrefix(text_insert, text_delete);
2467
- if (commonlength !== 0) {
2468
- if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] === DIFF_EQUAL) {
2469
- diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
2470
- } else {
2471
- diffs.splice(0, 0, new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength)));
2472
- pointer++;
2473
- }
2474
- text_insert = text_insert.substring(commonlength);
2475
- text_delete = text_delete.substring(commonlength);
2476
- }
2477
- commonlength = diff_commonSuffix(text_insert, text_delete);
2478
- if (commonlength !== 0) {
2479
- diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
2480
- text_insert = text_insert.substring(0, text_insert.length - commonlength);
2481
- text_delete = text_delete.substring(0, text_delete.length - commonlength);
2482
- }
2483
- }
2484
- pointer -= count_delete + count_insert;
2485
- diffs.splice(pointer, count_delete + count_insert);
2486
- if (text_delete.length) {
2487
- diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete));
2488
- pointer++;
2489
- }
2490
- if (text_insert.length) {
2491
- diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert));
2492
- pointer++;
2493
- }
2494
- pointer++;
2495
- } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
2496
- diffs[pointer - 1][1] += diffs[pointer][1];
2497
- diffs.splice(pointer, 1);
2498
- } else {
2499
- pointer++;
2500
- }
2501
- count_insert = 0;
2502
- count_delete = 0;
2503
- text_delete = "";
2504
- text_insert = "";
2505
- break;
2506
- }
2507
- }
2508
- if (diffs[diffs.length - 1][1] === "") {
2509
- diffs.pop();
2510
- }
2511
- let changes = false;
2512
- pointer = 1;
2513
- while (pointer < diffs.length - 1) {
2514
- if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
2515
- if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
2516
- diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
2517
- diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
2518
- diffs.splice(pointer - 1, 1);
2519
- changes = true;
2520
- } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) {
2521
- diffs[pointer - 1][1] += diffs[pointer + 1][1];
2522
- diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
2523
- diffs.splice(pointer + 1, 1);
2524
- changes = true;
2525
- }
2526
- }
2527
- pointer++;
2528
- }
2529
- if (changes) {
2530
- diff_cleanupMerge(diffs);
2531
- }
2532
- }
2533
- __name(diff_cleanupMerge, "diff_cleanupMerge");
2534
- function diff_cleanupSemanticScore_(one, two) {
2535
- if (!one || !two) {
2536
- return 6;
2537
- }
2538
- const char1 = one.charAt(one.length - 1);
2539
- const char2 = two.charAt(0);
2540
- const nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
2541
- const nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
2542
- const whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
2543
- const whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
2544
- const lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
2545
- const lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
2546
- const blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
2547
- const blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
2548
- if (blankLine1 || blankLine2) {
2549
- return 5;
2550
- } else if (lineBreak1 || lineBreak2) {
2551
- return 4;
2552
- } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
2553
- return 3;
2554
- } else if (whitespace1 || whitespace2) {
2555
- return 2;
2556
- } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
2557
- return 1;
2558
- }
2559
- return 0;
2560
- }
2561
- __name(diff_cleanupSemanticScore_, "diff_cleanupSemanticScore_");
2562
- var NO_DIFF_MESSAGE = "Compared values have no visual difference.";
2563
- var SIMILAR_MESSAGE = "Compared values serialize to the same structure.\nPrinting internal object structure without calling `toJSON` instead.";
2564
- var build = {};
2565
- var hasRequiredBuild;
2566
- function requireBuild() {
2567
- if (hasRequiredBuild) return build;
2568
- hasRequiredBuild = 1;
2569
- Object.defineProperty(build, "__esModule", {
2570
- value: true
2571
- });
2572
- build.default = diffSequence;
2573
- const pkg = "diff-sequences";
2574
- const NOT_YET_SET = 0;
2575
- const countCommonItemsF = /* @__PURE__ */ __name((aIndex, aEnd, bIndex, bEnd, isCommon) => {
2576
- let nCommon = 0;
2577
- while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
2578
- aIndex += 1;
2579
- bIndex += 1;
2580
- nCommon += 1;
2581
- }
2582
- return nCommon;
2583
- }, "countCommonItemsF");
2584
- const countCommonItemsR = /* @__PURE__ */ __name((aStart, aIndex, bStart, bIndex, isCommon) => {
2585
- let nCommon = 0;
2586
- while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
2587
- aIndex -= 1;
2588
- bIndex -= 1;
2589
- nCommon += 1;
2590
- }
2591
- return nCommon;
2592
- }, "countCommonItemsR");
2593
- const extendPathsF = /* @__PURE__ */ __name((d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
2594
- let iF = 0;
2595
- let kF = -d;
2596
- let aFirst = aIndexesF[iF];
2597
- let aIndexPrev1 = aFirst;
2598
- aIndexesF[iF] += countCommonItemsF(
2599
- aFirst + 1,
2600
- aEnd,
2601
- bF + aFirst - kF + 1,
2602
- bEnd,
2603
- isCommon
2604
- );
2605
- const nF = d < iMaxF ? d : iMaxF;
2606
- for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
2607
- if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
2608
- aFirst = aIndexesF[iF];
2609
- } else {
2610
- aFirst = aIndexPrev1 + 1;
2611
- if (aEnd <= aFirst) {
2612
- return iF - 1;
2613
- }
2614
- }
2615
- aIndexPrev1 = aIndexesF[iF];
2616
- aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
2617
- }
2618
- return iMaxF;
2619
- }, "extendPathsF");
2620
- const extendPathsR = /* @__PURE__ */ __name((d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) => {
2621
- let iR = 0;
2622
- let kR = d;
2623
- let aFirst = aIndexesR[iR];
2624
- let aIndexPrev1 = aFirst;
2625
- aIndexesR[iR] -= countCommonItemsR(
2626
- aStart,
2627
- aFirst - 1,
2628
- bStart,
2629
- bR + aFirst - kR - 1,
2630
- isCommon
2631
- );
2632
- const nR = d < iMaxR ? d : iMaxR;
2633
- for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
2634
- if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
2635
- aFirst = aIndexesR[iR];
2636
- } else {
2637
- aFirst = aIndexPrev1 - 1;
2638
- if (aFirst < aStart) {
2639
- return iR - 1;
2640
- }
2641
- }
2642
- aIndexPrev1 = aIndexesR[iR];
2643
- aIndexesR[iR] = aFirst - countCommonItemsR(
2644
- aStart,
2645
- aFirst - 1,
2646
- bStart,
2647
- bR + aFirst - kR - 1,
2648
- isCommon
2649
- );
2650
- }
2651
- return iMaxR;
2652
- }, "extendPathsR");
2653
- const extendOverlappablePathsF = /* @__PURE__ */ __name((d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
2654
- const bF = bStart - aStart;
2655
- const aLength = aEnd - aStart;
2656
- const bLength = bEnd - bStart;
2657
- const baDeltaLength = bLength - aLength;
2658
- const kMinOverlapF = -baDeltaLength - (d - 1);
2659
- const kMaxOverlapF = -baDeltaLength + (d - 1);
2660
- let aIndexPrev1 = NOT_YET_SET;
2661
- const nF = d < iMaxF ? d : iMaxF;
2662
- for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
2663
- const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
2664
- const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
2665
- const aFirst = insert ? aLastPrev : aLastPrev + 1;
2666
- const bFirst = bF + aFirst - kF;
2667
- const nCommonF = countCommonItemsF(
2668
- aFirst + 1,
2669
- aEnd,
2670
- bFirst + 1,
2671
- bEnd,
2672
- isCommon
2673
- );
2674
- const aLast = aFirst + nCommonF;
2675
- aIndexPrev1 = aIndexesF[iF];
2676
- aIndexesF[iF] = aLast;
2677
- if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
2678
- const iR = (d - 1 - (kF + baDeltaLength)) / 2;
2679
- if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
2680
- const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
2681
- const nCommonR = countCommonItemsR(
2682
- aStart,
2683
- aLastPrev,
2684
- bStart,
2685
- bLastPrev,
2686
- isCommon
2687
- );
2688
- const aIndexPrevFirst = aLastPrev - nCommonR;
2689
- const bIndexPrevFirst = bLastPrev - nCommonR;
2690
- const aEndPreceding = aIndexPrevFirst + 1;
2691
- const bEndPreceding = bIndexPrevFirst + 1;
2692
- division.nChangePreceding = d - 1;
2693
- if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
2694
- division.aEndPreceding = aStart;
2695
- division.bEndPreceding = bStart;
2696
- } else {
2697
- division.aEndPreceding = aEndPreceding;
2698
- division.bEndPreceding = bEndPreceding;
2699
- }
2700
- division.nCommonPreceding = nCommonR;
2701
- if (nCommonR !== 0) {
2702
- division.aCommonPreceding = aEndPreceding;
2703
- division.bCommonPreceding = bEndPreceding;
2704
- }
2705
- division.nCommonFollowing = nCommonF;
2706
- if (nCommonF !== 0) {
2707
- division.aCommonFollowing = aFirst + 1;
2708
- division.bCommonFollowing = bFirst + 1;
2709
- }
2710
- const aStartFollowing = aLast + 1;
2711
- const bStartFollowing = bFirst + nCommonF + 1;
2712
- division.nChangeFollowing = d - 1;
2713
- if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
2714
- division.aStartFollowing = aEnd;
2715
- division.bStartFollowing = bEnd;
2716
- } else {
2717
- division.aStartFollowing = aStartFollowing;
2718
- division.bStartFollowing = bStartFollowing;
2719
- }
2720
- return true;
2721
- }
2722
- }
2723
- }
2724
- return false;
2725
- }, "extendOverlappablePathsF");
2726
- const extendOverlappablePathsR = /* @__PURE__ */ __name((d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
2727
- const bR = bEnd - aEnd;
2728
- const aLength = aEnd - aStart;
2729
- const bLength = bEnd - bStart;
2730
- const baDeltaLength = bLength - aLength;
2731
- const kMinOverlapR = baDeltaLength - d;
2732
- const kMaxOverlapR = baDeltaLength + d;
2733
- let aIndexPrev1 = NOT_YET_SET;
2734
- const nR = d < iMaxR ? d : iMaxR;
2735
- for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
2736
- const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
2737
- const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
2738
- const aFirst = insert ? aLastPrev : aLastPrev - 1;
2739
- const bFirst = bR + aFirst - kR;
2740
- const nCommonR = countCommonItemsR(
2741
- aStart,
2742
- aFirst - 1,
2743
- bStart,
2744
- bFirst - 1,
2745
- isCommon
2746
- );
2747
- const aLast = aFirst - nCommonR;
2748
- aIndexPrev1 = aIndexesR[iR];
2749
- aIndexesR[iR] = aLast;
2750
- if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
2751
- const iF = (d + (kR - baDeltaLength)) / 2;
2752
- if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
2753
- const bLast = bFirst - nCommonR;
2754
- division.nChangePreceding = d;
2755
- if (d === aLast + bLast - aStart - bStart) {
2756
- division.aEndPreceding = aStart;
2757
- division.bEndPreceding = bStart;
2758
- } else {
2759
- division.aEndPreceding = aLast;
2760
- division.bEndPreceding = bLast;
2761
- }
2762
- division.nCommonPreceding = nCommonR;
2763
- if (nCommonR !== 0) {
2764
- division.aCommonPreceding = aLast;
2765
- division.bCommonPreceding = bLast;
2766
- }
2767
- division.nChangeFollowing = d - 1;
2768
- if (d === 1) {
2769
- division.nCommonFollowing = 0;
2770
- division.aStartFollowing = aEnd;
2771
- division.bStartFollowing = bEnd;
2772
- } else {
2773
- const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
2774
- const nCommonF = countCommonItemsF(
2775
- aLastPrev,
2776
- aEnd,
2777
- bLastPrev,
2778
- bEnd,
2779
- isCommon
2780
- );
2781
- division.nCommonFollowing = nCommonF;
2782
- if (nCommonF !== 0) {
2783
- division.aCommonFollowing = aLastPrev;
2784
- division.bCommonFollowing = bLastPrev;
2785
- }
2786
- const aStartFollowing = aLastPrev + nCommonF;
2787
- const bStartFollowing = bLastPrev + nCommonF;
2788
- if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
2789
- division.aStartFollowing = aEnd;
2790
- division.bStartFollowing = bEnd;
2791
- } else {
2792
- division.aStartFollowing = aStartFollowing;
2793
- division.bStartFollowing = bStartFollowing;
2794
- }
2795
- }
2796
- return true;
2797
- }
2798
- }
2799
- }
2800
- return false;
2801
- }, "extendOverlappablePathsR");
2802
- const divide = /* @__PURE__ */ __name((nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division) => {
2803
- const bF = bStart - aStart;
2804
- const bR = bEnd - aEnd;
2805
- const aLength = aEnd - aStart;
2806
- const bLength = bEnd - bStart;
2807
- const baDeltaLength = bLength - aLength;
2808
- let iMaxF = aLength;
2809
- let iMaxR = aLength;
2810
- aIndexesF[0] = aStart - 1;
2811
- aIndexesR[0] = aEnd;
2812
- if (baDeltaLength % 2 === 0) {
2813
- const dMin = (nChange || baDeltaLength) / 2;
2814
- const dMax = (aLength + bLength) / 2;
2815
- for (let d = 1; d <= dMax; d += 1) {
2816
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
2817
- if (d < dMin) {
2818
- iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
2819
- } else if (
2820
- // If a reverse path overlaps a forward path in the same diagonal,
2821
- // return a division of the index intervals at the middle change.
2822
- extendOverlappablePathsR(
2823
- d,
2824
- aStart,
2825
- aEnd,
2826
- bStart,
2827
- bEnd,
2828
- isCommon,
2829
- aIndexesF,
2830
- iMaxF,
2831
- aIndexesR,
2832
- iMaxR,
2833
- division
2834
- )
2835
- ) {
2836
- return;
2837
- }
2838
- }
2839
- } else {
2840
- const dMin = ((nChange || baDeltaLength) + 1) / 2;
2841
- const dMax = (aLength + bLength + 1) / 2;
2842
- let d = 1;
2843
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
2844
- for (d += 1; d <= dMax; d += 1) {
2845
- iMaxR = extendPathsR(
2846
- d - 1,
2847
- aStart,
2848
- bStart,
2849
- bR,
2850
- isCommon,
2851
- aIndexesR,
2852
- iMaxR
2853
- );
2854
- if (d < dMin) {
2855
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
2856
- } else if (
2857
- // If a forward path overlaps a reverse path in the same diagonal,
2858
- // return a division of the index intervals at the middle change.
2859
- extendOverlappablePathsF(
2860
- d,
2861
- aStart,
2862
- aEnd,
2863
- bStart,
2864
- bEnd,
2865
- isCommon,
2866
- aIndexesF,
2867
- iMaxF,
2868
- aIndexesR,
2869
- iMaxR,
2870
- division
2871
- )
2872
- ) {
2873
- return;
2874
- }
2875
- }
2876
- }
2877
- throw new Error(
2878
- `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
2879
- );
2880
- }, "divide");
2881
- const findSubsequences = /* @__PURE__ */ __name((nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division) => {
2882
- if (bEnd - bStart < aEnd - aStart) {
2883
- transposed = !transposed;
2884
- if (transposed && callbacks.length === 1) {
2885
- const { foundSubsequence: foundSubsequence2, isCommon: isCommon2 } = callbacks[0];
2886
- callbacks[1] = {
2887
- foundSubsequence: /* @__PURE__ */ __name((nCommon, bCommon, aCommon) => {
2888
- foundSubsequence2(nCommon, aCommon, bCommon);
2889
- }, "foundSubsequence"),
2890
- isCommon: /* @__PURE__ */ __name((bIndex, aIndex) => isCommon2(aIndex, bIndex), "isCommon")
2891
- };
2892
- }
2893
- const tStart = aStart;
2894
- const tEnd = aEnd;
2895
- aStart = bStart;
2896
- aEnd = bEnd;
2897
- bStart = tStart;
2898
- bEnd = tEnd;
2899
- }
2900
- const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
2901
- divide(
2902
- nChange,
2903
- aStart,
2904
- aEnd,
2905
- bStart,
2906
- bEnd,
2907
- isCommon,
2908
- aIndexesF,
2909
- aIndexesR,
2910
- division
2911
- );
2912
- const {
2913
- nChangePreceding,
2914
- aEndPreceding,
2915
- bEndPreceding,
2916
- nCommonPreceding,
2917
- aCommonPreceding,
2918
- bCommonPreceding,
2919
- nCommonFollowing,
2920
- aCommonFollowing,
2921
- bCommonFollowing,
2922
- nChangeFollowing,
2923
- aStartFollowing,
2924
- bStartFollowing
2925
- } = division;
2926
- if (aStart < aEndPreceding && bStart < bEndPreceding) {
2927
- findSubsequences(
2928
- nChangePreceding,
2929
- aStart,
2930
- aEndPreceding,
2931
- bStart,
2932
- bEndPreceding,
2933
- transposed,
2934
- callbacks,
2935
- aIndexesF,
2936
- aIndexesR,
2937
- division
2938
- );
2939
- }
2940
- if (nCommonPreceding !== 0) {
2941
- foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
2942
- }
2943
- if (nCommonFollowing !== 0) {
2944
- foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
2945
- }
2946
- if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
2947
- findSubsequences(
2948
- nChangeFollowing,
2949
- aStartFollowing,
2950
- aEnd,
2951
- bStartFollowing,
2952
- bEnd,
2953
- transposed,
2954
- callbacks,
2955
- aIndexesF,
2956
- aIndexesR,
2957
- division
2958
- );
2959
- }
2960
- }, "findSubsequences");
2961
- const validateLength = /* @__PURE__ */ __name((name, arg) => {
2962
- if (typeof arg !== "number") {
2963
- throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
2964
- }
2965
- if (!Number.isSafeInteger(arg)) {
2966
- throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
2967
- }
2968
- if (arg < 0) {
2969
- throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
2970
- }
2971
- }, "validateLength");
2972
- const validateCallback = /* @__PURE__ */ __name((name, arg) => {
2973
- const type = typeof arg;
2974
- if (type !== "function") {
2975
- throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
2976
- }
2977
- }, "validateCallback");
2978
- function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
2979
- validateLength("aLength", aLength);
2980
- validateLength("bLength", bLength);
2981
- validateCallback("isCommon", isCommon);
2982
- validateCallback("foundSubsequence", foundSubsequence);
2983
- const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
2984
- if (nCommonF !== 0) {
2985
- foundSubsequence(nCommonF, 0, 0);
2986
- }
2987
- if (aLength !== nCommonF || bLength !== nCommonF) {
2988
- const aStart = nCommonF;
2989
- const bStart = nCommonF;
2990
- const nCommonR = countCommonItemsR(
2991
- aStart,
2992
- aLength - 1,
2993
- bStart,
2994
- bLength - 1,
2995
- isCommon
2996
- );
2997
- const aEnd = aLength - nCommonR;
2998
- const bEnd = bLength - nCommonR;
2999
- const nCommonFR = nCommonF + nCommonR;
3000
- if (aLength !== nCommonFR && bLength !== nCommonFR) {
3001
- const nChange = 0;
3002
- const transposed = false;
3003
- const callbacks = [
3004
- {
3005
- foundSubsequence,
3006
- isCommon
3007
- }
3008
- ];
3009
- const aIndexesF = [NOT_YET_SET];
3010
- const aIndexesR = [NOT_YET_SET];
3011
- const division = {
3012
- aCommonFollowing: NOT_YET_SET,
3013
- aCommonPreceding: NOT_YET_SET,
3014
- aEndPreceding: NOT_YET_SET,
3015
- aStartFollowing: NOT_YET_SET,
3016
- bCommonFollowing: NOT_YET_SET,
3017
- bCommonPreceding: NOT_YET_SET,
3018
- bEndPreceding: NOT_YET_SET,
3019
- bStartFollowing: NOT_YET_SET,
3020
- nChangeFollowing: NOT_YET_SET,
3021
- nChangePreceding: NOT_YET_SET,
3022
- nCommonFollowing: NOT_YET_SET,
3023
- nCommonPreceding: NOT_YET_SET
3024
- };
3025
- findSubsequences(
3026
- nChange,
3027
- aStart,
3028
- aEnd,
3029
- bStart,
3030
- bEnd,
3031
- transposed,
3032
- callbacks,
3033
- aIndexesF,
3034
- aIndexesR,
3035
- division
3036
- );
3037
- }
3038
- if (nCommonR !== 0) {
3039
- foundSubsequence(nCommonR, aEnd, bEnd);
3040
- }
3041
- }
3042
- }
3043
- __name(diffSequence, "diffSequence");
3044
- return build;
3045
- }
3046
- __name(requireBuild, "requireBuild");
3047
- var buildExports = requireBuild();
3048
- var diffSequences = getDefaultExportFromCjs2(buildExports);
3049
- function formatTrailingSpaces(line, trailingSpaceFormatter) {
3050
- return line.replace(/\s+$/, (match) => trailingSpaceFormatter(match));
3051
- }
3052
- __name(formatTrailingSpaces, "formatTrailingSpaces");
3053
- function printDiffLine(line, isFirstOrLast, color, indicator, trailingSpaceFormatter, emptyFirstOrLastLinePlaceholder) {
3054
- return line.length !== 0 ? color(`${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}`) : indicator !== " " ? color(indicator) : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0 ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`) : "";
3055
- }
3056
- __name(printDiffLine, "printDiffLine");
3057
- function printDeleteLine(line, isFirstOrLast, { aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) {
3058
- return printDiffLine(line, isFirstOrLast, aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder);
3059
- }
3060
- __name(printDeleteLine, "printDeleteLine");
3061
- function printInsertLine(line, isFirstOrLast, { bColor, bIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) {
3062
- return printDiffLine(line, isFirstOrLast, bColor, bIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder);
3063
- }
3064
- __name(printInsertLine, "printInsertLine");
3065
- function printCommonLine(line, isFirstOrLast, { commonColor, commonIndicator, commonLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) {
3066
- return printDiffLine(line, isFirstOrLast, commonColor, commonIndicator, commonLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder);
3067
- }
3068
- __name(printCommonLine, "printCommonLine");
3069
- function createPatchMark(aStart, aEnd, bStart, bEnd, { patchColor }) {
3070
- return patchColor(`@@ -${aStart + 1},${aEnd - aStart} +${bStart + 1},${bEnd - bStart} @@`);
3071
- }
3072
- __name(createPatchMark, "createPatchMark");
3073
- function joinAlignedDiffsNoExpand(diffs, options) {
3074
- const iLength = diffs.length;
3075
- const nContextLines = options.contextLines;
3076
- const nContextLines2 = nContextLines + nContextLines;
3077
- let jLength = iLength;
3078
- let hasExcessAtStartOrEnd = false;
3079
- let nExcessesBetweenChanges = 0;
3080
- let i = 0;
3081
- while (i !== iLength) {
3082
- const iStart = i;
3083
- while (i !== iLength && diffs[i][0] === DIFF_EQUAL) {
3084
- i += 1;
3085
- }
3086
- if (iStart !== i) {
3087
- if (iStart === 0) {
3088
- if (i > nContextLines) {
3089
- jLength -= i - nContextLines;
3090
- hasExcessAtStartOrEnd = true;
3091
- }
3092
- } else if (i === iLength) {
3093
- const n = i - iStart;
3094
- if (n > nContextLines) {
3095
- jLength -= n - nContextLines;
3096
- hasExcessAtStartOrEnd = true;
3097
- }
3098
- } else {
3099
- const n = i - iStart;
3100
- if (n > nContextLines2) {
3101
- jLength -= n - nContextLines2;
3102
- nExcessesBetweenChanges += 1;
3103
- }
3104
- }
3105
- }
3106
- while (i !== iLength && diffs[i][0] !== DIFF_EQUAL) {
3107
- i += 1;
3108
- }
3109
- }
3110
- const hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd;
3111
- if (nExcessesBetweenChanges !== 0) {
3112
- jLength += nExcessesBetweenChanges + 1;
3113
- } else if (hasExcessAtStartOrEnd) {
3114
- jLength += 1;
3115
- }
3116
- const jLast = jLength - 1;
3117
- const lines = [];
3118
- let jPatchMark = 0;
3119
- if (hasPatch) {
3120
- lines.push("");
3121
- }
3122
- let aStart = 0;
3123
- let bStart = 0;
3124
- let aEnd = 0;
3125
- let bEnd = 0;
3126
- const pushCommonLine = /* @__PURE__ */ __name((line) => {
3127
- const j = lines.length;
3128
- lines.push(printCommonLine(line, j === 0 || j === jLast, options));
3129
- aEnd += 1;
3130
- bEnd += 1;
3131
- }, "pushCommonLine");
3132
- const pushDeleteLine = /* @__PURE__ */ __name((line) => {
3133
- const j = lines.length;
3134
- lines.push(printDeleteLine(line, j === 0 || j === jLast, options));
3135
- aEnd += 1;
3136
- }, "pushDeleteLine");
3137
- const pushInsertLine = /* @__PURE__ */ __name((line) => {
3138
- const j = lines.length;
3139
- lines.push(printInsertLine(line, j === 0 || j === jLast, options));
3140
- bEnd += 1;
3141
- }, "pushInsertLine");
3142
- i = 0;
3143
- while (i !== iLength) {
3144
- let iStart = i;
3145
- while (i !== iLength && diffs[i][0] === DIFF_EQUAL) {
3146
- i += 1;
3147
- }
3148
- if (iStart !== i) {
3149
- if (iStart === 0) {
3150
- if (i > nContextLines) {
3151
- iStart = i - nContextLines;
3152
- aStart = iStart;
3153
- bStart = iStart;
3154
- aEnd = aStart;
3155
- bEnd = bStart;
3156
- }
3157
- for (let iCommon = iStart; iCommon !== i; iCommon += 1) {
3158
- pushCommonLine(diffs[iCommon][1]);
3159
- }
3160
- } else if (i === iLength) {
3161
- const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i;
3162
- for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) {
3163
- pushCommonLine(diffs[iCommon][1]);
3164
- }
3165
- } else {
3166
- const nCommon = i - iStart;
3167
- if (nCommon > nContextLines2) {
3168
- const iEnd = iStart + nContextLines;
3169
- for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) {
3170
- pushCommonLine(diffs[iCommon][1]);
3171
- }
3172
- lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
3173
- jPatchMark = lines.length;
3174
- lines.push("");
3175
- const nOmit = nCommon - nContextLines2;
3176
- aStart = aEnd + nOmit;
3177
- bStart = bEnd + nOmit;
3178
- aEnd = aStart;
3179
- bEnd = bStart;
3180
- for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) {
3181
- pushCommonLine(diffs[iCommon][1]);
3182
- }
3183
- } else {
3184
- for (let iCommon = iStart; iCommon !== i; iCommon += 1) {
3185
- pushCommonLine(diffs[iCommon][1]);
3186
- }
3187
- }
3188
- }
3189
- }
3190
- while (i !== iLength && diffs[i][0] === DIFF_DELETE) {
3191
- pushDeleteLine(diffs[i][1]);
3192
- i += 1;
3193
- }
3194
- while (i !== iLength && diffs[i][0] === DIFF_INSERT) {
3195
- pushInsertLine(diffs[i][1]);
3196
- i += 1;
3197
- }
3198
- }
3199
- if (hasPatch) {
3200
- lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options);
3201
- }
3202
- return lines.join("\n");
3203
- }
3204
- __name(joinAlignedDiffsNoExpand, "joinAlignedDiffsNoExpand");
3205
- function joinAlignedDiffsExpand(diffs, options) {
3206
- return diffs.map((diff2, i, diffs2) => {
3207
- const line = diff2[1];
3208
- const isFirstOrLast = i === 0 || i === diffs2.length - 1;
3209
- switch (diff2[0]) {
3210
- case DIFF_DELETE:
3211
- return printDeleteLine(line, isFirstOrLast, options);
3212
- case DIFF_INSERT:
3213
- return printInsertLine(line, isFirstOrLast, options);
3214
- default:
3215
- return printCommonLine(line, isFirstOrLast, options);
3216
- }
3217
- }).join("\n");
3218
- }
3219
- __name(joinAlignedDiffsExpand, "joinAlignedDiffsExpand");
3220
- var noColor = /* @__PURE__ */ __name((string) => string, "noColor");
3221
- var DIFF_CONTEXT_DEFAULT = 5;
3222
- var DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
3223
- function getDefaultOptions() {
3224
- return {
3225
- aAnnotation: "Expected",
3226
- aColor: s.green,
3227
- aIndicator: "-",
3228
- bAnnotation: "Received",
3229
- bColor: s.red,
3230
- bIndicator: "+",
3231
- changeColor: s.inverse,
3232
- changeLineTrailingSpaceColor: noColor,
3233
- commonColor: s.dim,
3234
- commonIndicator: " ",
3235
- commonLineTrailingSpaceColor: noColor,
3236
- compareKeys: void 0,
3237
- contextLines: DIFF_CONTEXT_DEFAULT,
3238
- emptyFirstOrLastLinePlaceholder: "",
3239
- expand: false,
3240
- includeChangeCounts: false,
3241
- omitAnnotationLines: false,
3242
- patchColor: s.yellow,
3243
- printBasicPrototype: false,
3244
- truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
3245
- truncateAnnotation: "... Diff result is truncated",
3246
- truncateAnnotationColor: noColor
3247
- };
3248
- }
3249
- __name(getDefaultOptions, "getDefaultOptions");
3250
- function getCompareKeys(compareKeys) {
3251
- return compareKeys && typeof compareKeys === "function" ? compareKeys : void 0;
3252
- }
3253
- __name(getCompareKeys, "getCompareKeys");
3254
- function getContextLines(contextLines) {
3255
- return typeof contextLines === "number" && Number.isSafeInteger(contextLines) && contextLines >= 0 ? contextLines : DIFF_CONTEXT_DEFAULT;
3256
- }
3257
- __name(getContextLines, "getContextLines");
3258
- function normalizeDiffOptions(options = {}) {
3259
- return {
3260
- ...getDefaultOptions(),
3261
- ...options,
3262
- compareKeys: getCompareKeys(options.compareKeys),
3263
- contextLines: getContextLines(options.contextLines)
3264
- };
3265
- }
3266
- __name(normalizeDiffOptions, "normalizeDiffOptions");
3267
- function isEmptyString(lines) {
3268
- return lines.length === 1 && lines[0].length === 0;
3269
- }
3270
- __name(isEmptyString, "isEmptyString");
3271
- function countChanges(diffs) {
3272
- let a2 = 0;
3273
- let b = 0;
3274
- diffs.forEach((diff2) => {
3275
- switch (diff2[0]) {
3276
- case DIFF_DELETE:
3277
- a2 += 1;
3278
- break;
3279
- case DIFF_INSERT:
3280
- b += 1;
3281
- break;
3282
- }
3283
- });
3284
- return {
3285
- a: a2,
3286
- b
3287
- };
3288
- }
3289
- __name(countChanges, "countChanges");
3290
- function printAnnotation({ aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator, includeChangeCounts, omitAnnotationLines }, changeCounts) {
3291
- if (omitAnnotationLines) {
3292
- return "";
3293
- }
3294
- let aRest = "";
3295
- let bRest = "";
3296
- if (includeChangeCounts) {
3297
- const aCount = String(changeCounts.a);
3298
- const bCount = String(changeCounts.b);
3299
- const baAnnotationLengthDiff = bAnnotation.length - aAnnotation.length;
3300
- const aAnnotationPadding = " ".repeat(Math.max(0, baAnnotationLengthDiff));
3301
- const bAnnotationPadding = " ".repeat(Math.max(0, -baAnnotationLengthDiff));
3302
- const baCountLengthDiff = bCount.length - aCount.length;
3303
- const aCountPadding = " ".repeat(Math.max(0, baCountLengthDiff));
3304
- const bCountPadding = " ".repeat(Math.max(0, -baCountLengthDiff));
3305
- aRest = `${aAnnotationPadding} ${aIndicator} ${aCountPadding}${aCount}`;
3306
- bRest = `${bAnnotationPadding} ${bIndicator} ${bCountPadding}${bCount}`;
3307
- }
3308
- const a2 = `${aIndicator} ${aAnnotation}${aRest}`;
3309
- const b = `${bIndicator} ${bAnnotation}${bRest}`;
3310
- return `${aColor(a2)}
3311
- ${bColor(b)}
3312
-
3313
- `;
3314
- }
3315
- __name(printAnnotation, "printAnnotation");
3316
- function printDiffLines(diffs, truncated, options) {
3317
- return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options)) + (truncated ? options.truncateAnnotationColor(`
3318
- ${options.truncateAnnotation}`) : "");
3319
- }
3320
- __name(printDiffLines, "printDiffLines");
3321
- function diffLinesUnified(aLines, bLines, options) {
3322
- const normalizedOptions = normalizeDiffOptions(options);
3323
- const [diffs, truncated] = diffLinesRaw(isEmptyString(aLines) ? [] : aLines, isEmptyString(bLines) ? [] : bLines, normalizedOptions);
3324
- return printDiffLines(diffs, truncated, normalizedOptions);
3325
- }
3326
- __name(diffLinesUnified, "diffLinesUnified");
3327
- function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options) {
3328
- if (isEmptyString(aLinesDisplay) && isEmptyString(aLinesCompare)) {
3329
- aLinesDisplay = [];
3330
- aLinesCompare = [];
3331
- }
3332
- if (isEmptyString(bLinesDisplay) && isEmptyString(bLinesCompare)) {
3333
- bLinesDisplay = [];
3334
- bLinesCompare = [];
3335
- }
3336
- if (aLinesDisplay.length !== aLinesCompare.length || bLinesDisplay.length !== bLinesCompare.length) {
3337
- return diffLinesUnified(aLinesDisplay, bLinesDisplay, options);
3338
- }
3339
- const [diffs, truncated] = diffLinesRaw(aLinesCompare, bLinesCompare, options);
3340
- let aIndex = 0;
3341
- let bIndex = 0;
3342
- diffs.forEach((diff2) => {
3343
- switch (diff2[0]) {
3344
- case DIFF_DELETE:
3345
- diff2[1] = aLinesDisplay[aIndex];
3346
- aIndex += 1;
3347
- break;
3348
- case DIFF_INSERT:
3349
- diff2[1] = bLinesDisplay[bIndex];
3350
- bIndex += 1;
3351
- break;
3352
- default:
3353
- diff2[1] = bLinesDisplay[bIndex];
3354
- aIndex += 1;
3355
- bIndex += 1;
3356
- }
3357
- });
3358
- return printDiffLines(diffs, truncated, normalizeDiffOptions(options));
3359
- }
3360
- __name(diffLinesUnified2, "diffLinesUnified2");
3361
- function diffLinesRaw(aLines, bLines, options) {
3362
- const truncate2 = (options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? false;
3363
- const truncateThreshold = Math.max(Math.floor((options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? 0), 0);
3364
- const aLength = truncate2 ? Math.min(aLines.length, truncateThreshold) : aLines.length;
3365
- const bLength = truncate2 ? Math.min(bLines.length, truncateThreshold) : bLines.length;
3366
- const truncated = aLength !== aLines.length || bLength !== bLines.length;
3367
- const isCommon = /* @__PURE__ */ __name((aIndex2, bIndex2) => aLines[aIndex2] === bLines[bIndex2], "isCommon");
3368
- const diffs = [];
3369
- let aIndex = 0;
3370
- let bIndex = 0;
3371
- const foundSubsequence = /* @__PURE__ */ __name((nCommon, aCommon, bCommon) => {
3372
- for (; aIndex !== aCommon; aIndex += 1) {
3373
- diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
3374
- }
3375
- for (; bIndex !== bCommon; bIndex += 1) {
3376
- diffs.push(new Diff(DIFF_INSERT, bLines[bIndex]));
3377
- }
3378
- for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) {
3379
- diffs.push(new Diff(DIFF_EQUAL, bLines[bIndex]));
3380
- }
3381
- }, "foundSubsequence");
3382
- diffSequences(aLength, bLength, isCommon, foundSubsequence);
3383
- for (; aIndex !== aLength; aIndex += 1) {
3384
- diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
3385
- }
3386
- for (; bIndex !== bLength; bIndex += 1) {
3387
- diffs.push(new Diff(DIFF_INSERT, bLines[bIndex]));
3388
- }
3389
- return [diffs, truncated];
3390
- }
3391
- __name(diffLinesRaw, "diffLinesRaw");
3392
- function getType3(value) {
3393
- if (value === void 0) {
3394
- return "undefined";
3395
- } else if (value === null) {
3396
- return "null";
3397
- } else if (Array.isArray(value)) {
3398
- return "array";
3399
- } else if (typeof value === "boolean") {
3400
- return "boolean";
3401
- } else if (typeof value === "function") {
3402
- return "function";
3403
- } else if (typeof value === "number") {
3404
- return "number";
3405
- } else if (typeof value === "string") {
3406
- return "string";
3407
- } else if (typeof value === "bigint") {
3408
- return "bigint";
3409
- } else if (typeof value === "object") {
3410
- if (value != null) {
3411
- if (value.constructor === RegExp) {
3412
- return "regexp";
3413
- } else if (value.constructor === Map) {
3414
- return "map";
3415
- } else if (value.constructor === Set) {
3416
- return "set";
3417
- } else if (value.constructor === Date) {
3418
- return "date";
3419
- }
3420
- }
3421
- return "object";
3422
- } else if (typeof value === "symbol") {
3423
- return "symbol";
3424
- }
3425
- throw new Error(`value of unknown type: ${value}`);
3426
- }
3427
- __name(getType3, "getType");
3428
- function getNewLineSymbol(string) {
3429
- return string.includes("\r\n") ? "\r\n" : "\n";
3430
- }
3431
- __name(getNewLineSymbol, "getNewLineSymbol");
3432
- function diffStrings(a2, b, options) {
3433
- const truncate2 = (options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? false;
3434
- const truncateThreshold = Math.max(Math.floor((options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? 0), 0);
3435
- let aLength = a2.length;
3436
- let bLength = b.length;
3437
- if (truncate2) {
3438
- const aMultipleLines = a2.includes("\n");
3439
- const bMultipleLines = b.includes("\n");
3440
- const aNewLineSymbol = getNewLineSymbol(a2);
3441
- const bNewLineSymbol = getNewLineSymbol(b);
3442
- const _a = aMultipleLines ? `${a2.split(aNewLineSymbol, truncateThreshold).join(aNewLineSymbol)}
3443
- ` : a2;
3444
- const _b = bMultipleLines ? `${b.split(bNewLineSymbol, truncateThreshold).join(bNewLineSymbol)}
3445
- ` : b;
3446
- aLength = _a.length;
3447
- bLength = _b.length;
3448
- }
3449
- const truncated = aLength !== a2.length || bLength !== b.length;
3450
- const isCommon = /* @__PURE__ */ __name((aIndex2, bIndex2) => a2[aIndex2] === b[bIndex2], "isCommon");
3451
- let aIndex = 0;
3452
- let bIndex = 0;
3453
- const diffs = [];
3454
- const foundSubsequence = /* @__PURE__ */ __name((nCommon, aCommon, bCommon) => {
3455
- if (aIndex !== aCommon) {
3456
- diffs.push(new Diff(DIFF_DELETE, a2.slice(aIndex, aCommon)));
3457
- }
3458
- if (bIndex !== bCommon) {
3459
- diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex, bCommon)));
3460
- }
3461
- aIndex = aCommon + nCommon;
3462
- bIndex = bCommon + nCommon;
3463
- diffs.push(new Diff(DIFF_EQUAL, b.slice(bCommon, bIndex)));
3464
- }, "foundSubsequence");
3465
- diffSequences(aLength, bLength, isCommon, foundSubsequence);
3466
- if (aIndex !== aLength) {
3467
- diffs.push(new Diff(DIFF_DELETE, a2.slice(aIndex)));
3468
- }
3469
- if (bIndex !== bLength) {
3470
- diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex)));
3471
- }
3472
- return [diffs, truncated];
3473
- }
3474
- __name(diffStrings, "diffStrings");
3475
- function concatenateRelevantDiffs(op, diffs, changeColor) {
3476
- return diffs.reduce((reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op && diff2[1].length !== 0 ? changeColor(diff2[1]) : ""), "");
3477
- }
3478
- __name(concatenateRelevantDiffs, "concatenateRelevantDiffs");
3479
- var _ChangeBuffer = class _ChangeBuffer {
3480
- op;
3481
- line;
3482
- lines;
3483
- changeColor;
3484
- constructor(op, changeColor) {
3485
- this.op = op;
3486
- this.line = [];
3487
- this.lines = [];
3488
- this.changeColor = changeColor;
3489
- }
3490
- pushSubstring(substring) {
3491
- this.pushDiff(new Diff(this.op, substring));
3492
- }
3493
- pushLine() {
3494
- this.lines.push(this.line.length !== 1 ? new Diff(this.op, concatenateRelevantDiffs(this.op, this.line, this.changeColor)) : this.line[0][0] === this.op ? this.line[0] : new Diff(this.op, this.line[0][1]));
3495
- this.line.length = 0;
3496
- }
3497
- isLineEmpty() {
3498
- return this.line.length === 0;
3499
- }
3500
- // Minor input to buffer.
3501
- pushDiff(diff2) {
3502
- this.line.push(diff2);
3503
- }
3504
- // Main input to buffer.
3505
- align(diff2) {
3506
- const string = diff2[1];
3507
- if (string.includes("\n")) {
3508
- const substrings = string.split("\n");
3509
- const iLast = substrings.length - 1;
3510
- substrings.forEach((substring, i) => {
3511
- if (i < iLast) {
3512
- this.pushSubstring(substring);
3513
- this.pushLine();
3514
- } else if (substring.length !== 0) {
3515
- this.pushSubstring(substring);
3516
- }
3517
- });
3518
- } else {
3519
- this.pushDiff(diff2);
3520
- }
3521
- }
3522
- // Output from buffer.
3523
- moveLinesTo(lines) {
3524
- if (!this.isLineEmpty()) {
3525
- this.pushLine();
3526
- }
3527
- lines.push(...this.lines);
3528
- this.lines.length = 0;
3529
- }
3530
- };
3531
- __name(_ChangeBuffer, "ChangeBuffer");
3532
- var ChangeBuffer = _ChangeBuffer;
3533
- var _CommonBuffer = class _CommonBuffer {
3534
- deleteBuffer;
3535
- insertBuffer;
3536
- lines;
3537
- constructor(deleteBuffer, insertBuffer) {
3538
- this.deleteBuffer = deleteBuffer;
3539
- this.insertBuffer = insertBuffer;
3540
- this.lines = [];
3541
- }
3542
- pushDiffCommonLine(diff2) {
3543
- this.lines.push(diff2);
3544
- }
3545
- pushDiffChangeLines(diff2) {
3546
- const isDiffEmpty = diff2[1].length === 0;
3547
- if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) {
3548
- this.deleteBuffer.pushDiff(diff2);
3549
- }
3550
- if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) {
3551
- this.insertBuffer.pushDiff(diff2);
3552
- }
3553
- }
3554
- flushChangeLines() {
3555
- this.deleteBuffer.moveLinesTo(this.lines);
3556
- this.insertBuffer.moveLinesTo(this.lines);
3557
- }
3558
- // Input to buffer.
3559
- align(diff2) {
3560
- const op = diff2[0];
3561
- const string = diff2[1];
3562
- if (string.includes("\n")) {
3563
- const substrings = string.split("\n");
3564
- const iLast = substrings.length - 1;
3565
- substrings.forEach((substring, i) => {
3566
- if (i === 0) {
3567
- const subdiff = new Diff(op, substring);
3568
- if (this.deleteBuffer.isLineEmpty() && this.insertBuffer.isLineEmpty()) {
3569
- this.flushChangeLines();
3570
- this.pushDiffCommonLine(subdiff);
3571
- } else {
3572
- this.pushDiffChangeLines(subdiff);
3573
- this.flushChangeLines();
3574
- }
3575
- } else if (i < iLast) {
3576
- this.pushDiffCommonLine(new Diff(op, substring));
3577
- } else if (substring.length !== 0) {
3578
- this.pushDiffChangeLines(new Diff(op, substring));
3579
- }
3580
- });
3581
- } else {
3582
- this.pushDiffChangeLines(diff2);
3583
- }
3584
- }
3585
- // Output from buffer.
3586
- getLines() {
3587
- this.flushChangeLines();
3588
- return this.lines;
3589
- }
3590
- };
3591
- __name(_CommonBuffer, "CommonBuffer");
3592
- var CommonBuffer = _CommonBuffer;
3593
- function getAlignedDiffs(diffs, changeColor) {
3594
- const deleteBuffer = new ChangeBuffer(DIFF_DELETE, changeColor);
3595
- const insertBuffer = new ChangeBuffer(DIFF_INSERT, changeColor);
3596
- const commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer);
3597
- diffs.forEach((diff2) => {
3598
- switch (diff2[0]) {
3599
- case DIFF_DELETE:
3600
- deleteBuffer.align(diff2);
3601
- break;
3602
- case DIFF_INSERT:
3603
- insertBuffer.align(diff2);
3604
- break;
3605
- default:
3606
- commonBuffer.align(diff2);
3607
- }
3608
- });
3609
- return commonBuffer.getLines();
3610
- }
3611
- __name(getAlignedDiffs, "getAlignedDiffs");
3612
- function hasCommonDiff(diffs, isMultiline) {
3613
- if (isMultiline) {
3614
- const iLast = diffs.length - 1;
3615
- return diffs.some((diff2, i) => diff2[0] === DIFF_EQUAL && (i !== iLast || diff2[1] !== "\n"));
3616
- }
3617
- return diffs.some((diff2) => diff2[0] === DIFF_EQUAL);
3618
- }
3619
- __name(hasCommonDiff, "hasCommonDiff");
3620
- function diffStringsUnified(a2, b, options) {
3621
- if (a2 !== b && a2.length !== 0 && b.length !== 0) {
3622
- const isMultiline = a2.includes("\n") || b.includes("\n");
3623
- const [diffs, truncated] = diffStringsRaw(isMultiline ? `${a2}
3624
- ` : a2, isMultiline ? `${b}
3625
- ` : b, true, options);
3626
- if (hasCommonDiff(diffs, isMultiline)) {
3627
- const optionsNormalized = normalizeDiffOptions(options);
3628
- const lines = getAlignedDiffs(diffs, optionsNormalized.changeColor);
3629
- return printDiffLines(lines, truncated, optionsNormalized);
3630
- }
3631
- }
3632
- return diffLinesUnified(a2.split("\n"), b.split("\n"), options);
3633
- }
3634
- __name(diffStringsUnified, "diffStringsUnified");
3635
- function diffStringsRaw(a2, b, cleanup, options) {
3636
- const [diffs, truncated] = diffStrings(a2, b, options);
3637
- if (cleanup) {
3638
- diff_cleanupSemantic(diffs);
3639
- }
3640
- return [diffs, truncated];
3641
- }
3642
- __name(diffStringsRaw, "diffStringsRaw");
3643
- function getCommonMessage(message, options) {
3644
- const { commonColor } = normalizeDiffOptions(options);
3645
- return commonColor(message);
3646
- }
3647
- __name(getCommonMessage, "getCommonMessage");
3648
- var { AsymmetricMatcher: AsymmetricMatcher2, DOMCollection: DOMCollection2, DOMElement: DOMElement2, Immutable: Immutable2, ReactElement: ReactElement2, ReactTestComponent: ReactTestComponent2 } = plugins;
3649
- var PLUGINS2 = [
3650
- ReactTestComponent2,
3651
- ReactElement2,
3652
- DOMElement2,
3653
- DOMCollection2,
3654
- Immutable2,
3655
- AsymmetricMatcher2,
3656
- plugins.Error
3657
- ];
3658
- var FORMAT_OPTIONS = {
3659
- maxDepth: 20,
3660
- plugins: PLUGINS2
3661
- };
3662
- var FALLBACK_FORMAT_OPTIONS = {
3663
- callToJSON: false,
3664
- maxDepth: 8,
3665
- plugins: PLUGINS2
3666
- };
3667
- function diff(a2, b, options) {
3668
- if (Object.is(a2, b)) {
3669
- return "";
3670
- }
3671
- const aType = getType3(a2);
3672
- let expectedType = aType;
3673
- let omitDifference = false;
3674
- if (aType === "object" && typeof a2.asymmetricMatch === "function") {
3675
- if (a2.$$typeof !== Symbol.for("jest.asymmetricMatcher")) {
3676
- return void 0;
3677
- }
3678
- if (typeof a2.getExpectedType !== "function") {
3679
- return void 0;
3680
- }
3681
- expectedType = a2.getExpectedType();
3682
- omitDifference = expectedType === "string";
3683
- }
3684
- if (expectedType !== getType3(b)) {
3685
- let truncate2 = function(s2) {
3686
- return s2.length <= MAX_LENGTH ? s2 : `${s2.slice(0, MAX_LENGTH)}...`;
3687
- };
3688
- __name(truncate2, "truncate");
3689
- const { aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator } = normalizeDiffOptions(options);
3690
- const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
3691
- let aDisplay = format(a2, formatOptions);
3692
- let bDisplay = format(b, formatOptions);
3693
- const MAX_LENGTH = 1e5;
3694
- aDisplay = truncate2(aDisplay);
3695
- bDisplay = truncate2(bDisplay);
3696
- const aDiff = `${aColor(`${aIndicator} ${aAnnotation}:`)}
3697
- ${aDisplay}`;
3698
- const bDiff = `${bColor(`${bIndicator} ${bAnnotation}:`)}
3699
- ${bDisplay}`;
3700
- return `${aDiff}
3701
-
3702
- ${bDiff}`;
3703
- }
3704
- if (omitDifference) {
3705
- return void 0;
3706
- }
3707
- switch (aType) {
3708
- case "string":
3709
- return diffLinesUnified(a2.split("\n"), b.split("\n"), options);
3710
- case "boolean":
3711
- case "number":
3712
- return comparePrimitive(a2, b, options);
3713
- case "map":
3714
- return compareObjects(sortMap(a2), sortMap(b), options);
3715
- case "set":
3716
- return compareObjects(sortSet(a2), sortSet(b), options);
3717
- default:
3718
- return compareObjects(a2, b, options);
3719
- }
3720
- }
3721
- __name(diff, "diff");
3722
- function comparePrimitive(a2, b, options) {
3723
- const aFormat = format(a2, FORMAT_OPTIONS);
3724
- const bFormat = format(b, FORMAT_OPTIONS);
3725
- return aFormat === bFormat ? "" : diffLinesUnified(aFormat.split("\n"), bFormat.split("\n"), options);
3726
- }
3727
- __name(comparePrimitive, "comparePrimitive");
3728
- function sortMap(map) {
3729
- return new Map(Array.from(map.entries()).sort());
3730
- }
3731
- __name(sortMap, "sortMap");
3732
- function sortSet(set) {
3733
- return new Set(Array.from(set.values()).sort());
3734
- }
3735
- __name(sortSet, "sortSet");
3736
- function compareObjects(a2, b, options) {
3737
- let difference;
3738
- let hasThrown = false;
3739
- try {
3740
- const formatOptions = getFormatOptions(FORMAT_OPTIONS, options);
3741
- difference = getObjectsDifference(a2, b, formatOptions, options);
3742
- } catch {
3743
- hasThrown = true;
3744
- }
3745
- const noDiffMessage = getCommonMessage(NO_DIFF_MESSAGE, options);
3746
- if (difference === void 0 || difference === noDiffMessage) {
3747
- const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
3748
- difference = getObjectsDifference(a2, b, formatOptions, options);
3749
- if (difference !== noDiffMessage && !hasThrown) {
3750
- difference = `${getCommonMessage(SIMILAR_MESSAGE, options)}
3751
-
3752
- ${difference}`;
3753
- }
3754
- }
3755
- return difference;
3756
- }
3757
- __name(compareObjects, "compareObjects");
3758
- function getFormatOptions(formatOptions, options) {
3759
- const { compareKeys, printBasicPrototype, maxDepth } = normalizeDiffOptions(options);
3760
- return {
3761
- ...formatOptions,
3762
- compareKeys,
3763
- printBasicPrototype,
3764
- maxDepth: maxDepth ?? formatOptions.maxDepth
3765
- };
3766
- }
3767
- __name(getFormatOptions, "getFormatOptions");
3768
- function getObjectsDifference(a2, b, formatOptions, options) {
3769
- const formatOptionsZeroIndent = {
3770
- ...formatOptions,
3771
- indent: 0
3772
- };
3773
- const aCompare = format(a2, formatOptionsZeroIndent);
3774
- const bCompare = format(b, formatOptionsZeroIndent);
3775
- if (aCompare === bCompare) {
3776
- return getCommonMessage(NO_DIFF_MESSAGE, options);
3777
- } else {
3778
- const aDisplay = format(a2, formatOptions);
3779
- const bDisplay = format(b, formatOptions);
3780
- return diffLinesUnified2(aDisplay.split("\n"), bDisplay.split("\n"), aCompare.split("\n"), bCompare.split("\n"), options);
3781
- }
3782
- }
3783
- __name(getObjectsDifference, "getObjectsDifference");
3784
- var MAX_DIFF_STRING_LENGTH = 2e4;
3785
- function isAsymmetricMatcher(data) {
3786
- const type = getType2(data);
3787
- return type === "Object" && typeof data.asymmetricMatch === "function";
3788
- }
3789
- __name(isAsymmetricMatcher, "isAsymmetricMatcher");
3790
- function isReplaceable(obj1, obj2) {
3791
- const obj1Type = getType2(obj1);
3792
- const obj2Type = getType2(obj2);
3793
- return obj1Type === obj2Type && (obj1Type === "Object" || obj1Type === "Array");
3794
- }
3795
- __name(isReplaceable, "isReplaceable");
3796
- function printDiffOrStringify(received, expected, options) {
3797
- const { aAnnotation, bAnnotation } = normalizeDiffOptions(options);
3798
- if (typeof expected === "string" && typeof received === "string" && expected.length > 0 && received.length > 0 && expected.length <= MAX_DIFF_STRING_LENGTH && received.length <= MAX_DIFF_STRING_LENGTH && expected !== received) {
3799
- if (expected.includes("\n") || received.includes("\n")) {
3800
- return diffStringsUnified(expected, received, options);
3801
- }
3802
- const [diffs] = diffStringsRaw(expected, received, true);
3803
- const hasCommonDiff2 = diffs.some((diff2) => diff2[0] === DIFF_EQUAL);
3804
- const printLabel = getLabelPrinter(aAnnotation, bAnnotation);
3805
- const expectedLine = printLabel(aAnnotation) + printExpected(getCommonAndChangedSubstrings(diffs, DIFF_DELETE, hasCommonDiff2));
3806
- const receivedLine = printLabel(bAnnotation) + printReceived(getCommonAndChangedSubstrings(diffs, DIFF_INSERT, hasCommonDiff2));
3807
- return `${expectedLine}
3808
- ${receivedLine}`;
3809
- }
3810
- const clonedExpected = deepClone(expected, { forceWritable: true });
3811
- const clonedReceived = deepClone(received, { forceWritable: true });
3812
- const { replacedExpected, replacedActual } = replaceAsymmetricMatcher(clonedReceived, clonedExpected);
3813
- const difference = diff(replacedExpected, replacedActual, options);
3814
- return difference;
3815
- }
3816
- __name(printDiffOrStringify, "printDiffOrStringify");
3817
- function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
3818
- if (actual instanceof Error && expected instanceof Error && typeof actual.cause !== "undefined" && typeof expected.cause === "undefined") {
3819
- delete actual.cause;
3820
- return {
3821
- replacedActual: actual,
3822
- replacedExpected: expected
3823
- };
3824
- }
3825
- if (!isReplaceable(actual, expected)) {
3826
- return {
3827
- replacedActual: actual,
3828
- replacedExpected: expected
3829
- };
3830
- }
3831
- if (actualReplaced.has(actual) || expectedReplaced.has(expected)) {
3832
- return {
3833
- replacedActual: actual,
3834
- replacedExpected: expected
3835
- };
3836
- }
3837
- actualReplaced.add(actual);
3838
- expectedReplaced.add(expected);
3839
- getOwnProperties(expected).forEach((key) => {
3840
- const expectedValue = expected[key];
3841
- const actualValue = actual[key];
3842
- if (isAsymmetricMatcher(expectedValue)) {
3843
- if (expectedValue.asymmetricMatch(actualValue)) {
3844
- actual[key] = expectedValue;
3845
- }
3846
- } else if (isAsymmetricMatcher(actualValue)) {
3847
- if (actualValue.asymmetricMatch(expectedValue)) {
3848
- expected[key] = actualValue;
3849
- }
3850
- } else if (isReplaceable(actualValue, expectedValue)) {
3851
- const replaced = replaceAsymmetricMatcher(actualValue, expectedValue, actualReplaced, expectedReplaced);
3852
- actual[key] = replaced.replacedActual;
3853
- expected[key] = replaced.replacedExpected;
3854
- }
3855
- });
3856
- return {
3857
- replacedActual: actual,
3858
- replacedExpected: expected
3859
- };
3860
- }
3861
- __name(replaceAsymmetricMatcher, "replaceAsymmetricMatcher");
3862
- function getLabelPrinter(...strings) {
3863
- const maxLength = strings.reduce((max, string) => string.length > max ? string.length : max, 0);
3864
- return (string) => `${string}: ${" ".repeat(maxLength - string.length)}`;
3865
- }
3866
- __name(getLabelPrinter, "getLabelPrinter");
3867
- var SPACE_SYMBOL = "\xB7";
3868
- function replaceTrailingSpaces(text) {
3869
- return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3870
- }
3871
- __name(replaceTrailingSpaces, "replaceTrailingSpaces");
3872
- function printReceived(object) {
3873
- return s.red(replaceTrailingSpaces(stringify(object)));
3874
- }
3875
- __name(printReceived, "printReceived");
3876
- function printExpected(value) {
3877
- return s.green(replaceTrailingSpaces(stringify(value)));
3878
- }
3879
- __name(printExpected, "printExpected");
3880
- function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
3881
- return diffs.reduce((reduced, diff2) => reduced + (diff2[0] === DIFF_EQUAL ? diff2[1] : diff2[0] === op ? hasCommonDiff2 ? s.inverse(diff2[1]) : diff2[1] : ""), "");
3882
- }
3883
- __name(getCommonAndChangedSubstrings, "getCommonAndChangedSubstrings");
3884
-
3885
- // ../node_modules/@vitest/utils/dist/error.js
3886
- var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
3887
- var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
3888
- function isImmutable(v) {
3889
- return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
3890
- }
3891
- __name(isImmutable, "isImmutable");
3892
- var OBJECT_PROTO = Object.getPrototypeOf({});
3893
- function getUnserializableMessage(err) {
3894
- if (err instanceof Error) {
3895
- return `<unserializable>: ${err.message}`;
3896
- }
3897
- if (typeof err === "string") {
3898
- return `<unserializable>: ${err}`;
3899
- }
3900
- return "<unserializable>";
3901
- }
3902
- __name(getUnserializableMessage, "getUnserializableMessage");
3903
- function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
3904
- if (!val || typeof val === "string") {
3905
- return val;
3906
- }
3907
- if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
3908
- const jsonValue = val.toJSON();
3909
- if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
3910
- if (typeof val.message === "string") {
3911
- safe(() => jsonValue.message ?? (jsonValue.message = val.message));
3912
- }
3913
- if (typeof val.stack === "string") {
3914
- safe(() => jsonValue.stack ?? (jsonValue.stack = val.stack));
3915
- }
3916
- if (typeof val.name === "string") {
3917
- safe(() => jsonValue.name ?? (jsonValue.name = val.name));
3918
- }
3919
- if (val.cause != null) {
3920
- safe(() => jsonValue.cause ?? (jsonValue.cause = serializeValue(val.cause, seen)));
3921
- }
3922
- }
3923
- return serializeValue(jsonValue, seen);
3924
- }
3925
- if (typeof val === "function") {
3926
- return `Function<${val.name || "anonymous"}>`;
3927
- }
3928
- if (typeof val === "symbol") {
3929
- return val.toString();
3930
- }
3931
- if (typeof val !== "object") {
3932
- return val;
3933
- }
3934
- if (typeof Buffer !== "undefined" && val instanceof Buffer) {
3935
- return `<Buffer(${val.length}) ...>`;
3936
- }
3937
- if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) {
3938
- return `<Uint8Array(${val.length}) ...>`;
3939
- }
3940
- if (isImmutable(val)) {
3941
- return serializeValue(val.toJSON(), seen);
3942
- }
3943
- if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") {
3944
- return "Promise";
3945
- }
3946
- if (typeof Element !== "undefined" && val instanceof Element) {
3947
- return val.tagName;
3948
- }
3949
- if (typeof val.asymmetricMatch === "function") {
3950
- return `${val.toString()} ${format2(val.sample)}`;
3951
- }
3952
- if (typeof val.toJSON === "function") {
3953
- return serializeValue(val.toJSON(), seen);
3954
- }
3955
- if (seen.has(val)) {
3956
- return seen.get(val);
3957
- }
3958
- if (Array.isArray(val)) {
3959
- const clone2 = new Array(val.length);
3960
- seen.set(val, clone2);
3961
- val.forEach((e, i) => {
3962
- try {
3963
- clone2[i] = serializeValue(e, seen);
3964
- } catch (err) {
3965
- clone2[i] = getUnserializableMessage(err);
3966
- }
3967
- });
3968
- return clone2;
3969
- } else {
3970
- const clone2 = /* @__PURE__ */ Object.create(null);
3971
- seen.set(val, clone2);
3972
- let obj = val;
3973
- while (obj && obj !== OBJECT_PROTO) {
3974
- Object.getOwnPropertyNames(obj).forEach((key) => {
3975
- if (key in clone2) {
3976
- return;
3977
- }
3978
- try {
3979
- clone2[key] = serializeValue(val[key], seen);
3980
- } catch (err) {
3981
- delete clone2[key];
3982
- clone2[key] = getUnserializableMessage(err);
3983
- }
3984
- });
3985
- obj = Object.getPrototypeOf(obj);
3986
- }
3987
- return clone2;
3988
- }
3989
- }
3990
- __name(serializeValue, "serializeValue");
3991
- function safe(fn) {
3992
- try {
3993
- return fn();
3994
- } catch {
3995
- }
3996
- }
3997
- __name(safe, "safe");
3998
- function normalizeErrorMessage(message) {
3999
- return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
4000
- }
4001
- __name(normalizeErrorMessage, "normalizeErrorMessage");
4002
- function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
4003
- if (!_err || typeof _err !== "object") {
4004
- return { message: String(_err) };
4005
- }
4006
- const err = _err;
4007
- if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) {
4008
- err.diff = printDiffOrStringify(err.actual, err.expected, {
4009
- ...diffOptions,
4010
- ...err.diffOptions
4011
- });
4012
- }
4013
- if ("expected" in err && typeof err.expected !== "string") {
4014
- err.expected = stringify(err.expected, 10);
4015
- }
4016
- if ("actual" in err && typeof err.actual !== "string") {
4017
- err.actual = stringify(err.actual, 10);
4018
- }
4019
- try {
4020
- if (typeof err.message === "string") {
4021
- err.message = normalizeErrorMessage(err.message);
4022
- }
4023
- } catch {
4024
- }
4025
- try {
4026
- if (!seen.has(err) && typeof err.cause === "object") {
4027
- seen.add(err);
4028
- err.cause = processError(err.cause, diffOptions, seen);
4029
- }
4030
- } catch {
4031
- }
4032
- try {
4033
- return serializeValue(err);
4034
- } catch (e) {
4035
- return serializeValue(new Error(`Failed to fully serialize error: ${e === null || e === void 0 ? void 0 : e.message}
4036
- Inner error message: ${err === null || err === void 0 ? void 0 : err.message}`));
4037
- }
4038
- }
4039
- __name(processError, "processError");
4040
-
4041
- export {
4042
- s,
4043
- stringify,
4044
- getDefaultExportFromCjs2 as getDefaultExportFromCjs,
4045
- assertTypes,
4046
- isObject,
4047
- getType2 as getType,
4048
- noop,
4049
- diff,
4050
- printDiffOrStringify,
4051
- processError
4052
- };